Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Hide content highlight on comment drag, update on resize. #2400

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion plugins/content-highlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"typescript": "^5.4.5"
},
"peerDependencies": {
"blockly": "^11.0.0"
"blockly": "^11.1.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need another bump before being merged correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. The current release is v11.1.1, so I picked a higher number, but I don't know whether the next release will be a minor or patch release.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also not sure! I don't think we've discussed our next release timeline yet. I'll leave this unresolved for now to make sure we check before releasing.

},
"publishConfig": {
"access": "public",
Expand Down
9 changes: 7 additions & 2 deletions plugins/content-highlight/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const contentChangeEvents = [
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 @@ -196,7 +197,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 @@ -211,7 +214,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