summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2015-01-21 17:15:58 +0100
committerjmoenig <jens@moenig.org>2015-01-21 17:15:58 +0100
commit82552d0b294092a009a40a9761eadf0b5d3e753f (patch)
tree1cc74972a6659e13137d165f161c07d692fa9719
parent669704a90adf772f534c89fb4c3732236fef2b51 (diff)
downloadsnap-82552d0b294092a009a40a9761eadf0b5d3e753f.tar.gz
snap-82552d0b294092a009a40a9761eadf0b5d3e753f.zip
Fix speech bubbles of dragged nested sprites
-rwxr-xr-xhistory.txt1
-rw-r--r--objects.js12
2 files changed, 8 insertions, 5 deletions
diff --git a/history.txt b/history.txt
index ad0f53d..deb76a6 100755
--- a/history.txt
+++ b/history.txt
@@ -2425,3 +2425,4 @@ ______
* GUI, Store, BYOB: Generate ScriptsPaneTexture programmatically
* GUI: Fix Zoom Dialog’s sample background in “flat” design
* Updated Korean and Catalan translations, thanks, Yunjae Jang and Bernat Romagosa!
+* Objects: Fix speech bubbles of dragged nested sprites
diff --git a/objects.js b/objects.js
index e59726f..981fb20 100644
--- a/objects.js
+++ b/objects.js
@@ -3155,14 +3155,11 @@ SpriteMorph.prototype.positionTalkBubble = function () {
bubble.changed();
};
-// dragging and dropping adjustments b/c of talk bubbles
+// dragging and dropping adjustments b/c of talk bubbles and parts
SpriteMorph.prototype.prepareToBeGrabbed = function (hand) {
- var bubble = this.talkBubble();
- this.recordLayers();
- if (!bubble) {return null; }
this.removeShadow();
- bubble.hide();
+ this.recordLayers();
if (!this.bounds.containsPoint(hand.position())) {
this.setCenter(hand.position());
}
@@ -4055,6 +4052,10 @@ SpriteMorph.prototype.recordLayers = function () {
return;
}
this.layers = this.allParts();
+ this.layers.forEach(function (part) {
+ var bubble = part.talkBubble();
+ if (bubble) {bubble.hide(); }
+ });
this.layers.sort(function (x, y) {
return stage.children.indexOf(x) < stage.children.indexOf(y) ?
-1 : 1;
@@ -4065,6 +4066,7 @@ SpriteMorph.prototype.restoreLayers = function () {
if (this.layers && this.layers.length > 1) {
this.layers.forEach(function (sprite) {
sprite.comeToFront();
+ sprite.positionTalkBubble();
});
}
this.layers = null;