50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$maths$point$ObservablePoint = function(global, require, module, exports) {
|
|
class ObservablePoint {
|
|
constructor(observer, x, y) {
|
|
this._x = x || 0;
|
|
this._y = y || 0;
|
|
this._observer = observer;
|
|
}
|
|
clone(observer) {
|
|
return new ObservablePoint(observer ?? this._observer, this._x, this._y);
|
|
}
|
|
set(x = 0, y = x) {
|
|
if (this._x !== x || this._y !== y) {
|
|
this._x = x, this._y = y, this._observer._onUpdate(this);
|
|
}
|
|
return this;
|
|
}
|
|
copyFrom(p) {
|
|
if (this._x !== p.x || this._y !== p.y) {
|
|
this._x = p.x, this._y = p.y, this._observer._onUpdate(this);
|
|
}
|
|
return this;
|
|
}
|
|
copyTo(p) {
|
|
p.set(this._x, this._y);
|
|
return p;
|
|
}
|
|
equals(p) {
|
|
return p.x === this._x && p.y === this._y;
|
|
}
|
|
toString() {
|
|
return `[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`;
|
|
}
|
|
get x() {
|
|
return this._x;
|
|
}
|
|
set x(value) {
|
|
this._x !== value && (this._x = value, this._observer._onUpdate(this));
|
|
}
|
|
get y() {
|
|
return this._y;
|
|
}
|
|
set y(value) {
|
|
this._y !== value && (this._y = value, this._observer._onUpdate(this));
|
|
}
|
|
}
|
|
exports.ObservablePoint = ObservablePoint;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$maths$point$ObservablePoint.js.map
|