Skip to content

Commit 117b7e8

Browse files
Add brief visual highlight when a block connection is successfully made
1 parent 70ed297 commit 117b7e8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

js/blocks.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,21 @@ class Blocks {
21232123
}
21242124

21252125
this.adjustDocks(newBlock, true);
2126-
/** TODO: some graphical feedback re new connection? */
2126+
/** Graphical feedback for the new connection */
2127+
// Staged scheduling to anchor feedback after docking redraw storm
2128+
requestAnimationFrame(() => {
2129+
requestAnimationFrame(() => {
2130+
const feedbackBlockObj = this.blockList[newBlock];
2131+
if (feedbackBlockObj) {
2132+
feedbackBlockObj.highlight();
2133+
this.activity.refreshCanvas();
2134+
setTimeout(() => {
2135+
feedbackBlockObj.unhighlight();
2136+
this.activity.refreshCanvas();
2137+
}, 220);
2138+
}
2139+
});
2140+
});
21272141

21282142
/** Check if top block is one of the widget blocks. */
21292143
let lockInit = false;

0 commit comments

Comments
 (0)