Skip to content

Commit

Permalink
Make it so you can still drag comment around when clicking on header …
Browse files Browse the repository at this point in the history
…text
  • Loading branch information
thsparks committed Sep 26, 2024
1 parent e5e9c98 commit 5f488bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion pxtblocks/plugins/comments/bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export abstract class Bubble implements Blockly.IDeletable {
public readonly workspace: Blockly.WorkspaceSvg,
protected anchor: Blockly.utils.Coordinate,
protected ownerRect?: Blockly.utils.Rect,
protected headerText?: string,
protected readonly headerText?: string,
) {
this.id = Blockly.utils.idGenerator.getNextUniqueId();
this.svgRoot = dom.createSvgElement(
Expand Down Expand Up @@ -168,6 +168,15 @@ export abstract class Bubble implements Blockly.IDeletable {
this.onMouseDown,
);

if (this.header) {
Blockly.browserEvents.conditionalBind(
this.header,
'pointerdown',
this,
this.onMouseDown,
);
}

Blockly.browserEvents.conditionalBind(
this.collapseIcon,
'pointerdown',
Expand Down Expand Up @@ -761,5 +770,6 @@ Blockly.Css.register(`
.blocklyText.bubbleHeaderText {
font-weight: bold;
cursor: grab;
}
`);
2 changes: 1 addition & 1 deletion pxtblocks/plugins/comments/textinput_bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class TextInputBubble extends Bubble {
protected ownerRect?: Blockly.utils.Rect,
protected readonly readOnly?: boolean,
protected readonly additionalClasses?: string[],
protected headerText?: string,
protected readonly headerText?: string,
) {
super(workspace, anchor, ownerRect, headerText);
dom.addClass(this.svgRoot, 'blocklyTextInputBubble');
Expand Down

0 comments on commit 5f488bd

Please sign in to comment.