From 45e1f3193b6a0593f084df28ee3d8f194bcea448 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 2 Oct 2014 10:31:09 +0200 Subject: [PATCH] New feature - minimal stage mode (shift-click on small-stage button) --- gui.js | 38 ++++++++++++++++++++++++++------------ history.txt | 8 ++++++-- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/gui.js b/gui.js index ee9d22c4..24562778 100644 --- a/gui.js +++ b/gui.js @@ -69,7 +69,7 @@ SpeechBubbleMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2014-October-01'; +modules.gui = '2014-October-02'; // Declarations @@ -703,9 +703,11 @@ IDE_Morph.prototype.createControlBar = function () { } ); - x = myself.right() - (StageMorph.prototype.dimensions.x - * (myself.isSmallStage ? myself.stageRatio : 1)); - + x = Math.min( + startButton.left() - (3 * padding + 2 * stageSizeButton.width()), + myself.right() - StageMorph.prototype.dimensions.x * + (myself.isSmallStage ? myself.stageRatio : 1) + ); [stageSizeButton, appModeButton].forEach( function (button) { x += padding; @@ -3326,15 +3328,20 @@ IDE_Morph.prototype.toggleAppMode = function (appMode) { IDE_Morph.prototype.toggleStageSize = function (isSmall) { var myself = this, - world = this.world(); + smallRatio = 0.5, + world = this.world(), + shiftClicked = (world.currentKey === 16); + + function toggle() { + myself.isSmallStage = isNil(isSmall) ? !myself.isSmallStage : isSmall; + } function zoomIn() { - myself.stageRatio = 1; myself.step = function () { - myself.stageRatio -= (myself.stageRatio - 0.5) / 2; + myself.stageRatio -= (myself.stageRatio - smallRatio) / 2; myself.setExtent(world.extent()); - if (myself.stageRatio < 0.6) { - myself.stageRatio = 0.5; + if (myself.stageRatio < (smallRatio + 0.1)) { + myself.stageRatio = smallRatio; myself.setExtent(world.extent()); delete myself.step; } @@ -3343,7 +3350,6 @@ IDE_Morph.prototype.toggleStageSize = function (isSmall) { function zoomOut() { myself.isSmallStage = true; - myself.stageRatio = 0.5; myself.step = function () { myself.stageRatio += (1 - myself.stageRatio) / 2; myself.setExtent(world.extent()); @@ -3356,7 +3362,15 @@ IDE_Morph.prototype.toggleStageSize = function (isSmall) { }; } - this.isSmallStage = isNil(isSmall) ? !this.isSmallStage : isSmall; + if (shiftClicked) { + smallRatio = SpriteIconMorph.prototype.thumbSize.x * 3 / + this.stage.dimensions.x; + if (!this.isSmallStage || (smallRatio === this.stageRatio)) { + toggle(); + } + } else { + toggle(); + } if (this.isAnimating) { if (this.isSmallStage) { zoomIn(); @@ -3364,7 +3378,7 @@ IDE_Morph.prototype.toggleStageSize = function (isSmall) { zoomOut(); } } else { - if (this.isSmallStage) {this.stageRatio = 0.5; } + if (this.isSmallStage) {this.stageRatio = smallRatio; } this.setExtent(world.extent()); } }; diff --git a/history.txt b/history.txt index 25e2ab0a..00dc07ed 100755 --- a/history.txt +++ b/history.txt @@ -2291,9 +2291,13 @@ ______ * Objects: fixed #378 (disable context menus for boolean representations) * Blocks: fixed #584 -140930 +141001 ------ * Threads: workaround for some REPORT issues * Objects: fixed #599 (disable IDE keyboard shortcuts in presentation mode) -* Objects: correctly display symbol for %obj type input slots in the prototype template +* Blocks: correctly display symbol for %obj type input slots in the prototype template * Portuguese translation update, thanks, Manuel! + +141002 +------ +* GUI: New feature - minimal stage mode (shift-click on small-stage button)