summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorJens Mönig <jens@moenig.org>2013-04-23 08:07:04 -0700
committerJens Mönig <jens@moenig.org>2013-04-23 08:07:04 -0700
commit8a7faaa7f595ca02d6238a4c02be346f083dd412 (patch)
tree15be1a92e8a12be6f67f27bb5cb132f09a274164 /blocks.js
parent43f51863d013f10d49554d59fca4929bb19d7532 (diff)
parent2d9a3df2a892366f05276c58bccd1df0e819b6d4 (diff)
downloadsnap-byow-8a7faaa7f595ca02d6238a4c02be346f083dd412.tar.gz
snap-byow-8a7faaa7f595ca02d6238a4c02be346f083dd412.zip
Merge pull request #68 from queryselector/issue-19
Fixed #19
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/blocks.js b/blocks.js
index 7ace781..588b4a6 100644
--- a/blocks.js
+++ b/blocks.js
@@ -558,8 +558,7 @@ SyntaxElementMorph.prototype.reactToGrabOf = function (grabbedMorph) {
comment.align(topBlock);
});
if (topBlock.getHighlight()) {
- topBlock.removeHighlight();
- topBlock.addHighlight();
+ topBlock.addHighlight(topBlock.removeHighlight());
}
}
};
@@ -1377,8 +1376,7 @@ SyntaxElementMorph.prototype.fixLayout = function () {
SyntaxElementMorph.prototype.fixHighlight = function () {
var top = this.topBlock();
if (top.getHighlight && top.getHighlight()) {
- top.removeHighlight();
- top.addHighlight();
+ top.addHighlight(top.removeHighlight());
}
};
@@ -2127,13 +2125,13 @@ BlockMorph.prototype.eraseHoles = function (context) {
// BlockMorph highlighting
-BlockMorph.prototype.addHighlight = function () {
+BlockMorph.prototype.addHighlight = function (oldHighlight) {
var isHidden = !this.isVisible,
highlight;
if (isHidden) {this.show(); }
highlight = this.highlight(
- this.activeHighlight,
+ oldHighlight ? oldHighlight.color : this.activeHighlight,
this.activeBlur,
this.activeBorder
);
@@ -2166,6 +2164,7 @@ BlockMorph.prototype.removeHighlight = function () {
this.fullChanged();
this.removeChild(highlight);
}
+ return highlight;
};
BlockMorph.prototype.toggleHighlight = function () {
@@ -2181,6 +2180,7 @@ BlockMorph.prototype.highlight = function (color, blur, border) {
fb = this.fullBounds(),
edge = useBlurredShadows ? blur : border;
highlight.setExtent(fb.extent().add(edge * 2));
+ highlight.color = color;
highlight.image = useBlurredShadows ?
this.highlightImageBlurred(color, blur)
: this.highlightImage(color, border);
@@ -2533,8 +2533,7 @@ BlockMorph.prototype.snap = function () {
this.removeHighlight();
}
if (top.getHighlight()) {
- top.removeHighlight();
- top.addHighlight();
+ top.addHighlight(top.removeHighlight());
}
};