Skip to content

Commit b0e8d94

Browse files
committed
Merge pull request scratchfoundation#732 from AndersBillLinden/issue727
Fixing issue 727
2 parents c32f3b8 + ac21495 commit b0e8d94

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

src/uiwidgets/ScriptsPane.as

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,12 @@ public class ScriptsPane extends ScrollFrameContents {
139139
}
140140

141141
public function updateFeedbackFor(b:Block):void {
142-
nearestTarget = nearestTargetForBlockIn(b, possibleTargets);
143-
if (b.base.canHaveSubstack1() && !b.subStack1) {
144-
var o:Block = null;
145-
if (nearestTarget) {
146-
t = nearestTarget[1];
142+
143+
function updateHeight(): void {
144+
var h:int = BlockShape.EmptySubstackH;
145+
if (nearestTarget != null) {
146+
var t:* = nearestTarget[1];
147+
var o:Block = null;
147148
switch (nearestTarget[2]) {
148149
case INSERT_NORMAL:
149150
o = t.nextBlock;
@@ -158,17 +159,17 @@ public class ScriptsPane extends ScrollFrameContents {
158159
o = t.subStack2;
159160
break;
160161
}
161-
}
162-
var h:int = BlockShape.EmptySubstackH;
163-
if (o) {
164-
h = o.height;
165-
if (!o.bottomBlock().isTerminal) h -= BlockShape.NotchDepth;
162+
if (o) {
163+
h = o.height;
164+
if (!o.bottomBlock().isTerminal) h -= BlockShape.NotchDepth;
165+
}
166166
}
167167
b.previewSubstack1Height(h);
168168
}
169-
if (nearestTarget != null) {
170-
var localP:Point = globalToLocal(nearestTarget[0]);
169+
170+
function updateFeedbackShape() : void {
171171
var t:* = nearestTarget[1];
172+
var localP:Point = globalToLocal(nearestTarget[0]);
172173
feedbackShape.x = localP.x;
173174
feedbackShape.y = localP.y;
174175
feedbackShape.visible = true;
@@ -181,9 +182,24 @@ public class ScriptsPane extends ScrollFrameContents {
181182
var isInsertion:Boolean = (insertionType != INSERT_ABOVE) && (insertionType != INSERT_WRAP);
182183
feedbackShape.copyFeedbackShapeFrom(b, false, isInsertion, wrapH);
183184
}
184-
} else {
185+
}
186+
187+
if (mouseX + x >= 0) {
188+
nearestTarget = nearestTargetForBlockIn(b, possibleTargets);
189+
if (nearestTarget != null) {
190+
updateFeedbackShape();
191+
} else {
192+
hideFeedbackShape();
193+
}
194+
if (b.base.canHaveSubstack1() && !b.subStack1) {
195+
updateHeight();
196+
}
197+
}
198+
else {
199+
nearestTarget = null;
185200
hideFeedbackShape();
186201
}
202+
187203
fixCommentLayout();
188204
}
189205

0 commit comments

Comments
 (0)