szurubooru/client/js/models/point.js

36 lines
617 B
JavaScript
Raw Normal View History

"use strict";
2016-07-22 13:27:52 +02:00
const events = require("../events.js");
2016-07-22 13:27:52 +02:00
class Point extends events.EventTarget {
constructor(x, y) {
super();
this._x = x;
this._y = y;
}
2020-06-04 20:09:35 +02:00
get x() {
return this._x;
}
get y() {
return this._y;
}
2016-07-22 13:27:52 +02:00
set x(value) {
this._x = value;
this.dispatchEvent(
new CustomEvent("change", { detail: { point: this } })
);
2016-07-22 13:27:52 +02:00
}
set y(value) {
this._y = value;
this.dispatchEvent(
new CustomEvent("change", { detail: { point: this } })
);
2016-07-22 13:27:52 +02:00
}
2020-06-04 20:09:35 +02:00
}
2016-07-22 13:27:52 +02:00
module.exports = Point;