From cac972eafff8a5c93b159acd3a80aa9ec508ab85 Mon Sep 17 00:00:00 2001 From: Orion Reed Date: Sun, 15 Dec 2024 07:49:02 -0500 Subject: [PATCH] dont update rect if autosize --- src/folk-shape.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/folk-shape.ts b/src/folk-shape.ts index d936f61..2936af9 100644 --- a/src/folk-shape.ts +++ b/src/folk-shape.ts @@ -493,8 +493,19 @@ export class FolkShape extends HTMLElement { } this.style.transform = emmittedRect.toCssString(); - this.style.width = this.#attrWidth === 'auto' ? '' : `${emmittedRect.width}px`; - this.style.height = this.#attrHeight === 'auto' ? '' : `${emmittedRect.height}px`; + if (this.#attrWidth !== 'auto') { + this.style.width = `${emmittedRect.width}px`; + } else { + this.style.width = ''; + emmittedRect.width = this.#previousRect.width; + } + + if (this.#attrHeight !== 'auto') { + this.style.height = `${emmittedRect.height}px`; + } else { + this.style.height = ''; + emmittedRect.height = this.#previousRect.height; + } this.#readonlyRect = new DOMRectTransformReadonly(emmittedRect); }