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
8 changes: 7 additions & 1 deletion core/comments/comment_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ export class CommentView implements IRenderedElement {
/** Whether this comment view has been disposed or not. */
private disposed = false;

/** Size of this comment when the resize drag was initiated. */
private preResizeSize?: Size;

constructor(private readonly workspace: WorkspaceSvg) {
this.svgRoot = dom.createSvgElement(Svg.G, {
'class': 'blocklyComment blocklyEditable',
Expand Down Expand Up @@ -334,7 +337,7 @@ export class CommentView implements IRenderedElement {
* elements to reflect the new size, and triggers size change listeners.
*/
setSize(size: Size) {
const oldSize = this.size;
const oldSize = this.preResizeSize || this.size;
this.setSizeWithoutFiringEvents(size);
this.onSizeChange(oldSize, this.size);
}
Expand Down Expand Up @@ -519,6 +522,8 @@ export class CommentView implements IRenderedElement {
return;
}

this.preResizeSize = this.getSize();

// TODO(#7926): Move this into a utils file.
this.workspace.startDrag(
e,
Expand Down Expand Up @@ -559,6 +564,7 @@ export class CommentView implements IRenderedElement {
}
// When ending a resize drag, notify size change listeners to fire an event.
this.setSize(this.size);
this.preResizeSize = undefined;
}

/** Resizes the comment in response to a drag on the resize handle. */
Expand Down