Constrain minimum stage size to 480 x 180

pull/3/merge
jmoenig 2014-02-13 09:54:40 +01:00
rodzic dac7460e76
commit 5058595335
3 zmienionych plików z 15 dodań i 10 usunięć

15
gui.js
Wyświetl plik

@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph, Audio*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.gui = '2014-February-11'; modules.gui = '2014-February-13';
// Declarations // Declarations
@ -3515,7 +3515,7 @@ IDE_Morph.prototype.userSetStageHeight = function () {
IDE_Morph.prototype.setStageWidth = function (num) { IDE_Morph.prototype.setStageWidth = function (num) {
this.setStageExtent(new Point( this.setStageExtent(new Point(
Math.max(num, 240), num,
(StageMorph.prototype.dimensions.y) (StageMorph.prototype.dimensions.y)
)); ));
}; };
@ -3523,20 +3523,21 @@ IDE_Morph.prototype.setStageWidth = function (num) {
IDE_Morph.prototype.setStageHeight = function (num) { IDE_Morph.prototype.setStageHeight = function (num) {
this.setStageExtent(new Point( this.setStageExtent(new Point(
(StageMorph.prototype.dimensions.x), (StageMorph.prototype.dimensions.x),
Math.max(num, 180) num
)); ));
}; };
IDE_Morph.prototype.setStageExtent = function (aPoint) { IDE_Morph.prototype.setStageExtent = function (aPoint) {
var myself = this; var myself = this,
ext = aPoint.max(new Point(480, 180));
function zoom() { function zoom() {
myself.step = function () { myself.step = function () {
var delta = aPoint.subtract( var delta = ext.subtract(
StageMorph.prototype.dimensions StageMorph.prototype.dimensions
).divideBy(2); ).divideBy(2);
if (delta.abs().lt(new Point(5, 5))) { if (delta.abs().lt(new Point(5, 5))) {
StageMorph.prototype.dimensions = aPoint; StageMorph.prototype.dimensions = ext;
delete myself.step; delete myself.step;
} else { } else {
StageMorph.prototype.dimensions = StageMorph.prototype.dimensions =
@ -3555,7 +3556,7 @@ IDE_Morph.prototype.setStageExtent = function (aPoint) {
if (this.isAnimating) { if (this.isAnimating) {
zoom(); zoom();
} else { } else {
StageMorph.prototype.dimensions = aPoint; StageMorph.prototype.dimensions = ext;
this.stage.setExtent(StageMorph.prototype.dimensions); this.stage.setExtent(StageMorph.prototype.dimensions);
this.stage.clearPenTrails(); this.stage.clearPenTrails();
this.fixLayout(); this.fixLayout();

Wyświetl plik

@ -2095,3 +2095,7 @@ ______
* GUI: Set stage dimensions arbitrarily (new entries in the settings menu when holding shift) * GUI: Set stage dimensions arbitrarily (new entries in the settings menu when holding shift)
* Store: Saving & Loading for arbitrary stage dimensions in the project data * Store: Saving & Loading for arbitrary stage dimensions in the project data
* new Date block, thanks, Michael!!! * new Date block, thanks, Michael!!!
140213
------
* GUI, Store: constrain minimum stage size to 480 x 180

Wyświetl plik

@ -61,7 +61,7 @@ SyntaxElementMorph*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.store = '2014-February-11'; modules.store = '2014-February-13';
// XML_Serializer /////////////////////////////////////////////////////// // XML_Serializer ///////////////////////////////////////////////////////
@ -380,11 +380,11 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) {
StageMorph.prototype.dimensions = new Point(480, 360); StageMorph.prototype.dimensions = new Point(480, 360);
if (model.stage.attributes.width) { if (model.stage.attributes.width) {
StageMorph.prototype.dimensions.x = StageMorph.prototype.dimensions.x =
+model.stage.attributes.width; Math.max(+model.stage.attributes.width, 480);
} }
if (model.stage.attributes.height) { if (model.stage.attributes.height) {
StageMorph.prototype.dimensions.y = StageMorph.prototype.dimensions.y =
+model.stage.attributes.height; Math.max(+model.stage.attributes.height, 180);
} }
project.stage.setExtent(StageMorph.prototype.dimensions); project.stage.setExtent(StageMorph.prototype.dimensions);
SpriteMorph.prototype.useFlatLineEnds = SpriteMorph.prototype.useFlatLineEnds =