diff options
| author | jmoenig <jens@moenig.org> | 2014-02-11 17:38:35 +0100 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2014-02-11 17:38:35 +0100 |
| commit | 4e2bfdec206598317f4145e2cb23a9c9fc453bfb (patch) | |
| tree | 8a2bb8ff477f8b5b88efc4edb0cda2bd3d3cdf15 | |
| parent | bfda0d26a1bfecc7d439dcd61d6e6179972292bd (diff) | |
| download | snap-yow-4e2bfdec206598317f4145e2cb23a9c9fc453bfb.tar.gz snap-yow-4e2bfdec206598317f4145e2cb23a9c9fc453bfb.zip | |
New Feature: Set stage dimensions arbitrarily
new entries to set stage width and height in the settings menu when
holding the shift key
| -rw-r--r-- | gui.js | 100 | ||||
| -rwxr-xr-x | history.txt | 4 | ||||
| -rw-r--r-- | objects.js | 2 | ||||
| -rw-r--r-- | paint.js | 4 |
4 files changed, 106 insertions, 4 deletions
@@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph, Audio*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2014-February-04'; +modules.gui = '2014-February-11'; // Declarations @@ -2061,6 +2061,20 @@ IDE_Morph.prototype.settingsMenu = function () { 'Zoom blocks...', 'userSetBlocksScale' ); + if (shiftClicked) { + menu.addItem( + 'Stage width...', + 'userSetStageWidth', + null, + new Color(100, 0, 0) + ); + menu.addItem( + 'Stage height...', + 'userSetStageHeight', + null, + new Color(100, 0, 0) + ); + } menu.addLine(); addPreference( 'Blurred shadows', @@ -2695,6 +2709,7 @@ IDE_Morph.prototype.newProject = function () { this.globalVariables = new VariableFrame(); this.currentSprite = new SpriteMorph(this.globalVariables); this.sprites = new List([this.currentSprite]); + StageMorph.prototype.dimensions = new Point(480, 360); StageMorph.prototype.hiddenPrimitives = {}; StageMorph.prototype.codeMappings = {}; StageMorph.prototype.codeHeaders = {}; @@ -3464,6 +3479,89 @@ IDE_Morph.prototype.setBlocksScale = function (num) { this.saveSetting('zoom', num); }; +// IDE_Morph stage size manipulation + +IDE_Morph.prototype.userSetStageWidth = function () { + new DialogBoxMorph( + this, + this.setStageWidth, + this + ).prompt( + "Stage width", + StageMorph.prototype.dimensions.x.toString(), + this.world(), + null, // pic + null, // choices + null, // read only + true // numeric + ); +}; + +IDE_Morph.prototype.userSetStageHeight = function () { + new DialogBoxMorph( + this, + this.setStageHeight, + this + ).prompt( + "Stage height", + StageMorph.prototype.dimensions.y.toString(), + this.world(), + null, // pic + null, // choices + null, // read only + true // numeric + ); +}; + +IDE_Morph.prototype.setStageWidth = function (num) { + this.setStageExtent(new Point( + Math.max(num, 240), + (StageMorph.prototype.dimensions.y) + )); +}; + +IDE_Morph.prototype.setStageHeight = function (num) { + this.setStageExtent(new Point( + (StageMorph.prototype.dimensions.x), + Math.max(num, 180) + )); +}; + +IDE_Morph.prototype.setStageExtent = function (aPoint) { + var myself = this; + + function zoom() { + myself.step = function () { + var delta = aPoint.subtract( + StageMorph.prototype.dimensions + ).divideBy(2); + if (delta.abs().lt(new Point(5, 5))) { + StageMorph.prototype.dimensions = aPoint; + delete myself.step; + } else { + StageMorph.prototype.dimensions = + StageMorph.prototype.dimensions.add(delta); + } + myself.stage.setExtent(StageMorph.prototype.dimensions); + myself.stage.clearPenTrails(); + myself.fixLayout(); + }; + } + + this.stageRatio = 1; + this.isSmallStage = false; + this.controlBar.stageSizeButton.refresh(); + this.setExtent(this.world().extent()); + if (this.isAnimating) { + zoom(); + } else { + StageMorph.prototype.dimensions = aPoint; + this.stage.setExtent(StageMorph.prototype.dimensions); + this.stage.clearPenTrails(); + this.fixLayout(); + } +}; + // IDE_Morph cloud interface IDE_Morph.prototype.initializeCloud = function () { diff --git a/history.txt b/history.txt index 4591e71..9e0e497 100755 --- a/history.txt +++ b/history.txt @@ -2089,3 +2089,7 @@ ______ 140205 ------ * Objects, Paint: One-stop-shopping for stage dimensions (changing the stage dimensions in line 3720 of objects.js takes care of everything) + +140211 +------ +* GUI: Set stage dimensions arbitrarily (new entries in the settings menu when holding shift) @@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2014-February-05'; +modules.objects = '2014-February-11'; var SpriteMorph; var StageMorph; @@ -51,7 +51,7 @@ July 12 - pipette tool, code formatting adjustments (Jens) September 16 - flood fill freeze fix (Kartik) Jan 08 - mouse leave dragging fix (Kartik) - Feb 04 - dynamically adjust to stage dimensions (Jens) + Feb 11 - dynamically adjust to stage dimensions (Jens) */ @@ -65,7 +65,7 @@ // Global stuff //////////////////////////////////////////////////////// -modules.paint = '2014-February-05'; +modules.paint = '2014-February-11'; // Declarations |
