szurubooru/client/js/models/point.js
2020-06-04 19:02:33 -04:00

31 lines
565 B
JavaScript

'use strict';
const events = require('../events.js');
class Point extends events.EventTarget {
constructor(x, y) {
super();
this._x = x;
this._y = y;
}
get x() {
return this._x;
}
get y() {
return this._y;
}
set x(value) {
this._x = value;
this.dispatchEvent(new CustomEvent('change', {detail: {point: this}}));
}
set y(value) {
this._y = value;
this.dispatchEvent(new CustomEvent('change', {detail: {point: this}}));
}
}
module.exports = Point;