@expofp/floorplan 3.44.5 → 3.44.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/browser/{Button-KOcUyCV4.js → Button-RBFYQ_Hi.js} +5 -5
  2. package/dist/browser/{CookieConsent-Dxa0id06.js → CookieConsent-DYvHugt5.js} +7 -7
  3. package/dist/browser/{Debug-QyhDw-Qr.js → Debug-Dwdforl1.js} +7 -7
  4. package/dist/browser/{DebugTools-D2W2n6Jn.js → DebugTools-zmeDHNGo.js} +6 -6
  5. package/dist/browser/{Demo-B13KXifC.js → Demo-BS9Anmla.js} +9 -9
  6. package/dist/browser/{Free-CX_vMtxZ.js → Free-Js3r8S0A.js} +10 -10
  7. package/dist/browser/{GalleryContainer-CM3-49P7.js → GalleryContainer-BAlmaG0f.js} +11 -11
  8. package/dist/browser/{GpsLoader-4PVGhL1U.js → GpsLoader-CPVQbvzp.js} +13 -13
  9. package/dist/browser/{KioskStore-DTQoQI0q.js → KioskStore-Bq5T3Ffz.js} +9 -9
  10. package/dist/browser/{LayerStore-CazBur3e.js → LayerStore-DCQ96IE-.js} +16 -16
  11. package/dist/browser/{MaplibreAdapter-Zingiqz4.js → MaplibreAdapter-DhVJu6nu.js} +17 -17
  12. package/dist/browser/{ModalContainer-CdFZHz2f.js → ModalContainer-D6K2b0AJ.js} +10 -10
  13. package/dist/browser/{PermissionNotice-t6cUGYwh.js → PermissionNotice-DfjCPzFB.js} +6 -6
  14. package/dist/browser/{RouteStore-j54ZGAfi.js → RouteStore-BZ4yT6y-.js} +9 -9
  15. package/dist/browser/{SetKioskMode-B6wYtN7b.js → SetKioskMode-CrOh6y0s.js} +11 -11
  16. package/dist/browser/{ShowKiosk-B5wMyYJL.js → ShowKiosk-D1ClaHDA.js} +10 -10
  17. package/dist/browser/{UIState-DDYKhzgf.js → UIState-ByyaMrdX.js} +13 -13
  18. package/dist/browser/{ViewerMenuPanel-BCVS4-Y6.js → ViewerMenuPanel-DakCumIN.js} +10 -10
  19. package/dist/browser/{add-debug-secret-listener-Dhq4xAyx.js → add-debug-secret-listener-CTKH_oRH.js} +1 -1
  20. package/dist/browser/{adopt-global-settings-DIBm6FQS.js → adopt-global-settings-D9sTS_JW.js} +9 -9
  21. package/dist/browser/{boolean-editor-Y-xsiI--.js → boolean-editor-BwIw17rF.js} +9 -9
  22. package/dist/browser/{bootIntercom-Cioan8sb.js → bootIntercom-CdKoKFoh.js} +2 -2
  23. package/dist/browser/bundle.json +85 -85
  24. package/dist/browser/{camera-events-BOdD_NLx.js → camera-events-sB__cd6I.js} +1 -1
  25. package/dist/browser/{classnames-CK71vh8q.js → classnames-CYKN3c87.js} +2 -2
  26. package/dist/browser/{client-CJPzVCkl.js → client-DrQUHXfL.js} +5 -5
  27. package/dist/browser/{components-F21BHxXy.js → components-B5r0X7hw.js} +48 -48
  28. package/dist/browser/{create-live-plan-nrSyFkZI.js → create-live-plan-B5ooow2K.js} +13 -13
  29. package/dist/browser/{debug-context-DwpqAozh.js → debug-context-J8d6t8eB.js} +5 -5
  30. package/dist/browser/{debug-overlay-B6KaSOEU.js → debug-overlay-C2Jgoq6G.js} +10 -10
  31. package/dist/browser/{debug-ui-Bf8fXQOS.js → debug-ui-DPXawVu_.js} +6 -6
  32. package/dist/browser/{dimming-BHvWqTG-.js → dimming-BxZDtzpk.js} +282 -234
  33. package/dist/browser/{dist-39qZTE_8.js → dist-97S2bhkn.js} +5 -5
  34. package/dist/browser/{dist-C4gjCWf-.js → dist-Bbn7DzPA.js} +6 -6
  35. package/dist/browser/{dist-e4oHl02a.js → dist-DMogs9qh.js} +3 -3
  36. package/dist/browser/{efp-debug-init-CgA5CA8v.js → efp-debug-init-D_04kt78.js} +3 -3
  37. package/dist/browser/{enum-editor-Clbji3s0.js → enum-editor-BAL-m2C_.js} +4 -4
  38. package/dist/browser/{es5-DS8lovDx.js → es5-CrpYYfSz.js} +2 -2
  39. package/dist/browser/{event-head-CvwSi2rY.js → event-head-qa_rZoTR.js} +1 -1
  40. package/dist/browser/{event-not-found-CCc_S9hI.js → event-not-found-9sjy2LtU.js} +3 -3
  41. package/dist/browser/{event-scoped-cache-kTMeUrly.js → event-scoped-cache-BHo01Y40.js} +2 -2
  42. package/dist/browser/{expofpUrl-CHp0e8cE.js → expofpUrl-zbpM1nSq.js} +1 -1
  43. package/dist/browser/{exports-J1MI3kf7.js → exports-DlkhL3Gn.js} +1 -1
  44. package/dist/browser/{favicon-CcNmTUw4.js → favicon-MiQiTRAG.js} +1 -1
  45. package/dist/browser/{fetch-retry.umd-BgUlFCap.js → fetch-retry.umd-BqYOzYBV.js} +2 -2
  46. package/dist/browser/{flex-vWrExjXE.js → flex-u4ly_-5z.js} +5 -5
  47. package/dist/browser/{floorplan.loader-CUEvFUdv.js → floorplan.loader-CC9R8Z2W.js} +12 -12
  48. package/dist/browser/{floorplan.ready-ko8a3n9B.js → floorplan.ready-WeInPpd9.js} +23 -23
  49. package/dist/browser/{freeBanner-DpKvZQN1.js → freeBanner-C4Bvu0Zb.js} +2 -2
  50. package/dist/browser/{fuse-Bfm1APV7.js → fuse-G-0speZ8.js} +2 -2
  51. package/dist/browser/{i18n-DDJS5YMr.js → i18n-BnNMXZMY.js} +6 -6
  52. package/dist/browser/index.js +17 -17
  53. package/dist/browser/{index.module-DsUsijj6.js → index.module-BSaN-b6b.js} +4 -4
  54. package/dist/browser/{init-ui-Bm0UPhlY.js → init-ui-DzAjXF5g.js} +9 -9
  55. package/dist/browser/{integrateKiosk-B3aJf8F4.js → integrateKiosk-BVDvw6FM.js} +5 -5
  56. package/dist/browser/{is-debug-De3PeMDZ.js → is-debug-D9QhFSGQ.js} +4 -4
  57. package/dist/browser/{is-own-domain-B9xN9-Lx.js → is-own-domain-yTnvm9Le.js} +1 -1
  58. package/dist/browser/{is-webview-yWWEgPgd.js → is-webview-BqECy8-R.js} +1 -1
  59. package/dist/browser/{jsx-runtime-DjD5sUU-.js → jsx-runtime-BSXeXEHO.js} +2 -2
  60. package/dist/browser/{kiosk-mode-CDwaDIbF.js → kiosk-mode-DWfwx4t2.js} +3 -3
  61. package/dist/browser/{kiosk-record-DMkGRlUE.js → kiosk-record-BOMPoHaT.js} +1 -1
  62. package/dist/browser/{kioskApi-CQSBvl3I.js → kioskApi-BDv0w-PS.js} +7 -7
  63. package/dist/browser/{lib-CJ3OJE3_.js → lib-B1qP6Z0C.js} +3 -3
  64. package/dist/browser/{loadImage-D8uFT5Sk.js → loadImage-DPQiw0WY.js} +1 -1
  65. package/dist/browser/{logDeviceInfo-CmWBec7t.js → logDeviceInfo-1M7WZnu3.js} +9 -9
  66. package/dist/browser/{mobx-BdBndn_p.js → mobx-ClZZNnUh.js} +4 -4
  67. package/dist/browser/{mobx.module-C3w0PP29.js → mobx.module-6oYVXmmv.js} +1 -1
  68. package/dist/browser/{optional-boolean-editor-Blvo9Yix.js → optional-boolean-editor-Cc0C_hZa.js} +3 -3
  69. package/dist/browser/{optional-enum-editor-DU7T8uz0.js → optional-enum-editor-V4cHa53F.js} +4 -4
  70. package/dist/browser/{optional-string-editor-xZMbxEZE.js → optional-string-editor-DRRoeLbD.js} +4 -4
  71. package/dist/browser/{particles.min-D_8wZYXL.js → particles.min-COe9Gmit.js} +2 -2
  72. package/dist/browser/{react-CV8wM7_O.js → react-Ca00Xeqo.js} +2 -2
  73. package/dist/browser/{react-dom-CecEt-x3.js → react-dom-DDAmTd7-.js} +3 -3
  74. package/dist/browser/{rolldown-runtime-BGNEtxPt.js → rolldown-runtime-DgjedSI7.js} +1 -1
  75. package/dist/browser/{scene-1Y2hzeYv.js → scene-DaAXLmIU.js} +2 -2
  76. package/dist/browser/{scheduler-Di2biGM1.js → scheduler-BGLqZKHW.js} +2 -2
  77. package/dist/browser/{select-CJlj5fYs.js → select-DXkYXR4z.js} +10 -10
  78. package/dist/browser/{settings-1yX1j826.js → settings-CwB0Bji2.js} +2 -2
  79. package/dist/browser/{settings-item-B8pw2_WH.js → settings-item-CT5g44Cs.js} +6 -6
  80. package/dist/browser/{store-DknI2Sdy.js → store-WuygYZ-g.js} +2 -2
  81. package/dist/browser/{string-editor-S6hL0jAM.js → string-editor-BATS-p4e.js} +4 -4
  82. package/dist/browser/{text-field-CgCCjJwX.js → text-field-BDxhPAkK.js} +5 -5
  83. package/dist/browser/{theme-2daWarWB.js → theme-ln4LxgRi.js} +8 -8
  84. package/dist/browser/{ui-CPg_zcyB.js → ui-BDzovVzL.js} +8 -8
  85. package/dist/browser/{useRenderTarget-CTvYMgqG.js → useRenderTarget-BBar7DgD.js} +4 -4
  86. package/dist/browser/{viewport-B_GD-x9K.js → viewport-D2M15h-f.js} +3 -3
  87. package/dist/browser/{wayfinding-B4_JvPpk.js → wayfinding-zYAP3tr2.js} +5 -5
  88. package/dist/esm/components/Map/drawing/config/booth-badge-anchor.d.ts +121 -0
  89. package/dist/esm/components/Map/drawing/config/booth-badge-anchor.js +1 -0
  90. package/dist/esm/components/Map/drawing/config/config-booth-badge.js +1 -1
  91. package/package.json +10 -10
