summaryrefslogtreecommitdiff
path: root/gui.js
diff options
context:
space:
mode:
Diffstat (limited to 'gui.js')
-rw-r--r--gui.js59
1 files changed, 39 insertions, 20 deletions
diff --git a/gui.js b/gui.js
index 28549df..38b28bc 100644
--- a/gui.js
+++ b/gui.js
@@ -69,7 +69,7 @@ SpeechBubbleMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.gui = '2014-July-30';
+modules.gui = '2014-December-04';
// Declarations
@@ -234,10 +234,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'];
@@ -246,10 +242,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),
@@ -737,9 +740,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, muteSoundsButton].forEach(
function (button) {
x += padding;
@@ -1893,7 +1898,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; }
@@ -2543,8 +2548,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'
@@ -3360,15 +3366,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;
}
@@ -3377,11 +3388,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();
@@ -3390,7 +3401,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();
@@ -3398,7 +3417,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());
}
};
@@ -6002,7 +6021,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;