mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
64 lines
1.2 KiB
JavaScript
Executable File
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
|
|
}
|
|
}
|