Skip to content

Commit a86adf2

Browse files
committed
fix calling set triggering the callback multiple times
1 parent 943bf0c commit a86adf2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/melonjs/src/geometries/observablePoint.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class ObservablePoint {
3535
},
3636
});
3737

38+
this.callBackEnabled = true;
3839
this._revoke = revoke;
3940
this._point = proxy;
4041

@@ -50,8 +51,11 @@ export class ObservablePoint {
5051
* @returns Reference to this object for method chaining.
5152
*/
5253
set(x = 0, y = 0) {
54+
this.callBackEnabled = false;
5355
this._point.x = x;
5456
this._point.y = y;
57+
this._callback?.();
58+
this.callBackEnabled = true;
5559
return this;
5660
}
5761

0 commit comments

Comments
 (0)