summaryrefslogtreecommitdiff
path: root/client/js/models/point.js
blob: 70b496159d06904255e0bae7934c893387c527a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"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;