Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions plugins/content-highlight/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const contentChangeEvents: string[] = [
Blockly.Events.BLOCK_MOVE,
Blockly.Events.BLOCK_DELETE,
Blockly.Events.COMMENT_MOVE,
Blockly.Events.COMMENT_RESIZE,
Blockly.Events.COMMENT_CREATE,
Blockly.Events.COMMENT_DELETE,
];
Expand Down Expand Up @@ -197,7 +198,9 @@ export class ContentHighlight {
this.position(this.cachedContentMetrics, absoluteMetrics);
}
} else if (event.type === Blockly.Events.BLOCK_DRAG) {
this.handleBlockDrag(event as Blockly.Events.BlockDrag);
this.handleDragEvent(event as Blockly.Events.BlockDrag);
} else if (event.type === Blockly.Events.COMMENT_DRAG) {
this.handleDragEvent(event as Blockly.Events.CommentDrag);
} else if (event.type === Blockly.Events.BLOCK_CHANGE) {
// Resizes the content highlight when it is a block change event
const metricsManager = this.workspace.getMetricsManager();
Expand All @@ -212,7 +215,9 @@ export class ContentHighlight {
*
* @param event The BlockDrag event.
*/
private handleBlockDrag(event: Blockly.Events.BlockDrag) {
private handleDragEvent(
event: Blockly.Events.BlockDrag | Blockly.Events.CommentDrag,
) {
const opacity = event.isStart ? '0' : '1';
this.svgGroup?.setAttribute('opacity', opacity);
}
Expand Down
Loading