@@ -0,0 +1,121 @@
1
+ import { Box } from '@expofp/geometry';
2
+ import { type RegularBooth } from '../../../../store/BoothStore';
3
+ /** What a badge's anchor search reads off its booth. */
4
+ export type BadgeBooth = Pick<RegularBooth, 'rect' | 'rotate'>;
5
+ /** Where a badge sits in one booth corner, and how large it may grow there. */
6
+ export interface BadgeFit {
7
+ /** The badge's top-left corner on the plan, before rotation. */
8
+ readonly x: number;
9
+ readonly y: number;
10
+ /** The largest scale that keeps the badge inside the booth's footprint. */
11
+ readonly maxScale: number;
12
+ }
13
+ /**
14
+ * The places a booth's badge can sit, one per booth corner, each computed on the first visit to
15
+ * that corner and kept.
16
+ *
17
+ * The plan's roll moves the badge to another booth corner every quarter turn, and every badge on
18
+ * the plan moves in the same frame. Finding a corner's anchor tests the booth's vertices against
19
+ * its own triangles, so it is too slow to repeat for hundreds of badges at once. The result
20
+ * depends only on the corner: the rotation the scale search uses is the booth's own plus the
21
+ * quarter turns to that corner, the same at every visit to it up to whole turns of 2π.
22
+ *
23
+ * The first visit to a corner still searches, for every badge at once, so {@link prefetch} works
24
+ * the other corners out ahead, while the page is idle.
25
+ */
26
+ export declare class BoothBadgeAnchors {
27
+ private readonly booth;
28
+ private readonly triangles;
29
+ private readonly border;
30
+ private readonly source;
31
+ /** The badges with corners still to work out while the page is idle, in the order queued. */
32
+ private static readonly idle;
33
+ private static idleScheduled;
34
+ private readonly fits;
35
+ /** The rotation at corner 0 the idle work counts quarter turns from. */
36
+ private prefetchRotation;
37
+ private readonly polygon;
38
+ private readonly bbox;
39
+ /** The booth's distinct vertices in first-seen order, built on the first search. */
40
+ private vertices;
41
+ /**
42
+ * @param booth - The booth the badge belongs to.
43
+ * @param triangles - The booth's footprint as triangles; empty when it has no paths.
44
+ * @param border - How far the badge stays in from the booth's edge.
45
+ * @param source - The badge's width and height at scale 1.
46
+ */
47
+ constructor(booth: BadgeBooth, triangles: number[][][], border: number, source: {
48
+ readonly x: number;
49
+ readonly y: number;
50
+ });
51
+ /**
52
+ * The badge's place in a booth corner.
53
+ * @param corner - The booth corner, clockwise from top-left (0) to bottom-left (3).
54
+ * @param rotation - The badge's rotation in radians: the booth's own plus the quarter turns that
55
+ * brought the badge to this corner. Read on the first visit only.
56
+ * @returns The anchor and the largest scale, the same object at every visit.
57
+ */
58
+ fit(corner: number, rotation: number): BadgeFit;
59
+ /**
60
+ * Works out the three corners not yet visited while the page is idle, so the first quarter turn
61
+ * into each finds it ready. Queuing again while queued changes nothing.
62
+ * @param rotation - The badge's rotation at corner 0: the booth's own.
63
+ */
64
+ prefetch(rotation: number): void;
65
+ /** Drops the idle work {@link prefetch} queued and has not done yet. */
66
+ cancelPrefetch(): void;
67
+ private static scheduleIdle;
68
+ /**
69
+ * Works out one corner after another while the idle period lasts, for at most a slice, then asks
70
+ * for another.
71
+ * @param deadline - How much of the idle period is left.
72
+ */
73
+ private static runIdle;
74
+ /**
75
+ * Works out the next corner not yet known, at the rotation the quarter turns to it give.
76
+ * @returns Whether a corner is still unknown after this one.
77
+ */
78
+ private prefetchNext;
79
+ private compute;
80
+ /**
81
+ * The largest scale the booth's rect allows. At odd corners the badge's width and height lie
82
+ * along the booth's height and width.
83
+ * @param swapped - Whether the badge's axes are swapped against the booth's.
84
+ * @returns The scale.
85
+ */
86
+ private rectMaxScale;
87
+ /**
88
+ * The booth vertex, moved in by the border, nearest the target corner of the booth's bounding
89
+ * box and still inside the booth. Uses booth.rotate (the booth's true tilt) for the fallback,
90
+ * never the badge's stepped rotation: the booth does not move when the badge steps.
91
+ *
92
+ * The candidates are tested nearest first, so the search stops at the first one inside instead
93
+ * of testing every vertex. Ties keep the vertex seen first, as a full scan would.
94
+ * @param signX - 1 to aim at the left edge, -1 at the right.
95
+ * @param signY - 1 to aim at the top edge, -1 at the bottom.
96
+ * @returns The anchor.
97
+ */
98
+ private findAnchor;
99
+ /**
100
+ * Binary-searches the largest scale, up to the rect's cap, that keeps all badge corners inside
101
+ * the booth's footprint.
102
+ * @param anchorX - The badge's anchor.
103
+ * @param anchorY - The badge's anchor.
104
+ * @param rectMaxScale - The cap the booth's rect allows.
105
+ * @param rotation - The badge's rotation, in radians.
106
+ * @returns The scale; the cap itself when the booth has no footprint or the anchor lies outside.
107
+ */
108
+ private clampScale;
109
+ /**
110
+ * The booth's distinct vertices, in the order the triangles first name them.
111
+ * @returns The vertices, built once.
112
+ */
113
+ private distinctVertices;
114
+ }
115
+ /**
116
+ * The bounding box of a booth's triangles.
117
+ * @param triangles - The triangles, as `[x, y]` vertex triples.
118
+ * @returns The box, or `null` when there are no triangles.
119
+ */
120
+ export declare function trianglesBoundingBox(triangles: number[][][]): Box | null;
121
+ //# sourceMappingURL=booth-badge-anchor.d.ts.map
@@ -0,0 +1 @@
1
+ import{Box as b,pointRotate as x,Polygon as S}from"@expofp/geometry";const R=.5,E=.3,M=10,I=8,P=50;export class BoothBadgeAnchors{static{this.idle=new Set}static{this.idleScheduled=!1}constructor(t,i,e,n){this.booth=t,this.triangles=i,this.border=e,this.source=n,this.fits=[],this.prefetchRotation=0,this.vertices=null,this.polygon=T(i),this.bbox=trianglesBoundingBox(i)}fit(t,i){let e=this.fits[t];return e||(this.fits[t]=e=this.compute(t,i)),e}prefetch(t){BoothBadgeAnchors.idle.has(this)||(this.prefetchRotation=t,BoothBadgeAnchors.idle.add(this),BoothBadgeAnchors.scheduleIdle())}cancelPrefetch(){BoothBadgeAnchors.idle.delete(this)}static scheduleIdle(){BoothBadgeAnchors.idleScheduled||!BoothBadgeAnchors.idle.size||(BoothBadgeAnchors.idleScheduled=!0,typeof requestIdleCallback=="function"?requestIdleCallback(BoothBadgeAnchors.runIdle):setTimeout(()=>BoothBadgeAnchors.runIdle({timeRemaining:()=>I}),P))}static runIdle(t){BoothBadgeAnchors.idleScheduled=!1;const i=performance.now()+I;for(const e of BoothBadgeAnchors.idle){if(t.timeRemaining()<=0||performance.now()>=i)break;e.prefetchNext()||BoothBadgeAnchors.idle.delete(e)}BoothBadgeAnchors.scheduleIdle()}prefetchNext(){for(let t=1;t<4;t++)if(!this.fits[t])return this.fit(t,this.prefetchRotation+t*Math.PI/2),t<3;return!1}compute(t,i){const e=t===0||t===3?1:-1,n=t===0||t===1?1:-1,s=this.findAnchor(e,n),o=this.clampScale(s.x,s.y,this.rectMaxScale(t%2===1),i);return{x:s.x,y:s.y,maxScale:o}}rectMaxScale(t){const i=this.booth.rect.size.width,e=this.booth.rect.size.height,n=t?e:i,s=t?i:e;return Math.min(n>0?n*R/this.source.x:1/0,s>0?s*E/this.source.y:1/0)}findAnchor(t,i){const{booth:e,border:n,bbox:s}=this;if(s){const a=t>0?s.min.x:s.max.x,d=i>0?s.min.y:s.max.y,f=[];for(const[r,l]of this.distinctVertices()){const y=r+n*t,p=l+n*i,m=Math.abs(y-a)+Math.abs(p-d);m<1/0&&f.push({x:y,y:p,score:m,order:f.length})}f.sort((r,l)=>r.score-l.score||r.order-l.order);for(const r of f){const l={x:r.x,y:r.y};if(this.polygon.containsPoint(l))return l}}const o=t>0?e.rect.min.x+n:e.rect.max.x-n,c=i>0?e.rect.min.y+n:e.rect.max.y-n,h=e.rotate??0;return h?x({x:o,y:c},h,e.rect.center):{x:o,y:c}}clampScale(t,i,e,n){const{polygon:s,source:o}=this;if(!this.triangles.length)return e;const c={x:t,y:i};if(!s.containsPoint(c))return e;let h=0,a=e;for(let d=0;d<M;d++){const f=(h+a)/2,r=o.x*f,l=o.y*f;s.containsPoint(x({x:t+r,y:i},n,c))&&s.containsPoint(x({x:t,y:i+l},n,c))&&s.containsPoint(x({x:t+r,y:i+l},n,c))?h=f:a=f}return h}distinctVertices(){if(this.vertices)return this.vertices;const t=new Set,i=[];for(const e of this.triangles)for(const n of e){const s=`${n[0]},${n[1]}`;t.has(s)||(t.add(s),i.push([n[0],n[1]]))}return this.vertices=i}}export function trianglesBoundingBox(u){if(!u.length)return null;let t=1/0,i=1/0,e=-1/0,n=-1/0;for(const s of u)for(const[o,c]of s)o<t&&(t=o),c<i&&(i=c),o>e&&(e=o),c>n&&(n=c);return b.fromMinMax({x:t,y:i},{x:e,y:n})}function T(u){const t=[],i=[];for(const e of u){const n=t.length;t.push({x:e[0][0],y:e[0][1]}),t.push({x:e[1][0],y:e[1][1]}),t.push({x:e[2][0],y:e[2][1]}),i.push([n,n+1,n+2])}return new S(t,i)}
@@ -1 +1 @@
1
- import{Box as q,pointRotate as R,Polygon as J,Rect as v}from"@expofp/geometry";import{update as L}from"@expofp/renderer";import K from"color";import{reaction as P}from"mobx";import{SEPARATOR as G}from"../../../../constants";import U from"../../../../data";import{getTrianglesFromFpPaths as Y}from"../../../../data/svg";import{createShapeDef as tt,createTextDef as et,createTextDefLines as nt}from"../../../../engine/defs";import{loadCustomFontsUrls as ot}from"../../../../engine/fonts";import{getQuarterTurns as rt,getRollValue as st}from"../../../../engine/update-def";import{boothStore as it,uiState as N}from"../../../../store";import{RegularBooth as ct}from"../../../../store/BoothStore";import k from"../../../../tools/settings";import{getContrastTextColor as at}from"../../../../utils/getContrastTextColor";import{getFont as lt}from"./canvases";import{isBoothBadgeEligible as ht}from"./config-booth-badge-eligibility";import{getBadgeFontWeight as dt,getFontUrlByWeight as ut}from"./config-booth-labels";const ft=.5,gt=.3,z=15,mt=24,X=30,xt=12,pt=12,Z=.8,Q=document.createElement("canvas").getContext("2d");function yt(t){return t.length<=z?t:t.slice(0,z-1)+"\u2026"}function V(t){if(!t.paths?.length)return[];const n=t.layer?.name||"",e=[];for(const o of t.paths)for(const r of Y(o.index,n))e.push(r);return e}function Bt(t){const n=V(t);return n.length?q.fromPoints(n.flat().map(([e,o])=>({x:e,y:o}))):null}function St(t){const n=[],e=[];for(const o of t){const r=n.length;n.push({x:o[0][0],y:o[0][1]}),n.push({x:o[1][0],y:o[1][1]}),n.push({x:o[2][0],y:o[2][1]}),e.push([r,r+1,r+2])}return new J(n,e)}function H(t,n,e){return e.containsPoint({x:t,y:n})}function At(t,n,e,o,r,h,i,c){if(!t.length||!H(e,o,n))return i;const d={x:e,y:o};let a=0,f=i;const A=10;for(let y=0;y<A;y++){const m=(a+f)/2,I=r*m,g=h*m;[R({x:e+I,y:o},c,d),R({x:e,y:o+g},c,d),R({x:e+I,y:o+g},c,d)].every(l=>H(l.x,l.y,n))?a=m:f=m}return a}function Et(t){return Bt(t)??t.rect}function Tt(t,n,e,o,r,h){if(n.length){const a=Et(t),f={x:r>0?a.min.x:a.max.x,y:h>0?a.min.y:a.max.y},A=new Set;let y=null,m=1/0;for(const I of n)for(const g of I){const _=`${g[0]},${g[1]}`;if(A.has(_))continue;A.add(_);const u=g[0]+o*r,l=g[1]+o*h;if(H(u,l,e)){const B=Math.abs(u-f.x)+Math.abs(l-f.y);B<m&&(m=B,y={x:u,y:l})}}if(y)return y}const i=r>0?t.rect.min.x+o:t.rect.max.x-o,c=h>0?t.rect.min.y+o:t.rect.max.y-o,d=t.rotate??0;return d?R({x:i,y:c},d,t.rect.center):{x:i,y:c}}function W(t){return t&&t!=="none"?t:void 0}function It(t){const n=W(t.borderColor)||W(k.boothBorderColor)||k.colors.booths.default;return t.paths?.length>1&&W(t.paths[t.paths.length-1].color)||n}export function createBoothBadge(t){const n=yt(t.title||t.name),e=It(t),o=at(K(e).hex()),r=dt(),h=lt(X,r);Q.font=h;const i=Q.measureText(n).width,c=Math.ceil(i+xt*2),d=X+pt*2,a=(t.borderWidth||it.borderWidth)/2,f=c*Z,A=d*Z,y=t.rect.size.width,m=t.rect.size.height,I=s=>{const E=s?m:y,p=s?y:m;return Math.min(E>0?E*ft/f:1/0,p>0?p*gt/A:1/0)},g=V(t),_=St(g);let u=t.rotate??0,l=0,B=0,D=0,O=0;const w=()=>{const p=Tt(t,g,_,a,l===0||l===3?1:-1,l===0||l===1?1:-1);B=p.x,D=p.y;const T=I(l===1||l===3);O=At(g,_,B,D,f,A,T,u)};w();const F=(s,E)=>{const p=s/2,T=E/2,j=R({x:B+p,y:D+T},u,{x:B,y:D});return new v(j,{x:s,y:E},u,t.elevation)},$=ut(r,ot()),x=tt(F(1,1),e);x.hidden=!0,x.dim=t.skipDim?0:void 0;const S=et(nt([[n],[]],o,0,[$,$]),F(1,1),[0,0],{horizontal:"center",vertical:"center"});S.hidden=!0,S.dim=t.skipDim?0:void 0;const C={booth:t,anchor:{x:B,y:D},source:{x:f,y:A},rotation:u,maxScale:O,bg:x,text:S},b=new BoothBadgeDrawer(C);x.onScale=({pixelSize:s})=>b.layOutBg(s),S.onScale=({pixelSize:s})=>b.layOutText(s);const M=[];return M.push(P(()=>t.skipDim,s=>{x.dim=s?0:void 0,S.dim=s?0:void 0,L(x,S)})),M.push(P(()=>t.layer?.visible??!0,s=>{x.hidden=!s,S.hidden=!s,L(x,S)})),M.push(P(()=>N.mapSettings,({roll:s})=>{st(s??0)&&(x.onRoll=({roll:E,pixelSize:p})=>{const T=rt(E,u);if(T!==0)return u+=T*Math.PI/2,l=((l+T)%4+4)%4,w(),C.anchor.x=B,C.anchor.y=D,C.rotation=u,C.maxScale=O,[...b.layOutBg(p),...b.layOutText(p)]})},{fireImmediately:!0})),{bg:x,text:S,dispose:()=>{M.forEach(s=>s()),M.length=0}}}export class BoothBadgeDrawer{constructor(n){this.placement=n}layOutBg(n){const{bg:e}=this.placement;return e.shape=this.rectScaled(n),e.hidden=this.isHidden(),e.hidden?[]:[e]}layOutText(n){const{text:e,maxScale:o}=this.placement;return e.lines[0].fontSize=mt*Math.min(n,o),e.bounds=this.rectScaled(n),e.hidden=this.isHidden(),e.hidden?[]:[e]}rectScaled(n){const{anchor:e,booth:o,source:r,rotation:h,maxScale:i}=this.placement,c=Math.min(n,i),d=r.x*c,a=r.y*c,f=R({x:e.x+d/2,y:e.y+a/2},h,e);return new v(f,{x:d,y:a},h,o.elevation)}isHidden(){const{booth:n}=this.placement;return!!(n.layer&&!n.layer.visible)}}export function configBoothsBadges(t,n){const e=[],o=[],r=[];for(const i of n)if(i instanceof ct&&ht({hideExhibitorBoothNumber:U.hideExhibitorBoothNumber,hideBoothBadges:U.hideBoothBadges,hideLogoInBooth:N.hideLogoInBooth,noLabels:i.noLabels,hasExhibitors:i.exhibitors.length>0,hasLogoInBooth:i.exhibitors.some(c=>c.logoInBooth&&c.logo)})){const{bg:c,text:d,dispose:a}=createBoothBadge(i);e.push(c),o.push(d),r.push(a)}const h=()=>{r.forEach(i=>i()),r.length=0};return e.length?{layer:{name:`${t}${G}badges`,children:[{name:`${t}${G}badgeBgs`,children:e},{name:`${t}${G}badgeTexts`,children:o}]},cleanup:h}:{layer:null,cleanup:h}}
1
+ import{pointRotate as G,Rect as W}from"@expofp/geometry";import{update as w}from"@expofp/renderer";import k from"color";import{reaction as _}from"mobx";import{SEPARATOR as C}from"../../../../constants";import L from"../../../../data";import{getTrianglesFromFpPaths as Y}from"../../../../data/svg";import{createShapeDef as Z,createTextDef as z,createTextDefLines as Q}from"../../../../engine/defs";import{loadCustomFontsUrls as V}from"../../../../engine/fonts";import{getQuarterTurns as j,getRollValue as q}from"../../../../engine/update-def";import{boothStore as J,uiState as P}from"../../../../store";import{RegularBooth as K}from"../../../../store/BoothStore";import H from"../../../../tools/settings";import{getContrastTextColor as tt}from"../../../../utils/getContrastTextColor";import{BoothBadgeAnchors as et}from"./booth-badge-anchor";import{getFont as ot}from"./canvases";import{isBoothBadgeEligible as nt}from"./config-booth-badge-eligibility";import{getBadgeFontWeight as rt,getFontUrlByWeight as st}from"./config-booth-labels";const U=15,it=24,$=30,at=12,ct=12,v=.8,N=document.createElement("canvas").getContext("2d");function dt(t){return t.length<=U?t:t.slice(0,U-1)+"\u2026"}function lt(t){if(!t.paths?.length)return[];const o=t.layer?.name||"",e=[];for(const i of t.paths)for(const r of Y(i.index,o))e.push(r);return e}function I(t){return t&&t!=="none"?t:void 0}function ht(t){const o=I(t.borderColor)||I(H.boothBorderColor)||H.colors.booths.default;return t.paths?.length>1&&I(t.paths[t.paths.length-1].color)||o}export function createBoothBadge(t){const o=dt(t.title||t.name),e=ht(t),i=tt(k(e).hex()),r=rt(),l=ot($,r);N.font=l;const s=N.measureText(o).width,c=Math.ceil(s+at*2),m=$+ct*2,u=(t.borderWidth||J.borderWidth)/2,y=c*v,R=m*v,T=new et(t,lt(t),u,{x:y,y:R});let h=t.rotate??0,b=0,g=0,f=0,D=0;const O=()=>{const n=T.fit(b,h);g=n.x,f=n.y,D=n.maxScale};O();const M=(n,E)=>{const A=n/2,B=E/2,X=G({x:g+A,y:f+B},h,{x:g,y:f});return new W(X,{x:n,y:E},h,t.elevation)},F=st(r,V()),a=Z(M(1,1),e);a.hidden=!0,a.dim=t.skipDim?0:void 0;const d=z(Q([[o],[]],i,0,[F,F]),M(1,1),[0,0],{horizontal:"center",vertical:"center"});d.hidden=!0,d.dim=t.skipDim?0:void 0;const p={booth:t,anchor:{x:g,y:f},source:{x:y,y:R},rotation:h,maxScale:D,bg:a,text:d},S=new BoothBadgeDrawer(p);a.onScale=({pixelSize:n})=>S.layOutBg(n),d.onScale=({pixelSize:n})=>S.layOutText(n);const x=[];return x.push(_(()=>t.skipDim,n=>{a.dim=n?0:void 0,d.dim=n?0:void 0,w(a,d)})),x.push(_(()=>t.layer?.visible??!0,n=>{a.hidden=!n,d.hidden=!n,w(a,d)})),x.push(_(()=>P.mapSettings,({roll:n})=>{q(n??0)&&(T.prefetch(t.rotate??0),a.onRoll=({roll:E,pixelSize:A})=>{const B=j(E,h);if(B!==0)return h+=B*Math.PI/2,b=((b+B)%4+4)%4,O(),p.anchor.x=g,p.anchor.y=f,p.rotation=h,p.maxScale=D,[...S.layOutBg(A),...S.layOutText(A)]})},{fireImmediately:!0}),()=>T.cancelPrefetch()),{bg:a,text:d,dispose:()=>{x.forEach(n=>n()),x.length=0}}}export class BoothBadgeDrawer{constructor(o){this.placement=o}layOutBg(o){const{bg:e}=this.placement;return e.shape=this.rectScaled(o),e.hidden=this.isHidden(),e.hidden?[]:[e]}layOutText(o){const{text:e,maxScale:i}=this.placement;return e.lines[0].fontSize=it*Math.min(o,i),e.bounds=this.rectScaled(o),e.hidden=this.isHidden(),e.hidden?[]:[e]}rectScaled(o){const{anchor:e,booth:i,source:r,rotation:l,maxScale:s}=this.placement,c=Math.min(o,s),m=r.x*c,u=r.y*c,y=G({x:e.x+m/2,y:e.y+u/2},l,e);return new W(y,{x:m,y:u},l,i.elevation)}isHidden(){const{booth:o}=this.placement;return!!(o.layer&&!o.layer.visible)}}export function configBoothsBadges(t,o){const e=[],i=[],r=[];for(const s of o)if(s instanceof K&&nt({hideExhibitorBoothNumber:L.hideExhibitorBoothNumber,hideBoothBadges:L.hideBoothBadges,hideLogoInBooth:P.hideLogoInBooth,noLabels:s.noLabels,hasExhibitors:s.exhibitors.length>0,hasLogoInBooth:s.exhibitors.some(c=>c.logoInBooth&&c.logo)})){const{bg:c,text:m,dispose:u}=createBoothBadge(s);e.push(c),i.push(m),r.push(u)}const l=()=>{r.forEach(s=>s()),r.length=0};return e.length?{layer:{name:`${t}${C}badges`,children:[{name:`${t}${C}badgeBgs`,children:e},{name:`${t}${C}badgeTexts`,children:i}]},cleanup:l}:{layer:null,cleanup:l}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/floorplan",
3
- "version": "3.44.5",
3
+ "version": "3.44.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/expofp/efp-app.git",
@@ -69,15 +69,15 @@
69
69
  "tslib": "^2.3.0",
70
70
  "uuid": "^9.0.1",
71
71
  "zod": "4.4.3",
72
- "@expofp/config": "3.44.5",
73
- "@expofp/debug": "3.44.5",
74
- "@expofp/renderer": "3.44.5",
75
- "@expofp/geometry": "3.44.5",
76
- "@expofp/resolve": "3.44.5",
77
- "@expofp/schema": "3.44.5",
78
- "@expofp/ui": "3.44.5",
79
- "@expofp/utils": "3.44.5",
80
- "@expofp/wayfinding": "3.44.5"
72
+ "@expofp/config": "3.44.6",
73
+ "@expofp/debug": "3.44.6",
74
+ "@expofp/geometry": "3.44.6",
75
+ "@expofp/renderer": "3.44.6",
76
+ "@expofp/resolve": "3.44.6",
77
+ "@expofp/schema": "3.44.6",
78
+ "@expofp/ui": "3.44.6",
79
+ "@expofp/utils": "3.44.6",
80
+ "@expofp/wayfinding": "3.44.6"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@babel/plugin-proposal-decorators": "^8.0.2",