From 0bb9282eddff4a00dc299e1aa68412d7a0c29339 Mon Sep 17 00:00:00 2001 From: Matysh Date: Wed, 29 Jul 2026 13:47:20 +0300 Subject: [PATCH] room settings button: half size, dead-centred on the room MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Owner's follow-up: the button was too large — height is now 0.77 of the icon-size unit (half the previous), width follows through the derived font and padding. The below-centre offset is gone: the anchor is the room's geometric centre on BOTH axes, verified against the polygon centroids in vb coordinates (exact match on all four demo rooms). Still zooms with the plan. smoke_feedback_v2's gear assertions pinned the 2026-07-27 feedback sizes (font >= 10px, box >= 18x40) — superseded by the owner's half-size order; the contract is now 'sized from the device icon, clickable, opens the dialog'. --- demo/smoke_feedback_v2.mjs | 7 +++++-- demo/srv/assets/houseplan-card.js | 8 +++----- dist/houseplan-card.js | 8 +++----- src/styles.ts | 8 +++----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/demo/smoke_feedback_v2.mjs b/demo/smoke_feedback_v2.mjs index 8acd62b..abc89a6 100644 --- a/demo/smoke_feedback_v2.mjs +++ b/demo/smoke_feedback_v2.mjs @@ -9,10 +9,13 @@ const res = await page.evaluate(async () => { const btn = sr().querySelector('.rlgearbtn'); out.gearButtonShown = !!btn; const cs = btn ? getComputedStyle(btn) : null; - out.gearReadable = cs ? parseFloat(cs.fontSize) >= 10 && cs.pointerEvents === 'auto' : null; + // 2026-07-29: владелец вдвое уменьшил кнопку — контракт теперь не «не + // меньше N px», а «размер от иконки устройства и кликабельность» + out.gearReadable = cs ? parseFloat(cs.fontSize) > 0 && cs.pointerEvents === 'auto' : null; out.gearHasLabel = btn ? btn.textContent.trim().length > 0 : null; const box = btn?.getBoundingClientRect(); - out.gearTapTarget = box ? box.height >= 18 && box.width >= 40 : null; + // (в редакторе плана .dev скрыты display:none — сравнивать не с чем) + out.gearTapTarget = box ? box.height > 6 && box.height < 40 : null; btn.dispatchEvent(new MouseEvent('click', { bubbles: true, composed: true })); await c.updateComplete; out.gearOpensDialog = c._roomDialog === true && !!c._roomEditId; diff --git a/demo/srv/assets/houseplan-card.js b/demo/srv/assets/houseplan-card.js index d7c6c78..4967f3a 100755 --- a/demo/srv/assets/houseplan-card.js +++ b/demo/srv/assets/houseplan-card.js @@ -410,12 +410,10 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow already rescales with the view, so the button zooms WITH the plan instead of keeping a constant screen size (owner's spec). */ .rlgearbtn { - --gear-h: calc(var(--icon-size, 2.5cqw) * 0.7 * 2.2); /* 70% of the icon BOX (icon + padding) */ + --gear-h: calc(var(--icon-size, 2.5cqw) * 0.77); /* owner: half the previous size */ position: absolute; - /* anchored to the room centre, sitting one button-height below it: the - room NAME defaults to the same centre, and dead-centred the button - covered it. The offset is in button units, so it zooms along. */ - transform: translate(-50%, calc(-50% + var(--gear-h) * 0.95)); + /* dead-centred on the room, both axes (owner's spec) */ + transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 0.35em; diff --git a/dist/houseplan-card.js b/dist/houseplan-card.js index d7c6c78..4967f3a 100755 --- a/dist/houseplan-card.js +++ b/dist/houseplan-card.js @@ -410,12 +410,10 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow already rescales with the view, so the button zooms WITH the plan instead of keeping a constant screen size (owner's spec). */ .rlgearbtn { - --gear-h: calc(var(--icon-size, 2.5cqw) * 0.7 * 2.2); /* 70% of the icon BOX (icon + padding) */ + --gear-h: calc(var(--icon-size, 2.5cqw) * 0.77); /* owner: half the previous size */ position: absolute; - /* anchored to the room centre, sitting one button-height below it: the - room NAME defaults to the same centre, and dead-centred the button - covered it. The offset is in button units, so it zooms along. */ - transform: translate(-50%, calc(-50% + var(--gear-h) * 0.95)); + /* dead-centred on the room, both axes (owner's spec) */ + transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 0.35em; diff --git a/src/styles.ts b/src/styles.ts index f9581a2..0e1747e 100644 --- a/src/styles.ts +++ b/src/styles.ts @@ -407,12 +407,10 @@ export const cardStyles = css` already rescales with the view, so the button zooms WITH the plan instead of keeping a constant screen size (owner's spec). */ .rlgearbtn { - --gear-h: calc(var(--icon-size, 2.5cqw) * 0.7 * 2.2); /* 70% of the icon BOX (icon + padding) */ + --gear-h: calc(var(--icon-size, 2.5cqw) * 0.77); /* owner: half the previous size */ position: absolute; - /* anchored to the room centre, sitting one button-height below it: the - room NAME defaults to the same centre, and dead-centred the button - covered it. The offset is in button units, so it zooms along. */ - transform: translate(-50%, calc(-50% + var(--gear-h) * 0.95)); + /* dead-centred on the room, both axes (owner's spec) */ + transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 0.35em;