Skip to content

Commit

Permalink
Merge pull request #20 from HappyFrontedCoding/master
Browse files Browse the repository at this point in the history
fix: 优化圆形和矩形绘制-解决右键撤销BUG
  • Loading branch information
hongfaqiu authored Jul 31, 2024
2 parents 11ae60f + 4637c1b commit 0a47e4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions packages/drawer/src/shape/circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ import type { LifeCycle } from '../base';

export default class Circle extends BasicGraphices implements LifeCycle {
dropPoint(move: EventArgs): void {
this._dropPoint(move, this.createShape.bind(this));
if(this.painter._breakPointEntities.length < 1) {
this._dropPoint(move, this.createShape.bind(this));
}
}

playOff(): Entity {
return this._playOff(this.createShape.bind(this));
}

cancel(): void {
this._cancel(this.createShape.bind(this));
this.painter.clear();
if (this._onPointsChange) this._onPointsChange([...this.painter._activeShapePoints]);
}

createShape(hierarchy: Cartesian3[] | CallbackProperty, isDynamic = false): Entity {
Expand Down
7 changes: 5 additions & 2 deletions packages/drawer/src/shape/rectangle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import type { LifeCycle } from '../base';

export default class Rectangle extends BasicGraphices implements LifeCycle {
dropPoint(move: EventArgs): void {
this._dropPoint(move, this.createShape.bind(this));
if(this.painter._breakPointEntities.length < 1) {
this._dropPoint(move, this.createShape.bind(this));
}
}

playOff(): Entity {
Expand All @@ -29,7 +31,8 @@ export default class Rectangle extends BasicGraphices implements LifeCycle {
}

cancel(): void {
this._cancel(this.createShape.bind(this));
this.painter.clear();
if (this._onPointsChange) this._onPointsChange([...this.painter._activeShapePoints]);
}

createShape(hierarchy: Cartesian3[] | CallbackProperty, isDynamic = false): Entity {
Expand Down

0 comments on commit 0a47e4b

Please sign in to comment.