aboutsummaryrefslogtreecommitdiff
path: root/client/js/models/point.js
blob: bbb05ecb840e6c516d4cdbd4f12e4c1b4e361796 (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
'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;

© 2015 - 2026 Jakob L. Kreuze