mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 08:28:31 +00:00
fix v1.36.3: door sectors no longer punch dark wedges inside the room
- room outline + sectors as separate clipPath children (always union) instead of subpaths of one nonzero path where opposite windings cancelled the overlap; smoke asserts one contour per path - TESTING/CHANGELOG same-commit
This commit is contained in:
Vendored
+3
-3
@@ -1448,14 +1448,14 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
||||
<input type="range" min="0" max="100" .value=${String(Math.round(100*i.a))}
|
||||
@input=${e=>this._setFillColor(t,{a:Number(e.target.value)/100})} />
|
||||
<span class="opv">${Math.round(100*i.a)}%</span>
|
||||
</div>`}get _glowRadiusCm(){const t=Number(this._settings.glow_radius_cm);return Number.isFinite(t)&&t>0?t:300}get _imperial(){return"mi"===this.hass?.config?.unit_system?.length}get _glowRadiusPlaceholder(){const t=this._glowRadiusCm;return this._imperial?String(Math.round(t/30.48*10)/10):String(t/100)}_renderGlowLayer(t){const e=this._fillColors,i=this._glowRadiusCm/this._cellCm*this._gridPitch,s=this._gridPitch,o=t.rooms.map(t=>({r:t,poly:we(t)})).filter(t=>!!t.poly),n=this._openingsR.filter(t=>"door"===t.type),r=[];for(const a of this._devices){if(a.space!==t.id)continue;const l=a.entities.find(t=>t.startsWith("light.")&&"on"===this.hass.states[t]?.state);if(!l)continue;const c=ei(this.hass.states[l],e.glow_light.c);if(!c)continue;const h=Number(a.marker?.glow_radius_cm),p=Number.isFinite(h)&&h>0?h/this._cellCm*this._gridPitch:i,d=this._pos(a),u=[...o].reverse().find(t=>this._pointInRoom([d.x,d.y],t.r));let _=null;if(u){const t=["M "+u.poly.map(t=>t[0]+" "+t[1]).join(" L ")+" Z"];for(const e of n){const i=Me([e.rx,e.ry],u.poly);if(!i||Math.hypot(i[0]-e.rx,i[1]-e.ry)>.75*s)continue;const n=e.angle*Math.PI/180,r=Math.cos(n)*e.rlen/2,a=Math.sin(n)*e.rlen/2,l=o.filter(t=>t!==u).map(t=>t.poly);if(!si([e.rx,e.ry],e.angle,[d.x,d.y],l,.6*s))continue;const c=ii([d.x,d.y],[e.rx-r,e.ry-a],[e.rx+r,e.ry+a],p);c&&t.push("M "+c.map(t=>t[0]+" "+t[1]).join(" L ")+" Z")}_=t.join(" ")}r.push({pos:d,c:c.c,alpha:e.glow_light.a*c.bri,clip:_,r:p})}return r.length?j`<defs>
|
||||
</div>`}get _glowRadiusCm(){const t=Number(this._settings.glow_radius_cm);return Number.isFinite(t)&&t>0?t:300}get _imperial(){return"mi"===this.hass?.config?.unit_system?.length}get _glowRadiusPlaceholder(){const t=this._glowRadiusCm;return this._imperial?String(Math.round(t/30.48*10)/10):String(t/100)}_renderGlowLayer(t){const e=this._fillColors,i=this._glowRadiusCm/this._cellCm*this._gridPitch,s=this._gridPitch,o=t.rooms.map(t=>({r:t,poly:we(t)})).filter(t=>!!t.poly),n=this._openingsR.filter(t=>"door"===t.type),r=[];for(const a of this._devices){if(a.space!==t.id)continue;const l=a.entities.find(t=>t.startsWith("light.")&&"on"===this.hass.states[t]?.state);if(!l)continue;const c=ei(this.hass.states[l],e.glow_light.c);if(!c)continue;const h=Number(a.marker?.glow_radius_cm),p=Number.isFinite(h)&&h>0?h/this._cellCm*this._gridPitch:i,d=this._pos(a),u=[...o].reverse().find(t=>this._pointInRoom([d.x,d.y],t.r));let _=null;if(u){const t=["M "+u.poly.map(t=>t[0]+" "+t[1]).join(" L ")+" Z"];for(const e of n){const i=Me([e.rx,e.ry],u.poly);if(!i||Math.hypot(i[0]-e.rx,i[1]-e.ry)>.75*s)continue;const n=e.angle*Math.PI/180,r=Math.cos(n)*e.rlen/2,a=Math.sin(n)*e.rlen/2,l=o.filter(t=>t!==u).map(t=>t.poly);if(!si([e.rx,e.ry],e.angle,[d.x,d.y],l,.6*s))continue;const c=ii([d.x,d.y],[e.rx-r,e.ry-a],[e.rx+r,e.ry+a],p);c&&t.push("M "+c.map(t=>t[0]+" "+t[1]).join(" L ")+" Z")}_=t}r.push({pos:d,c:c.c,alpha:e.glow_light.a*c.bri,clip:_,r:p})}return r.length?j`<defs>
|
||||
${r.map((t,e)=>j`
|
||||
<radialGradient id="hp-glow-${e}">
|
||||
<stop offset="0%" stop-color="${t.c}" stop-opacity="${t.alpha.toFixed(3)}"></stop>
|
||||
<stop offset="55%" stop-color="${t.c}" stop-opacity="${(.45*t.alpha).toFixed(3)}"></stop>
|
||||
<stop offset="100%" stop-color="${t.c}" stop-opacity="0"></stop>
|
||||
</radialGradient>
|
||||
${t.clip?j`<clipPath id="hp-glowclip-${e}"><path d="${t.clip}"></path></clipPath>`:W}`)}
|
||||
${t.clip?j`<clipPath id="hp-glowclip-${e}">${t.clip.map(t=>j`<path d="${t}"></path>`)}</clipPath>`:W}`)}
|
||||
</defs>
|
||||
<g class="glowlayer">
|
||||
${r.map((t,e)=>j`<circle cx="${t.pos.x}" cy="${t.pos.y}" r="${t.r}"
|
||||
@@ -2195,4 +2195,4 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>`}}ji.properties={hass:{attribute:!1},_config:{state:!0},_space:{state:!0},_layout:{state:!0},_devices:{state:!0},_tip:{state:!0},_selId:{state:!0},_toast:{state:!0},_serverCfg:{state:!0},_mode:{state:!0},_tool:{state:!0},_path:{state:!0},_cursorPt:{state:!0},_mergeSel:{state:!0},_openingDialog:{state:!0},_openingInfo:{state:!0},_mergeDialog:{state:!0},_splitSel:{state:!0},_decorTool:{state:!0},_decorStyle:{state:!0},_decorDraft:{state:!0},_decorSel:{state:!0},_decorTextDialog:{state:!0},_areaSel:{state:!0},_nameSel:{state:!0},_roomDialog:{state:!0},_spaceDialog:{state:!0},_infoCard:{state:!0},_rulesDialog:{state:!0},_settingsDialog:{state:!0},_importDialog:{state:!0},_markerDialog:{state:!0},_zoom:{state:!0},_view:{state:!0}},ji.styles=$i,customElements.get("houseplan-card")||customElements.define("houseplan-card",ji),window.customCards=window.customCards||[],window.customCards.find(t=>"houseplan-card"===t.type)||window.customCards.push({type:"houseplan-card",name:"House Plan Card",description:"Interactive house plan: spaces, rooms and devices with live states and drag layout."}),console.info("%c HOUSEPLAN-CARD %c v1.36.2 ","background:#3ea6ff;color:#04121f;font-weight:700","");
|
||||
</div>`}}ji.properties={hass:{attribute:!1},_config:{state:!0},_space:{state:!0},_layout:{state:!0},_devices:{state:!0},_tip:{state:!0},_selId:{state:!0},_toast:{state:!0},_serverCfg:{state:!0},_mode:{state:!0},_tool:{state:!0},_path:{state:!0},_cursorPt:{state:!0},_mergeSel:{state:!0},_openingDialog:{state:!0},_openingInfo:{state:!0},_mergeDialog:{state:!0},_splitSel:{state:!0},_decorTool:{state:!0},_decorStyle:{state:!0},_decorDraft:{state:!0},_decorSel:{state:!0},_decorTextDialog:{state:!0},_areaSel:{state:!0},_nameSel:{state:!0},_roomDialog:{state:!0},_spaceDialog:{state:!0},_infoCard:{state:!0},_rulesDialog:{state:!0},_settingsDialog:{state:!0},_importDialog:{state:!0},_markerDialog:{state:!0},_zoom:{state:!0},_view:{state:!0}},ji.styles=$i,customElements.get("houseplan-card")||customElements.define("houseplan-card",ji),window.customCards=window.customCards||[],window.customCards.find(t=>"houseplan-card"===t.type)||window.customCards.push({type:"houseplan-card",name:"House Plan Card",description:"Interactive house plan: spaces, rooms and devices with live states and drag layout."}),console.info("%c HOUSEPLAN-CARD %c v1.36.3 ","background:#3ea6ff;color:#04121f;font-weight:700","");
|
||||
|
||||
Reference in New Issue
Block a user