summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2014-02-05 11:46:55 +0100
committerjmoenig <jens@moenig.org>2014-02-05 11:46:55 +0100
commit38bdc86b55597d41b126a6465083ba7caf8458ef (patch)
tree297af0b122ab5364954c2dd4cd3fc9b317d2bf9c
parent8b5fa2ff9bd81ad9227b2593f9ccd6fdb8d32444 (diff)
downloadsnap-38bdc86b55597d41b126a6465083ba7caf8458ef.tar.gz
snap-38bdc86b55597d41b126a6465083ba7caf8458ef.zip
One-stop-shopping for stage dimensions
changing the stage dimensions in line 3720 of objects.js takes care of everything
-rwxr-xr-xhistory.txt4
-rw-r--r--objects.js6
-rw-r--r--paint.js19
3 files changed, 18 insertions, 11 deletions
diff --git a/history.txt b/history.txt
index 77c2e9d..4591e71 100755
--- a/history.txt
+++ b/history.txt
@@ -2085,3 +2085,7 @@ ______
* Objects: Enable playing sounds and notes on Firefox, thanks, Dean Brettle, for this fix!!
* Update Portuguese translation, thanks, Manuel!
* Update French translation, thanks, grego!
+
+140205
+------
+* Objects, Paint: One-stop-shopping for stage dimensions (changing the stage dimensions in line 3720 of objects.js takes care of everything)
diff --git a/objects.js b/objects.js
index 52126e2..d93f582 100644
--- a/objects.js
+++ b/objects.js
@@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.objects = '2014-February-04';
+modules.objects = '2014-February-05';
var SpriteMorph;
var StageMorph;
@@ -5305,7 +5305,7 @@ Costume.prototype.edit = function (aWorld, anIDE, isnew, oncancel, onsubmit) {
editor.openIn(
aWorld,
isnew ?
- newCanvas(new Point(480, 360)) :
+ newCanvas(StageMorph.prototype.dimensions) :
this.contents,
isnew ?
new Point(240, 180) :
@@ -6557,7 +6557,7 @@ StagePrompterMorph.prototype.init = function (question) {
if (this.label) {this.add(this.label); }
this.add(this.inputField);
this.add(this.button);
- this.setWidth(480 - 20);
+ this.setWidth(StageMorph.prototype.dimensions.x - 20);
this.fixLayout();
};
diff --git a/paint.js b/paint.js
index 1929f95..f4fd2f3 100644
--- a/paint.js
+++ b/paint.js
@@ -51,6 +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)
*/
@@ -59,12 +60,12 @@
CostumeIconMorph, IDE_Morph, Costume, SpriteMorph, nop, Image, WardrobeMorph,
TurtleIconMorph, localize, MenuMorph, InputFieldMorph, SliderMorph,
ToggleMorph, ToggleButtonMorph, BoxMorph, modules, radians,
- MorphicPreferences, getDocumentPositionOf
+ MorphicPreferences, getDocumentPositionOf, StageMorph
*/
// Global stuff ////////////////////////////////////////////////////////
-modules.paint = '2014-January-09';
+modules.paint = '2014-February-05';
// Declarations
@@ -106,7 +107,7 @@ PaintEditorMorph.prototype.buildContents = function () {
var myself = this;
this.paper = new PaintCanvasMorph(function () {return myself.shift; });
- this.paper.setExtent(new Point(480, 360));
+ this.paper.setExtent(StageMorph.prototype.dimensions);
this.addBody(new AlignmentMorph('row', this.padding));
this.controls = new AlignmentMorph('column', this.padding);
@@ -693,11 +694,11 @@ PaintCanvasMorph.prototype.floodfill = function (sourcepoint) {
while (stack.length > 0) {
currentpoint = stack.pop();
if (checkpoint(read(currentpoint))) {
- if (currentpoint % 480 > 1) {
+ if (currentpoint % width > 1) {
stack.push(currentpoint + 1);
stack.push(currentpoint - 1);
}
- if (currentpoint > 0 && currentpoint < 360 * 480) {
+ if (currentpoint > 0 && currentpoint < height * width) {
stack.push(currentpoint + width);
stack.push(currentpoint - width);
}
@@ -750,7 +751,9 @@ PaintCanvasMorph.prototype.mouseMove = function (pos) {
q = relpos.y, // current drag y
w = (p - x) / 2, // half the rect width
h = (q - y) / 2, // half the rect height
- i; // iterator number
+ i, // iterator number
+ width = this.paper.width;
+
mctx.save();
function newW() {
return Math.max(Math.abs(w), Math.abs(h)) * (w / Math.abs(w));
@@ -825,7 +828,7 @@ PaintCanvasMorph.prototype.mouseMove = function (pos) {
false
);
} else {
- for (i = 0; i < 480; i += 1) {
+ for (i = 0; i < width; i += 1) {
mctx.lineTo(
i,
(2 * h) * Math.sqrt(2 - Math.pow(
@@ -834,7 +837,7 @@ PaintCanvasMorph.prototype.mouseMove = function (pos) {
)) + y
);
}
- for (i = 480; i > 0; i -= 1) {
+ for (i = width; i > 0; i -= 1) {
mctx.lineTo(
i,
-1 * (2 * h) * Math.sqrt(2 - Math.pow(