Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

resizer was looking at height instead of width. Fixes bug but more improvements needed. (#1369)

DonWillemscc894bdb234f
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index 43bf429e6..1a1547d45 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -387,7 +387,7 @@ export class OrAttributeCard extends LitElement {
this.updateComplete.then(() => {
this.resizeObserver = new ResizeObserver(debounce((entries: ResizeObserverEntry[]) => {
- const elemSize = entries[0].devicePixelContentBoxSize[0].blockSize;
+ const elemSize = entries[0].devicePixelContentBoxSize[0].inlineSize;
this.setLabelSizeByWidth(elemSize);
}, 200))
this.resizeObserver.observe(this.shadowRoot!.querySelector(".graph-wrapper")!);
@@ -842,10 +842,10 @@ export class OrAttributeCard extends LitElement {
if (value.length < 5) { this.mainValueSize = "xl" }
}
- protected setLabelSizeByWidth(blockSize: number) {
- if(blockSize < 60) { this.mainValueSize = "s"; }
- else if(blockSize < 100) { this.mainValueSize = "m"; }
- else if(blockSize < 200) { this.mainValueSize = "l"; }
+ protected setLabelSizeByWidth(inlineSize: number) {
+ if(inlineSize < 60) { this.mainValueSize = "s"; }
+ else if(inlineSize < 100) { this.mainValueSize = "m"; }
+ else if(inlineSize < 200) { this.mainValueSize = "l"; }
else { this.mainValueSize = "xl"; }
}