Files
ueblueprint/js/element/IFromToPositionedElement.js
barsdeveloper 365732a99c WIP
2024-12-03 22:15:17 +02:00

64 lines
1.2 KiB
JavaScript
Executable File

import IElement from "./IElement.js"
/**
* @template {IEntity} EntityT
* @template {ITemplate} TemplateT
* @extends {IElement<EntityT, TemplateT>}
*/
export default class IFromToPositionedElement extends IElement {
static properties = {
...super.properties,
fromX: {
type: Number,
attribute: false,
},
fromY: {
type: Number,
attribute: false,
},
toX: {
type: Number,
attribute: false,
},
toY: {
type: Number,
attribute: false,
},
}
constructor() {
super()
this.fromX = 0
this.fromY = 0
this.toX = 0
this.toY = 0
}
/** @param {Coordinates} param0 */
setBothLocations([x, y]) {
this.fromX = x
this.fromY = y
this.toX = x
this.toY = y
}
/**
* @param {Number} x
* @param {Number} y
*/
addSourceLocation(x, y) {
this.fromX += x
this.fromY += y
}
/**
* @param {Number} x
* @param {Number} y
*/
addDestinationLocation(x, y) {
this.toX += x
this.toY += y
}
}