import Vector2 from "../../../geom/Vector2.js";

export class PortVisualData {
    id = 0;

    /**
     *
     * @type {Vector2}
     */
    position = new Vector2();

    /**
     *
     * @param {PortVisualData} other
     */
    copy(other) {
        this.id = other.id;

        this.position.copy(other.position);
    }

    /**
     *
     * @return {PortVisualData}
     */
    clone() {
        const r = new PortVisualData();

        r.copy(this);

        return r;
    }

    toJSON() {
        return {
            id: this.id,
            position: this.position.toJSON()
        };
    }

    fromJSON(json) {
        this.id = json.id;
        this.position.fromJSON(json.position);
    }
}
