mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-25 00:38:18 +08:00
Simplify positioned style computation
This commit is contained in:
@@ -14,19 +14,19 @@ export default class IFromToPositionedElement extends IElement {
|
||||
|
||||
static properties = {
|
||||
...super.properties,
|
||||
initialPositionX: {
|
||||
fromX: {
|
||||
type: Number,
|
||||
attribute: false,
|
||||
},
|
||||
initialPositionY: {
|
||||
fromY: {
|
||||
type: Number,
|
||||
attribute: false,
|
||||
},
|
||||
finaPositionX: {
|
||||
toX: {
|
||||
type: Number,
|
||||
attribute: false,
|
||||
},
|
||||
finaPositionY: {
|
||||
toY: {
|
||||
type: Number,
|
||||
attribute: false,
|
||||
},
|
||||
@@ -35,29 +35,29 @@ export default class IFromToPositionedElement extends IElement {
|
||||
constructor(...args) {
|
||||
// @ts-expect-error
|
||||
super(...args)
|
||||
this.initialPositionX = 0
|
||||
this.initialPositionY = 0
|
||||
this.finaPositionX = 0
|
||||
this.finaPositionY = 0
|
||||
this.fromX = 0
|
||||
this.fromY = 0
|
||||
this.toX = 0
|
||||
this.toY = 0
|
||||
}
|
||||
|
||||
/** @param {Number[]} param0 */
|
||||
setBothLocations([x, y]) {
|
||||
this.initialPositionX = x
|
||||
this.initialPositionY = y
|
||||
this.finaPositionX = x
|
||||
this.finaPositionY = y
|
||||
this.fromX = x
|
||||
this.fromY = y
|
||||
this.toX = x
|
||||
this.toY = y
|
||||
}
|
||||
|
||||
/** @param {Number[]} offset */
|
||||
addSourceLocation([offsetX, offsetY]) {
|
||||
this.initialPositionX += offsetX
|
||||
this.initialPositionY += offsetY
|
||||
this.fromX += offsetX
|
||||
this.fromY += offsetY
|
||||
}
|
||||
|
||||
/** @param {Number[]} offset */
|
||||
addDestinationLocation([offsetX, offsetY]) {
|
||||
this.finaPositionX += offsetX
|
||||
this.finaPositionY += offsetY
|
||||
this.toX += offsetX
|
||||
this.toY += offsetY
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user