2016-07-22 13:27:52 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const events = require('../events.js');
|
|
|
|
|
|
|
|
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}}));
|
|
|
|
}
|
|
|
|
|
|
|
|
set y(value) {
|
|
|
|
this._y = value;
|
|
|
|
this.dispatchEvent(new CustomEvent('change', {detail: {point: this}}));
|
|
|
|
}
|
2020-06-04 20:09:35 +02:00
|
|
|
}
|
2016-07-22 13:27:52 +02:00
|
|
|
|
|
|
|
module.exports = Point;
|