feat: release Symcon 0.2.2 with object tree selection and hook recovery
This commit is contained in:
1 parent
4a875aa8ea
commit
eff9eb83d7
19 files changed
+2273
-1064
No files matched your search
@@ -3278,7 +3278,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
inset: auto 16px 16px;
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",li);function se(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function ai(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function gm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ee(r,e)}var Mu;function $u(){let r=new URL("./nextfloor-editor.js?v=85ae4159b3e8",new URL(import.meta.url)).href;return Mu??=import(r),Mu}var _m=.25,Au=r=>Math.round(r*1e3)/1e3,Eu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function ci(r,e,t,n,o){let i=Eu(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function bm(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(oe(Z(i,t),n))<.02&&Math.abs(oe(Z(a,t),n))<.02}))}var ui=(r,e)=>Math.abs((r-e+540)%360-180);function zu(r,e,t,n=_m){let o=Eu(r,e.x,e.z);if(!o)return null;let i=o.points,s=et(i)>=0?1:-1,a=null;return i.forEach((l,u)=>{let c=i[(u+1)%i.length],d=Te(Z(c,l));if(d<.3)return;let p=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-p[1]*s,p[0]*s],w=oe(Z([e.x,e.z],l),p);if(w<0||w>d)return;let b=bm(r,o,l,h)?t/2:0,g=oe(Z([e.x,e.z],l),h)-b,_=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:_,extent:e.d/2},{rotation:_+90,extent:e.w/2},{rotation:_-90,extent:e.w/2}].reduce((y,F)=>ui(e.rotation,F.rotation)<ui(e.rotation,y.rotation)?F:y);if(ui(e.rotation,$.rotation)>50)return;let x=g-$.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:Au(e.x-h[0]*x),z:Au(e.z-h[1]*x),rotation:(Math.round($.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Er(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function zr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Ru(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Tu(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Fu(r,e,t,n){return zr(r,e,(o,i)=>{[o.x,o.z]=ci(i,o.x,o.z,t,n)})}function Du(r,e,t,n){let o=r.settings.wall_interior??.12;return Er(r,e,(i,s)=>{[i.x,i.z]=ci(s,i.x,i.z,t,n);let a=zu(s,i,o);a&&Object.assign(i,a)})}var di=(r,e)=>((r+e)%360+360)%360,Pu=r=>Number.parseFloat(r.replace(",",".")),wn=(r,e)=>Math.round(r*10**e)/10**e;function hi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Pu(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",li);function se(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function ai(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function gm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ee(r,e)}var Mu;function $u(){let r=new URL("./nextfloor-editor.js?v=37bfd8f9f2b7",new URL(import.meta.url)).href;return Mu??=import(r),Mu}var _m=.25,Au=r=>Math.round(r*1e3)/1e3,Eu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function ci(r,e,t,n,o){let i=Eu(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function bm(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(oe(Z(i,t),n))<.02&&Math.abs(oe(Z(a,t),n))<.02}))}var ui=(r,e)=>Math.abs((r-e+540)%360-180);function zu(r,e,t,n=_m){let o=Eu(r,e.x,e.z);if(!o)return null;let i=o.points,s=et(i)>=0?1:-1,a=null;return i.forEach((l,u)=>{let c=i[(u+1)%i.length],d=Te(Z(c,l));if(d<.3)return;let p=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-p[1]*s,p[0]*s],w=oe(Z([e.x,e.z],l),p);if(w<0||w>d)return;let b=bm(r,o,l,h)?t/2:0,g=oe(Z([e.x,e.z],l),h)-b,_=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:_,extent:e.d/2},{rotation:_+90,extent:e.w/2},{rotation:_-90,extent:e.w/2}].reduce((y,F)=>ui(e.rotation,F.rotation)<ui(e.rotation,y.rotation)?F:y);if(ui(e.rotation,$.rotation)>50)return;let x=g-$.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:Au(e.x-h[0]*x),z:Au(e.z-h[1]*x),rotation:(Math.round($.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Er(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function zr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Ru(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Tu(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Fu(r,e,t,n){return zr(r,e,(o,i)=>{[o.x,o.z]=ci(i,o.x,o.z,t,n)})}function Du(r,e,t,n){let o=r.settings.wall_interior??.12;return Er(r,e,(i,s)=>{[i.x,i.z]=ci(s,i.x,i.z,t,n);let a=zu(s,i,o);a&&Object.assign(i,a)})}var di=(r,e)=>((r+e)%360+360)%360,Pu=r=>Number.parseFloat(r.replace(",",".")),wn=(r,e)=>Math.round(r*10**e)/10**e;function hi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Pu(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
|
||||
>${r.label}
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(wn(r.value,2))} @change=${o} />
|
||||
</label>`}var Iu=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Hu=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function wm(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let o=(s,a)=>hi({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,u=>u[s]=wn(l,3))}),i=hs(n)?m`${hi({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??le(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=wn(s,3))})}
|
||||
|
||||
Reference in new issue
Block a user