summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-09-20 09:50:06 +0200
committerjmoenig <jens@moenig.org>2013-09-20 09:50:06 +0200
commit8eb98dc5b1b9f7377c3116df4f6399634557c313 (patch)
tree15231d7d1b81205195c2233823072770857b3fb5
parent6394ebc24a797555263b7f43db2b12be456b5a03 (diff)
downloadsnap-byow-8eb98dc5b1b9f7377c3116df4f6399634557c313.tar.gz
snap-byow-8eb98dc5b1b9f7377c3116df4f6399634557c313.zip
fixed #172, IF ON EDGE, BOUNCE
Morphic: Rectangle.amountToTranslateWithin()
-rwxr-xr-xhistory.txt4
-rw-r--r--morphic.js6
2 files changed, 7 insertions, 3 deletions
diff --git a/history.txt b/history.txt
index 591e939..1134bd5 100755
--- a/history.txt
+++ b/history.txt
@@ -1921,3 +1921,7 @@ ______
130919
* Objects: fixed #169 (sprites are sometimes off-placed when the project is loaded)
* Objects, GUI: fixed #146 (filter out empty costumes)
+
+130920
+------
+* Morphic: fixed #172, Rectangle.amountToTranslateWithin() for IF ON EDGE, BOUNCE
diff --git a/morphic.js b/morphic.js
index aae17fd..2aaba02 100644
--- a/morphic.js
+++ b/morphic.js
@@ -1035,7 +1035,7 @@
/*global window, HTMLCanvasElement, getMinimumFontHeight, FileReader, Audio,
FileList, getBlurredShadowSupport*/
-var morphicVersion = '2013-August-06';
+var morphicVersion = '2013-September-20';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
@@ -1928,7 +1928,7 @@ Rectangle.prototype.amountToTranslateWithin = function (aRect) {
aRectangle. when all of me cannot be made to fit, prefer to keep
my topLeft inside. Taken from Squeak.
*/
- var dx, dy;
+ var dx = 0, dy = 0;
if (this.right() > aRect.right()) {
dx = aRect.right() - this.right();
@@ -1937,7 +1937,7 @@ Rectangle.prototype.amountToTranslateWithin = function (aRect) {
dy = aRect.bottom() - this.bottom();
}
if ((this.left() + dx) < aRect.left()) {
- dx = aRect.left() - this.right();
+ dx = aRect.left() - this.left();
}
if ((this.top() + dy) < aRect.top()) {
dy = aRect.top() - this.top();