diff --git a/gui.js b/gui.js index 0eb84a9e..db9419bf 100644 --- a/gui.js +++ b/gui.js @@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2013-August-07'; +modules.gui = '2013-August-09'; // Declarations @@ -4699,6 +4699,7 @@ SpriteIconMorph.prototype.init = function (aSprite, aTemplate) { this.object = aSprite || new SpriteMorph(); // mandatory, actually this.version = this.object.version; this.thumbnail = null; + this.rotationButton = null; // synchronous rotation of nested sprites // initialize inherited properties: SpriteIconMorph.uber.init.call( @@ -4731,6 +4732,7 @@ SpriteIconMorph.prototype.createThumbnail = function () { this.thumbnail.setExtent(this.thumbSize); if (this.object instanceof SpriteMorph) { // support nested sprites this.thumbnail.image = this.object.fullThumbnail(this.thumbSize); + this.createRotationButton(); } else { this.thumbnail.image = this.object.thumbnail(this.thumbSize); } @@ -4764,6 +4766,46 @@ SpriteIconMorph.prototype.createLabel = function () { this.add(this.label); }; +SpriteIconMorph.prototype.createRotationButton = function () { + var button, myself = this; + + if (this.rotationButton) { + this.rotationButton.destroy(); + this.roationButton = null; + } + if (!this.object.anchor) { + return; + } + + button = new ToggleButtonMorph( + null, // colors, + null, // target + function () { + myself.object.rotatesWithAnchor = + !myself.object.rotatesWithAnchor; + }, + [ + '\u2192', + '\u21BB' + ], + function () { // query + return myself.object.rotatesWithAnchor; + } + ); + + button.corner = 8; + button.labelMinExtent = new Point(11, 11); + button.padding = 0; + button.pressColor = button.color; + button.drawNew(); + // button.hint = 'rotate synchronously\nwith anchor'; + button.fixLayout(); + button.refresh(); + button.changed(); + this.rotationButton = button; + this.add(this.rotationButton); +}; + // SpriteIconMorph stepping SpriteIconMorph.prototype.step = function () { @@ -4801,6 +4843,11 @@ SpriteIconMorph.prototype.fixLayout = function () { this.top() + this.outline + this.edge + this.padding ); + if (this.rotationButton) { + this.rotationButton.setTop(this.top()); + this.rotationButton.setRight(this.right()); + } + this.label.setWidth( Math.min( this.label.children[0].width(), // the actual text diff --git a/history.txt b/history.txt index c4baec84..8aec5a6e 100755 --- a/history.txt +++ b/history.txt @@ -1865,3 +1865,7 @@ ______ * Objects: Nested Sprite Rotation * Objects: Nested Sprite synchronous / independent rotation * Dutch translation update, thanks, Sjoerd Dirk Meijer! + +130809 +------ +* GUI: Nested Sprite Rotation style buttons on corral icons diff --git a/objects.js b/objects.js index 649a5bb0..d23986dc 100644 --- a/objects.js +++ b/objects.js @@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2013-August-08'; +modules.objects = '2013-August-09'; var SpriteMorph; var StageMorph;