Rename some properties for uniformity

This commit is contained in:
barsdeveloper
2025-01-25 16:12:44 +02:00
parent 41988b1599
commit b4fdb99819
7 changed files with 108 additions and 98 deletions

View File

@@ -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`
}