diff options
Diffstat (limited to 'gui.js')
| -rw-r--r-- | gui.js | 59 |
1 files changed, 39 insertions, 20 deletions
@@ -69,7 +69,7 @@ SpeechBubbleMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2014-July-30'; +modules.gui = '2014-December-04'; // Declarations @@ -233,10 +233,6 @@ IDE_Morph.prototype.init = function (isAutoFill) { IDE_Morph.prototype.openIn = function (world) { var hash, usr, myself = this, urlLanguage = null; - this.buildPanes(); - world.add(this); - world.userMenu = this.userMenu; - // get persistent user data, if any if (localStorage) { usr = localStorage['-snap-user']; @@ -245,10 +241,17 @@ IDE_Morph.prototype.openIn = function (world) { if (usr) { SnapCloud.username = usr.username || null; SnapCloud.password = usr.password || null; + if (SnapCloud.username) { + this.source = 'cloud'; + } } } } + this.buildPanes(); + world.add(this); + world.userMenu = this.userMenu; + // override SnapCloud's user message with Morphic SnapCloud.message = function (string) { var m = new MenuMorph(null, string), @@ -703,9 +706,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; @@ -1859,7 +1864,7 @@ IDE_Morph.prototype.newSpriteName = function (name, ignoredSprite) { stem = (ix < 0) ? name : name.substring(0, ix), count = 1, newName = stem, - all = this.sprites.asArray().filter( + all = this.sprites.asArray().concat(this.stage).filter( function (each) {return each !== ignoredSprite; } ).map( function (each) {return each.name; } @@ -2509,8 +2514,9 @@ IDE_Morph.prototype.aboutSnap = function () { + 'jens@moenig.org, bh@cs.berkeley.edu\n\n' + 'Snap! is developed by the University of California, Berkeley\n' - + ' with support from the National Science Foundation ' - + 'and MioSoft. \n' + + ' with support from the National Science Foundation, ' + + 'MioSoft, \n' + + 'and the Communications Design Group at SAP Labs. \n' + 'The design of Snap! is influenced and inspired by Scratch,\n' + 'from the Lifelong Kindergarten group at the MIT Media Lab\n\n' @@ -3326,15 +3332,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,11 +3354,11 @@ 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()); if (myself.stageRatio > 0.9) { + myself.stageRatio = 1; myself.isSmallStage = false; myself.setExtent(world.extent()); myself.controlBar.stageSizeButton.refresh(); @@ -3356,7 +3367,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 +3383,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()); } }; @@ -5947,7 +5966,7 @@ WardrobeMorph.prototype.removeCostumeAt = function (idx) { WardrobeMorph.prototype.paintNew = function () { var cos = new Costume( newCanvas(), - this.sprite.newCostumeName('Untitled') + this.sprite.newCostumeName(localize('Untitled')) ), ide = this.parentThatIsA(IDE_Morph), myself = this; |
