mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-27 18:54:44 +08:00
Rename some properties for uniformity
This commit is contained in:
@@ -9,23 +9,23 @@ export default class IFromToPositionedTemplate extends ITemplate {
|
||||
/** @param {PropertyValues} changedProperties */
|
||||
update(changedProperties) {
|
||||
super.update(changedProperties)
|
||||
const [fromX, fromY, toX, toY] = [
|
||||
Math.round(this.element.fromX),
|
||||
Math.round(this.element.fromY),
|
||||
Math.round(this.element.toX),
|
||||
Math.round(this.element.toY),
|
||||
const [originX, originY, targetX, targetY] = [
|
||||
Math.round(this.element.originX),
|
||||
Math.round(this.element.originY),
|
||||
Math.round(this.element.targetX),
|
||||
Math.round(this.element.targetY),
|
||||
]
|
||||
const [left, top, width, height] = [
|
||||
Math.min(fromX, toX),
|
||||
Math.min(fromY, toY),
|
||||
Math.abs(fromX - toX),
|
||||
Math.abs(fromY - toY),
|
||||
Math.min(originX, targetX),
|
||||
Math.min(originY, targetY),
|
||||
Math.abs(originX - targetX),
|
||||
Math.abs(originY - targetY),
|
||||
]
|
||||
if (changedProperties.has("fromX") || changedProperties.has("toX")) {
|
||||
if (changedProperties.has("originX") || changedProperties.has("targetX")) {
|
||||
this.element.style.left = `${left}px`
|
||||
this.element.style.width = `${width}px`
|
||||
}
|
||||
if (changedProperties.has("fromY") || changedProperties.has("toY")) {
|
||||
if (changedProperties.has("originY") || changedProperties.has("targetY")) {
|
||||
this.element.style.top = `${top}px`
|
||||
this.element.style.height = `${height}px`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user