fix: comment move and change events (#7947)

* fix: comment move event

* feat: add support for a drag reason

* fix: comment change events

* chore: add tests for move and change events
This commit is contained in:
Beka Westberg
2024-04-03 19:58:04 +00:00
committed by GitHub
parent 3988e13fbc
commit e75a4fb1d3
5 changed files with 96 additions and 13 deletions

View File

@@ -109,16 +109,15 @@ export class RenderedWorkspaceComment
}
/** Move the comment by the given amounts in workspace coordinates. */
moveBy(dx: number, dy: number, _reason?: string[] | undefined): void {
// TODO(#7909): Deal with reason when we add events.
moveBy(dx: number, dy: number, reason?: string[] | undefined): void {
const loc = this.getRelativeToSurfaceXY();
const newLoc = new Coordinate(loc.x + dx, loc.y + dy);
this.moveTo(newLoc);
this.moveTo(newLoc, reason);
}
/** Moves the comment to the given location in workspace coordinates. */
override moveTo(location: Coordinate): void {
super.moveTo(location);
override moveTo(location: Coordinate, reason?: string[] | undefined): void {
super.moveTo(location, reason);
this.view.moveTo(location);
}