kopia lustrzana https://github.com/backface/turtlestitch
New Feature: Set stage dimensions arbitrarily
new entries to set stage width and height in the settings menu when holding the shift keypull/3/merge
rodzic
bfda0d26a1
commit
4e2bfdec20
100
gui.js
100
gui.js
|
@ -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 () {
|
||||
|
|
|
@ -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;
|
||||
|
|
4
paint.js
4
paint.js
|
@ -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
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue