@rytass/wms-map-react-components 0.2.0 → 0.3.0

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 (41) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/README.md +30 -0
  3. package/components/canvas/react-flow-canvas.cjs +7 -1
  4. package/components/canvas/react-flow-canvas.d.cts +2 -0
  5. package/components/canvas/react-flow-canvas.d.ts +2 -0
  6. package/components/canvas/react-flow-canvas.js +7 -1
  7. package/components/modal/wms-map-content.cjs +29 -2
  8. package/components/modal/wms-map-content.js +30 -3
  9. package/components/modal/wms-map-modal-container.cjs +6 -4
  10. package/components/modal/wms-map-modal-container.d.cts +1 -1
  11. package/components/modal/wms-map-modal-container.d.ts +1 -1
  12. package/components/modal/wms-map-modal-container.js +6 -4
  13. package/components/nodes/image-node.cjs +0 -2
  14. package/components/nodes/image-node.js +0 -2
  15. package/components/nodes/path-node.cjs +5 -4
  16. package/components/nodes/path-node.js +6 -5
  17. package/components/nodes/rectangle-node.cjs +5 -4
  18. package/components/nodes/rectangle-node.js +6 -5
  19. package/components/preview/wms-map-preview.cjs +201 -0
  20. package/components/preview/wms-map-preview.d.cts +11 -0
  21. package/components/preview/wms-map-preview.d.ts +11 -0
  22. package/components/preview/wms-map-preview.js +199 -0
  23. package/hooks/use-fit-view-when-ready.cjs +74 -0
  24. package/hooks/use-fit-view-when-ready.d.cts +18 -0
  25. package/hooks/use-fit-view-when-ready.d.ts +18 -0
  26. package/hooks/use-fit-view-when-ready.js +72 -0
  27. package/index.cjs +2 -0
  28. package/index.d.cts +1 -0
  29. package/index.d.ts +1 -0
  30. package/index.js +1 -0
  31. package/package.json +1 -1
  32. package/types/component-props.types.d.cts +31 -0
  33. package/types/component-props.types.d.ts +31 -0
  34. package/utils/fit-trigger.cjs +41 -0
  35. package/utils/fit-trigger.d.cts +37 -0
  36. package/utils/fit-trigger.d.ts +37 -0
  37. package/utils/fit-trigger.js +36 -0
  38. package/utils/preview-highlight.cjs +38 -0
  39. package/utils/preview-highlight.d.cts +12 -0
  40. package/utils/preview-highlight.d.ts +12 -0
  41. package/utils/preview-highlight.js +34 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,181 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [0.3.0](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.2.0...@rytass/wms-map-react-components@0.3.0) (2026-11-17)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **wms-map-react-components:** keep background image at its stored size ([fd8809f](https://github.com/Rytass/Utils/commit/fd8809f5d2aa42c96f13a65a3e416b87b6a0a637))
11
+
12
+ ### Features
13
+
14
+ - **wms-map-react-components:** add WMSMapPreview ([915c294](https://github.com/Rytass/Utils/commit/915c29484541f4988a21f3f241159c995e55aaad))
15
+ - **wms-map-react-components:** fit the map to the viewport on load ([c7d072a](https://github.com/Rytass/Utils/commit/c7d072a52a16c344d6e1dad9f6e4b3e2002aa759))
16
+ - **wms-map-react-components:** style highlighted and dimmed ranges ([d6f363f](https://github.com/Rytass/Utils/commit/d6f363fbbb14fb2ed0438504ad1aa97253e6dc9c))
17
+
18
+ # [0.2.0](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.10...@rytass/wms-map-react-components@0.2.0) (2026-08-02)
19
+
20
+ **Note:** Version bump only for package @rytass/wms-map-react-components
21
+
22
+ ## [0.1.10](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.9...@rytass/wms-map-react-components@0.1.10) (2026-06-01)
23
+
24
+ ### Features
25
+
26
+ - **wms-map-react-components:** mark client components with 'use client' ([df7e1fa](https://github.com/Rytass/Utils/commit/df7e1fab69201108ace73411538298ab4ebdbd80))
27
+
28
+ ## [0.1.9](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.8...@rytass/wms-map-react-components@0.1.9) (2026-05-12)
29
+
30
+ ### Bug Fixes
31
+
32
+ - **wms-map-react-components:** avoid 350ms click delay and clear timer on unmount ([16bbb6a](https://github.com/Rytass/Utils/commit/16bbb6a710d0542c63f89abdfc16c0567dd2813a))
33
+
34
+ ### Features
35
+
36
+ - **packages/wms-map-react-components:** edit breadcrumb only in edit mode ([ffa8734](https://github.com/Rytass/Utils/commit/ffa87347adc2a27b3bc209ee8b238fd89fa5e2e9))
37
+ - **packages/wms-map-react-components:** node double click props ([ae2260f](https://github.com/Rytass/Utils/commit/ae2260f99f17ca79a32af2071ec9eb1bb4e3b848))
38
+ - **packages/wms-map-react-components:** props to show breadcrumb edit button ([7756fc0](https://github.com/Rytass/Utils/commit/7756fc0c6ed57daae472adf7fe0a47719506e9ea))
39
+
40
+ ## [0.1.8](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.7...@rytass/wms-map-react-components@0.1.8) (2026-05-07)
41
+
42
+ ### Bug Fixes
43
+
44
+ - **packages/wms-map-react-components:** calc points (x,y) correctly ([b2fcd19](https://github.com/Rytass/Utils/commit/b2fcd191b7851fa350a85a08f42b0da177b64f9a))
45
+
46
+ ## [0.1.7](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.6...@rytass/wms-map-react-components@0.1.7) (2026-04-22)
47
+
48
+ ### Bug Fixes
49
+
50
+ - **packages/wms-map-react-components:** fix check icon issue ([b95be70](https://github.com/Rytass/Utils/commit/b95be702ee43fb8736f7f012455e06496e7c6205))
51
+
52
+ ## [0.1.6](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.5...@rytass/wms-map-react-components@0.1.6) (2026-04-20)
53
+
54
+ ### Bug Fixes
55
+
56
+ - **packages/wms-map-react-components:** toggle props ([0a2b1f5](https://github.com/Rytass/Utils/commit/0a2b1f554a63b11b087a8d300d9cc9eaf9e4df57))
57
+
58
+ ## [0.1.5](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.4...@rytass/wms-map-react-components@0.1.5) (2026-04-16)
59
+
60
+ ### Bug Fixes
61
+
62
+ - **packages:** remove @mezzanine-ui/react-hook-form-v2 ([cb366d3](https://github.com/Rytass/Utils/commit/cb366d3123b2a49c8863b9739c866644fbec92da))
63
+ - **packages:** storybook issues ([52f2c3a](https://github.com/Rytass/Utils/commit/52f2c3af2c6c48d09788f23f15f3d07a43fca076))
64
+
65
+ ## [0.1.4](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.3...@rytass/wms-map-react-components@0.1.4) (2026-02-24)
66
+
67
+ **Note:** Version bump only for package @rytass/wms-map-react-components
68
+
69
+ ## [0.1.3](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.2...@rytass/wms-map-react-components@0.1.3) (2025-12-05)
70
+
71
+ ### Bug Fixes
72
+
73
+ - **wms-map-react-components:** use framework package for Storybook imports ([543ace4](https://github.com/Rytass/Utils/commit/543ace43a16bf3bc0d8d5e0dd909d22c8a70c41c))
74
+
75
+ ### chore
76
+
77
+ - **wms-map-react-components:** upgrade Storybook to v10.1.4 ([8802b34](https://github.com/Rytass/Utils/commit/8802b3441ef82200f95e4eadb7ac0a3e4908b3fc))
78
+
79
+ ### BREAKING CHANGES
80
+
81
+ - **wms-map-react-components:** Storybook 10 is ESM-only. Configuration files now use
82
+ import.meta.url for path resolution.
83
+
84
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
85
+
86
+ Co-Authored-By: Claude <noreply@anthropic.com>
87
+
88
+ ## [0.1.2](https://github.com/Rytass/Utils/compare/@rytass/wms-map-react-components@0.1.1...@rytass/wms-map-react-components@0.1.2) (2025-09-11)
89
+
90
+ ### Features
91
+
92
+ - align frontend-backend interfaces for WMS map range data ([5b883a7](https://github.com/Rytass/Utils/commit/5b883a7e69c9fab16cf426bf1becfabd3d4b5ba8))
93
+ - migrate to Nx project-based configuration ([c2d9ca4](https://github.com/Rytass/Utils/commit/c2d9ca46c00ace42bcbf69300dcc43a7346cb9aa))
94
+
95
+ ### Tests
96
+
97
+ - migrate to standardized test structure ([b7dc99e](https://github.com/Rytass/Utils/commit/b7dc99ef85f5951480dfdae6198cefa252c15423))
98
+
99
+ ### BREAKING CHANGES
100
+
101
+ - Test directory structure changed from **test** to **tests**
102
+
103
+ 🤖 Generated with [Claude Code](https://claude.ai/code)
104
+
105
+ Co-Authored-By: Claude <noreply@anthropic.com>
106
+
107
+ ## 0.1.1 (2025-09-09)
108
+
109
+ ### Bug Fixes
110
+
111
+ - add file-type ESM compatibility and test fixes ([42de851](https://github.com/Rytass/Utils/commit/42de8515f7a111588206d9b2ffb7c20b382bb90d))
112
+ - **wms-map-react-components:** fix case-sensitive file system compatibility ([a94a51b](https://github.com/Rytass/Utils/commit/a94a51b0836dc8d33e02c1f3672cfd57f30b438a))
113
+ - **wms-map-react-components:** resolve React hooks dependency warning ([47cbe41](https://github.com/Rytass/Utils/commit/47cbe41823379bddfd3cc582825dec8b023d57a9))
114
+ - **wms-map-react-components:** resolve remaining ESLint violations ([ad20df1](https://github.com/Rytass/Utils/commit/ad20df1cd412059e82b3c0a6dc7c4fa0411b383f))
115
+ - **wms-map-react-components:** resolve TypeScript compilation errors ([5d7ba43](https://github.com/Rytass/Utils/commit/5d7ba43e430a507ed2b443287c97fb886cf83bd3))
116
+ - **wms-map-react-components:** resolve TypeScript ESLint violations ([4c8d12e](https://github.com/Rytass/Utils/commit/4c8d12e33f476b0b00474a4feb6a6c31a95247d9))
117
+ - **wms:** removes auto fit view on load ([1a4947a](https://github.com/Rytass/Utils/commit/1a4947a32b7ac4a003cf30f2f099f48321be3e01))
118
+ - **wms:** 修正檢視模式要按著空白鍵才能拖曳畫布的問題 ([5963d53](https://github.com/Rytass/Utils/commit/5963d53024db65273b9a79efba2c71b48d530dad))
119
+ - **wms:** 修正滑鼠滾輪無法正確放大縮小畫布的問題 ([a5b813c](https://github.com/Rytass/Utils/commit/a5b813cd234d48bd70dd183857e3ff588bc978a7))
120
+ - **wms:** 修正編輯圖形內文字時,按 delete 刪除文字時會把圖形刪除的問題 ([fc106fb](https://github.com/Rytass/Utils/commit/fc106fbb5398612fc1e7b92820445e28c446c951))
121
+ - **wms:** 修正若編輯的最後一步驟為編輯文字時,redo \ undo 沒有正確紀錄的問題 ([e3050c4](https://github.com/Rytass/Utils/commit/e3050c44baa4232911bb57d0c33a12458e3b36b1))
122
+ - **wms:** 修正讀取進來的資料, 底圖無法使用 delete 按鍵刪除的問題 ([f05455d](https://github.com/Rytass/Utils/commit/f05455d35fe001e878f45324066842438b94d081))
123
+ - **wms:** 鋼筆工具 - 修正按著 shift 會觸發自動閉合的情況 ([e6eb8d1](https://github.com/Rytass/Utils/commit/e6eb8d1db97258c0b9e826b06e292e4db668e5d8))
124
+ - **wms:** 麵包屑 - 修正下拉選單無法點擊的問題 ([6a807e4](https://github.com/Rytass/Utils/commit/6a807e422fba5cf4f710ce7198a681220789cf74))
125
+
126
+ ### Features
127
+
128
+ - add test:coverage script to all packages ([f73bce5](https://github.com/Rytass/Utils/commit/f73bce52024d453755824fa6af784f13da50061f))
129
+ - upgrade file-type from v16.5.4 to v21.0.0 ([eb8217b](https://github.com/Rytass/Utils/commit/eb8217b76c4a0d74061f782c082fd4183961bb12))
130
+ - **wmd:** 矩形繪製工具 - 修正底色透明度 ([cee04c7](https://github.com/Rytass/Utils/commit/cee04c7caf2af35fa460edc676810d0bb1e9f97a))
131
+ - **wms-map-react-components:** migrate mock data to Storybook with interactive testing ([c52f88f](https://github.com/Rytass/Utils/commit/c52f88fe5d4c3de58034750ded806a75a7ca6264))
132
+ - **wms:** initialize ([ee4d443](https://github.com/Rytass/Utils/commit/ee4d4435cd57e5d06a67842e65d669ccecef5d0b))
133
+ - **wms:** redo / undo ([254be46](https://github.com/Rytass/Utils/commit/254be4613891931d1baa939a8be8fcdfff982419))
134
+ - **wms:** redo \ undo 會記錄圖層或底圖模式 ([f46018f](https://github.com/Rytass/Utils/commit/f46018f60f768badd05e8b229c217cd25e5b2e4b))
135
+ - **wms:** toolbar - 上傳 ([05064eb](https://github.com/Rytass/Utils/commit/05064eb1246664d9039d3527582c93f8b49a5917))
136
+ - **wms:** toolbar - 多張上傳 ([ad99de7](https://github.com/Rytass/Utils/commit/ad99de79df71a02d4ace183d81a6a3b035b314f8))
137
+ - **wms:** toolbar - 底圖、圖層模式切換 ([6ce26c0](https://github.com/Rytass/Utils/commit/6ce26c05191d05276e0549e9c37b44e8241bf99b))
138
+ - **wms:** toolbar - 底圖縮放 ([497f378](https://github.com/Rytass/Utils/commit/497f3789cb9c3f4e387619c8239dc8a820c5e4e3))
139
+ - **wms:** 儲存時 console.log ([3f1da0f](https://github.com/Rytass/Utils/commit/3f1da0f05b417595fc09caf0aaac6efbb4190109))
140
+ - **wms:** 右上 toolbar 的 active UI 狀態 ([ef32673](https://github.com/Rytass/Utils/commit/ef326737d065ec98fbcecbaaf245a7e4edba2cfb))
141
+ - **wms:** 右鍵選單 - 刪除 - 鍵盤快捷鍵 ([10f19fe](https://github.com/Rytass/Utils/commit/10f19fead55580e0185d72984d14afdba2ce8f9d))
142
+ - **wms:** 右鍵選單 - 圖層刪除 ([673e776](https://github.com/Rytass/Utils/commit/673e776848624db0a01698793e66dd81940bef79))
143
+ - **wms:** 右鍵選單 - 圖層複製並貼上 ([130cc60](https://github.com/Rytass/Utils/commit/130cc60f6b6afdfb03140ed8013b68f8106ee600))
144
+ - **wms:** 右鍵選單 - 底圖複製並貼上、刪除 ([a68aca9](https://github.com/Rytass/Utils/commit/a68aca9e6697d4a79aaa8487bc094505caa59000))
145
+ - **wms:** 右鍵選單 - 排列順序 ([26d0b87](https://github.com/Rytass/Utils/commit/26d0b87b1b92268d87427f516c0d0dff4b4cf38e))
146
+ - **wms:** 右鍵選單 - 排列順序 - 若所選項目已經是最前或是最後,相關選單 disable ([69bfed4](https://github.com/Rytass/Utils/commit/69bfed4aacec8416b58cba14f03f43273ce4d1ae))
147
+ - **wms:** 右鍵選單 - 複製並貼上 - 鍵盤快捷鍵 ([810dd95](https://github.com/Rytass/Utils/commit/810dd95b339e8773e8498a7070e88009d6ad2500))
148
+ - **wms:** 右鍵選單 - 複製並貼上 - 鍵盤快捷鍵 - 連續複製並貼上 ([494d602](https://github.com/Rytass/Utils/commit/494d6023cf967496db377cc85626d92c99fc2a7b))
149
+ - **wms:** 圖形 hover 效果 ([37b0eea](https://github.com/Rytass/Utils/commit/37b0eea9121dee6a571ad60ee679fd50ce87b0d8))
150
+ - **wms:** 將修改當前區域名稱的資料傳遞至 WmsMapModal 之外 ([49f99a2](https://github.com/Rytass/Utils/commit/49f99a26e986b4c86fad3d4fcdf41dfe2b64345a))
151
+ - **wms:** 將儲存的資料傳遞至 WmsMapModal 之外 ([98e627b](https://github.com/Rytass/Utils/commit/98e627bc411a5b0cb18a8d8b532ef3998d470b2a))
152
+ - **wms:** 將圖形的點擊資訊傳遞至 WmsMapModal 之外 ([a5daf1e](https://github.com/Rytass/Utils/commit/a5daf1ee3bf2ce1c370fdbed8db561bdffdcf988))
153
+ - **wms:** 將鋼筆工具繪製出的圖形的文字編輯樣式調整成和矩形工具的文字編輯樣式相同 ([22679b2](https://github.com/Rytass/Utils/commit/22679b254fb7b7643a0038b71fc003086a7e266d))
154
+ - **wms:** 左下 toolbar 的 active UI 狀態 ([38a0a7c](https://github.com/Rytass/Utils/commit/38a0a7c4b10e198fc5e55dc1568310bde2a84bcb))
155
+ - **wms:** 底圖和圖層模式的元件只能在相對應的模式下選取、編輯、拖曳 ([54dfe3f](https://github.com/Rytass/Utils/commit/54dfe3f06a2345e35d222c02cd421961e49a9ff3))
156
+ - **wms:** 底圖編輯 - 上傳底圖時,預設顯示位置為當前 view port ([2210be0](https://github.com/Rytass/Utils/commit/2210be04fe31a238cd678482a07ecf1915b9c578))
157
+ - **wms:** 檢視模式 ([18953d8](https://github.com/Rytass/Utils/commit/18953d8c08e946a47d09942290be918a2087abd8))
158
+ - **wms:** 檢視模式 - 關閉底圖 ([b89b524](https://github.com/Rytass/Utils/commit/b89b5240b4d993a675fd8dc9a263a3ec8ac65af6))
159
+ - **wms:** 歷史工具列 - 底圖模式 ([45dfe3f](https://github.com/Rytass/Utils/commit/45dfe3f6d35ef131d306175678eb6322b85b247f))
160
+ - **wms:** 測試讀取資料 ([7c1d834](https://github.com/Rytass/Utils/commit/7c1d834726feb6c62dbacd29e35267cba5d306ec))
161
+ - **wms:** 縮放工具列 - 與滑鼠滾輪縮放數值同步 ([c3d57bd](https://github.com/Rytass/Utils/commit/c3d57bdaa7e83572d4a060f618870035e6e11835))
162
+ - **wms:** 繪圖工具列 ([603ac71](https://github.com/Rytass/Utils/commit/603ac7186193fcedc7f3c197cdfde9b5fe58d55e))
163
+ - **wms:** 調色工具 ([4ed67b4](https://github.com/Rytass/Utils/commit/4ed67b450a775e366c56c39f645ac6fcadd3836a))
164
+ - **wms:** 鋼筆工具 ([7a86a6c](https://github.com/Rytass/Utils/commit/7a86a6cf6a5251f1db57a587a1d485faefc874e1))
165
+ - **wms:** 鋼筆工具 - 修正底色透明度 ([4a9a1fc](https://github.com/Rytass/Utils/commit/4a9a1fc763bee6e012a577c659bc522431f7f2c0))
166
+ - **wms:** 鋼筆工具 - 可編輯個別節點位置 ([27f413b](https://github.com/Rytass/Utils/commit/27f413bd973b49d4572ae223a84f79f7f0a5de55))
167
+ - **wms:** 鋼筆工具 - 繪製時若點擊非繪圖區域,圖形會自動閉合 ([2f2fa91](https://github.com/Rytass/Utils/commit/2f2fa91fcc0bfc7c3bcf58ac60105dd1111f79c2))
168
+ - **wms:** 鋼筆工具 - 點擊初始點閉合圖形 ([a0679ff](https://github.com/Rytass/Utils/commit/a0679ff51800aadaaafe380bc59675bc8d9f3561))
169
+ - **wms:** 鋼筆工具 shift 水平線 ([7b842a4](https://github.com/Rytass/Utils/commit/7b842a42107a6bfc536f1d9b431f37701e1ac6d9))
170
+ - **wms:** 鋼筆工具繪製區域可編輯文字 ([afaa641](https://github.com/Rytass/Utils/commit/afaa64102d1d9c43a5cd80e2ae40d5e2871c6597))
171
+ - **wms:** 顏色選取工具 - 使用 props array 顏色列表 ([7db92bf](https://github.com/Rytass/Utils/commit/7db92bfcb49a7d4dae47a06598186b972f4ffeb9))
172
+ - **wms:** 麵包屑 ([4a6a9b8](https://github.com/Rytass/Utils/commit/4a6a9b811b33adbaa4315aa97c82495f4fafbc08))
173
+ - **wms:** 麵包屑編輯名稱 modal ([8739e3d](https://github.com/Rytass/Utils/commit/8739e3d3c6b9ee1b9d8631f6e5d08c947063ad9a))
174
+
175
+ ### BREAKING CHANGES
176
+
177
+ - file-type v21 is ESM-only, requires Node.js 18+
178
+
179
+ 🤖 Generated with [Claude Code](https://claude.ai/code)
180
+
181
+ Co-Authored-By: Claude <noreply@anthropic.com>
package/README.md CHANGED
@@ -62,6 +62,36 @@ export default App;
62
62
  | `initialEdges` | `any[]` | `[]` | Initial edges for the canvas |
63
63
  | `debugMode` | `boolean` | `false` | Enable debug logging |
64
64
  | `title` | `string` | `'編輯倉儲空間'` | Modal title |
65
+ | `fitViewOnLoad` | `boolean` | `true` | Fit the view when a different map is entered (`warehouseIds` changes) or a map first gets non-empty nodes. Adding or removing nodes on the same map never refits. Update `warehouseIds` no later than `initialNodes` when switching maps. |
66
+
67
+ ## Styles
68
+
69
+ The components render with React Flow, whose stylesheet is not bundled. Import it once at the app level:
70
+
71
+ ```tsx
72
+ import '@xyflow/react/dist/style.css';
73
+ ```
74
+
75
+ ## WMSMapPreview
76
+
77
+ Read-only preview with no toolbar, breadcrumb or context menu. It fits to the nodes once they are measured (to `highlightIds` when given) and refits when its container resizes.
78
+
79
+ ```tsx
80
+ import { WMSMapPreview } from '@rytass/wms-map-react-components';
81
+
82
+ <WMSMapPreview initialNodes={nodes} highlightIds={['range-a']} style={{ width: 320, height: 200 }} />;
83
+ ```
84
+
85
+ | Prop | Type | Default | Description |
86
+ | ----------------- | ------------------------------------------------- | ------- | ---------------------------------------------------------------- |
87
+ | `initialNodes` | `FlowNode[]` | - | Nodes to render, same format as the modal |
88
+ | `highlightIds` | `string[]` | - | Range ids to highlight and fit to |
89
+ | `dimOthers` | `boolean` | `true` | Dim the other ranges while some are highlighted |
90
+ | `fitPadding` | `number` | `0.15` | Fit padding as a ratio of the viewport |
91
+ | `interactive` | `boolean` | `false` | Allow pan and zoom; nodes are never selectable or editable |
92
+ | `getFilenameFQDN` | `(filename: string) => Promise<string> \| string` | - | Resolve each background's `fileName` to the image URL to display |
93
+ | `className` | `string` | - | Class on the outer container |
94
+ | `style` | `CSSProperties` | - | Style on the outer container (defaults to 100% × 100%) |
65
95
 
66
96
  ## Features
67
97
 
@@ -10,6 +10,7 @@ var rectangleNode = require('../nodes/rectangle-node.cjs');
10
10
  var pathNode = require('../nodes/path-node.cjs');
11
11
  var useRectangleDrawing = require('../../hooks/use-rectangle-drawing.cjs');
12
12
  var usePenDrawing = require('../../hooks/use-pen-drawing.cjs');
13
+ var useFitViewWhenReady = require('../../hooks/use-fit-view-when-ready.cjs');
13
14
  var reactFlowCanvas_module = require('./react-flow-canvas.module.scss.cjs');
14
15
  var index = require('../../icons/index.cjs');
15
16
 
@@ -65,8 +66,13 @@ const CustomControls = ()=>{
65
66
  })
66
67
  });
67
68
  };
68
- const ReactFlowCanvas = ({ nodes, edges, onNodesChange, onEdgesChange, onConnect, editMode, drawingMode, viewMode, selectedColor = '#3b82f6', onCreateRectangle, onCreatePath, onSelectionChange, onTextEditComplete, onPathPointsChange, onPathPointDragStateChange, isEditingPathPoints: _isEditingPathPoints = false, hoveredNodeId, onNodeMouseEnter, onNodeMouseLeave, onNodeClick, onNodeDoubleClick, showBackground = true })=>{
69
+ const ReactFlowCanvas = ({ nodes, edges, onNodesChange, onEdgesChange, onConnect, editMode, drawingMode, viewMode, selectedColor = '#3b82f6', onCreateRectangle, onCreatePath, onSelectionChange, onTextEditComplete, onPathPointsChange, onPathPointDragStateChange, isEditingPathPoints: _isEditingPathPoints = false, hoveredNodeId, onNodeMouseEnter, onNodeMouseLeave, onNodeClick, onNodeDoubleClick, showBackground = true, fitRequestToken = 0 })=>{
69
70
  // console.log('🖼️ ReactFlowCanvas 接收到 showBackground:', showBackground);
71
+ useFitViewWhenReady.useFitViewWhenReady({
72
+ requestToken: fitRequestToken,
73
+ nodeIds: nodes.map((node)=>node.id),
74
+ padding: 0.1
75
+ });
70
76
  const { containerRef: rectContainerRef, previewRect } = useRectangleDrawing.useRectangleDrawing({
71
77
  editMode,
72
78
  drawingMode,
@@ -33,6 +33,8 @@ interface ReactFlowCanvasProps {
33
33
  onNodeClick?: (event: React.MouseEvent, node: ReactFlowNode) => void;
34
34
  onNodeDoubleClick?: (event: React.MouseEvent, node: ReactFlowNode) => void;
35
35
  showBackground?: boolean;
36
+ /** 遞增即要求一次 fit(節點量測完成後才執行);0 或未提供則不 fit。 */
37
+ fitRequestToken?: number;
36
38
  }
37
39
  declare const ReactFlowCanvas: FC<ReactFlowCanvasProps>;
38
40
  export default ReactFlowCanvas;
@@ -33,6 +33,8 @@ interface ReactFlowCanvasProps {
33
33
  onNodeClick?: (event: React.MouseEvent, node: ReactFlowNode) => void;
34
34
  onNodeDoubleClick?: (event: React.MouseEvent, node: ReactFlowNode) => void;
35
35
  showBackground?: boolean;
36
+ /** 遞增即要求一次 fit(節點量測完成後才執行);0 或未提供則不 fit。 */
37
+ fitRequestToken?: number;
36
38
  }
37
39
  declare const ReactFlowCanvas: FC<ReactFlowCanvasProps>;
38
40
  export default ReactFlowCanvas;
@@ -8,6 +8,7 @@ import RectangleNode from '../nodes/rectangle-node.js';
8
8
  import PathNode from '../nodes/path-node.js';
9
9
  import { useRectangleDrawing } from '../../hooks/use-rectangle-drawing.js';
10
10
  import { usePenDrawing } from '../../hooks/use-pen-drawing.js';
11
+ import { useFitViewWhenReady } from '../../hooks/use-fit-view-when-ready.js';
11
12
  import styles from './react-flow-canvas.module.scss.js';
12
13
  import { FolderIcon } from '../../icons/index.js';
13
14
 
@@ -63,8 +64,13 @@ const CustomControls = ()=>{
63
64
  })
64
65
  });
65
66
  };
66
- const ReactFlowCanvas = ({ nodes, edges, onNodesChange, onEdgesChange, onConnect, editMode, drawingMode, viewMode, selectedColor = '#3b82f6', onCreateRectangle, onCreatePath, onSelectionChange, onTextEditComplete, onPathPointsChange, onPathPointDragStateChange, isEditingPathPoints: _isEditingPathPoints = false, hoveredNodeId, onNodeMouseEnter, onNodeMouseLeave, onNodeClick, onNodeDoubleClick, showBackground = true })=>{
67
+ const ReactFlowCanvas = ({ nodes, edges, onNodesChange, onEdgesChange, onConnect, editMode, drawingMode, viewMode, selectedColor = '#3b82f6', onCreateRectangle, onCreatePath, onSelectionChange, onTextEditComplete, onPathPointsChange, onPathPointDragStateChange, isEditingPathPoints: _isEditingPathPoints = false, hoveredNodeId, onNodeMouseEnter, onNodeMouseLeave, onNodeClick, onNodeDoubleClick, showBackground = true, fitRequestToken = 0 })=>{
67
68
  // console.log('🖼️ ReactFlowCanvas 接收到 showBackground:', showBackground);
69
+ useFitViewWhenReady({
70
+ requestToken: fitRequestToken,
71
+ nodeIds: nodes.map((node)=>node.id),
72
+ padding: 0.1
73
+ });
68
74
  const { containerRef: rectContainerRef, previewRect } = useRectangleDrawing({
69
75
  editMode,
70
76
  drawingMode,
@@ -7,6 +7,7 @@ var react = require('@xyflow/react');
7
7
  var typings = require('../../typings.cjs');
8
8
  var index = require('../../constants/index.cjs');
9
9
  var nodeUtils = require('../../utils/node-utils.cjs');
10
+ var fitTrigger = require('../../utils/fit-trigger.cjs');
10
11
  var nodeOperations = require('../../utils/node-operations.cjs');
11
12
  var mapDataTransform = require('../../utils/map-data-transform.cjs');
12
13
  var useDirectStateHistory = require('../../hooks/use-direct-state-history.cjs');
@@ -17,7 +18,7 @@ var reactFlowCanvas = require('../canvas/react-flow-canvas.cjs');
17
18
  var viewModeToolbar = require('../ui/view-mode-toolbar.cjs');
18
19
  var textMappings = require('../../constants/text-mappings.cjs');
19
20
 
20
- const WMSMapContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes: propsInitialNodes = [], initialEdges: propsInitialEdges = [], onUpload, getFilenameFQDN, maxFileSizeKB = 30720, warehouseIds = [
21
+ const WMSMapContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes: propsInitialNodes = [], initialEdges: propsInitialEdges = [], fitViewOnLoad = true, onUpload, getFilenameFQDN, maxFileSizeKB = 30720, warehouseIds = [
21
22
  ...index.DEFAULT_WAREHOUSE_IDS
22
23
  ] })=>{
23
24
  const renderCount = React.useRef(0);
@@ -86,6 +87,31 @@ const WMSMapContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPa
86
87
  ]);
87
88
  // 用於追蹤上一次的 initialNodes 以進行比較
88
89
  const prevInitialNodesRef = React.useRef([]);
90
+ // 遞增即要求 ReactFlowCanvas fit 一次(節點量測完成後才執行)
91
+ const [fitRequestToken, setFitRequestToken] = React.useState(0);
92
+ const mapFitStateRef = React.useRef(fitTrigger.INITIAL_MAP_FIT_STATE);
93
+ const mapKey = fitTrigger.getMapKey(warehouseIds);
94
+ const initialNodeSignature = React.useMemo(()=>fitTrigger.getNodeIdSignature(propsInitialNodes), [
95
+ propsInitialNodes
96
+ ]);
97
+ const initialNodeCount = propsInitialNodes.length;
98
+ // 只在換地圖或同一張圖第一次拿到非空節點時 fit;同圖節點增減(編輯後儲存再重抓)不 fit
99
+ React.useEffect(()=>{
100
+ const { shouldFit, state } = fitTrigger.resolveMapFit(mapFitStateRef.current, {
101
+ mapKey,
102
+ nodeSignature: initialNodeSignature,
103
+ nodeCount: initialNodeCount
104
+ });
105
+ mapFitStateRef.current = state;
106
+ if (fitViewOnLoad && shouldFit) {
107
+ setFitRequestToken((token)=>token + 1);
108
+ }
109
+ }, [
110
+ mapKey,
111
+ initialNodeSignature,
112
+ initialNodeCount,
113
+ fitViewOnLoad
114
+ ]);
89
115
  // 監聽 initialNodes 變化,當接收到新資料時清空並載入
90
116
  React.useEffect(()=>{
91
117
  const currentNodeIds = propsInitialNodes.map((n)=>n.id).sort();
@@ -794,7 +820,8 @@ const WMSMapContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPa
794
820
  onNodeMouseLeave: handleNodeMouseLeave,
795
821
  onNodeClick: handleNodeClick,
796
822
  onNodeDoubleClick: handleNodeDoubleClick,
797
- showBackground: showBackground
823
+ showBackground: showBackground,
824
+ fitRequestToken: fitRequestToken
798
825
  }),
799
826
  /*#__PURE__*/ jsxRuntime.jsx(viewModeToolbar, {
800
827
  viewMode: viewMode,
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
- import { useRef, useState, useCallback, useEffect } from 'react';
3
+ import { useRef, useState, useCallback, useEffect, useMemo } from 'react';
4
4
  import { useNodesState, useEdgesState, useReactFlow, addEdge } from '@xyflow/react';
5
5
  import { EditMode, ViewMode } from '../../typings.js';
6
6
  import { UI_CONFIG, MIN_RECTANGLE_SIZE, DEFAULT_RECTANGLE_LABEL, DEFAULT_PATH_LABEL, DEFAULT_WAREHOUSE_IDS } from '../../constants/index.js';
7
7
  import { calculateImageSize, calculateStaggeredPosition } from '../../utils/node-utils.js';
8
+ import { INITIAL_MAP_FIT_STATE, getMapKey, getNodeIdSignature, resolveMapFit } from '../../utils/fit-trigger.js';
8
9
  import { createPathCopy, createRectangleCopy, createImageCopy } from '../../utils/node-operations.js';
9
10
  import { logNodeData, transformNodeToClickInfo, transformNodesToMapData, logMapData } from '../../utils/map-data-transform.js';
10
11
  import { useDirectStateHistory } from '../../hooks/use-direct-state-history.js';
@@ -15,7 +16,7 @@ import ReactFlowCanvas from '../canvas/react-flow-canvas.js';
15
16
  import ViewModeToolbar from '../ui/view-mode-toolbar.js';
16
17
  import { TEXT_MAPPINGS } from '../../constants/text-mappings.js';
17
18
 
18
- const WMSMapContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes: propsInitialNodes = [], initialEdges: propsInitialEdges = [], onUpload, getFilenameFQDN, maxFileSizeKB = 30720, warehouseIds = [
19
+ const WMSMapContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes: propsInitialNodes = [], initialEdges: propsInitialEdges = [], fitViewOnLoad = true, onUpload, getFilenameFQDN, maxFileSizeKB = 30720, warehouseIds = [
19
20
  ...DEFAULT_WAREHOUSE_IDS
20
21
  ] })=>{
21
22
  const renderCount = useRef(0);
@@ -84,6 +85,31 @@ const WMSMapContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPa
84
85
  ]);
85
86
  // 用於追蹤上一次的 initialNodes 以進行比較
86
87
  const prevInitialNodesRef = useRef([]);
88
+ // 遞增即要求 ReactFlowCanvas fit 一次(節點量測完成後才執行)
89
+ const [fitRequestToken, setFitRequestToken] = useState(0);
90
+ const mapFitStateRef = useRef(INITIAL_MAP_FIT_STATE);
91
+ const mapKey = getMapKey(warehouseIds);
92
+ const initialNodeSignature = useMemo(()=>getNodeIdSignature(propsInitialNodes), [
93
+ propsInitialNodes
94
+ ]);
95
+ const initialNodeCount = propsInitialNodes.length;
96
+ // 只在換地圖或同一張圖第一次拿到非空節點時 fit;同圖節點增減(編輯後儲存再重抓)不 fit
97
+ useEffect(()=>{
98
+ const { shouldFit, state } = resolveMapFit(mapFitStateRef.current, {
99
+ mapKey,
100
+ nodeSignature: initialNodeSignature,
101
+ nodeCount: initialNodeCount
102
+ });
103
+ mapFitStateRef.current = state;
104
+ if (fitViewOnLoad && shouldFit) {
105
+ setFitRequestToken((token)=>token + 1);
106
+ }
107
+ }, [
108
+ mapKey,
109
+ initialNodeSignature,
110
+ initialNodeCount,
111
+ fitViewOnLoad
112
+ ]);
87
113
  // 監聽 initialNodes 變化,當接收到新資料時清空並載入
88
114
  useEffect(()=>{
89
115
  const currentNodeIds = propsInitialNodes.map((n)=>n.id).sort();
@@ -792,7 +818,8 @@ const WMSMapContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPa
792
818
  onNodeMouseLeave: handleNodeMouseLeave,
793
819
  onNodeClick: handleNodeClick,
794
820
  onNodeDoubleClick: handleNodeDoubleClick,
795
- showBackground: showBackground
821
+ showBackground: showBackground,
822
+ fitRequestToken: fitRequestToken
796
823
  }),
797
824
  /*#__PURE__*/ jsx(ViewModeToolbar, {
798
825
  viewMode: viewMode,
@@ -13,7 +13,7 @@ var wmsMapContent = require('./wms-map-content.cjs');
13
13
  var debugLogger = require('../../utils/debug-logger.cjs');
14
14
  var wmsMapModalContainer_module = require('./wms-map-modal-container.module.scss.cjs');
15
15
 
16
- const WMSMapModalContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds })=>{
16
+ const WMSMapModalContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds, fitViewOnLoad = true })=>{
17
17
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
18
18
  className: wmsMapModalContainer_module.content,
19
19
  children: /*#__PURE__*/ jsxRuntime.jsx(react$1.ReactFlowProvider, {
@@ -38,12 +38,13 @@ const WMSMapModalContent = ({ editMode, drawingMode, selectedColor, viewMode, co
38
38
  onUpload: onUpload,
39
39
  getFilenameFQDN: getFilenameFQDN,
40
40
  maxFileSizeKB: maxFileSizeKB,
41
- warehouseIds: warehouseIds
41
+ warehouseIds: warehouseIds,
42
+ fitViewOnLoad: fitViewOnLoad
42
43
  })
43
44
  })
44
45
  });
45
46
  };
46
- const WMSMapModalContainer = ({ open, onClose, viewMode = typings.ViewMode.EDIT, colorPalette, showBreadcrumbEditButton, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, debugMode = false, title, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds })=>{
47
+ const WMSMapModalContainer = ({ open, onClose, viewMode = typings.ViewMode.EDIT, colorPalette, showBreadcrumbEditButton, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, debugMode = false, title, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds, fitViewOnLoad = true })=>{
47
48
  const [editMode, setEditMode] = React.useState(typings.EditMode.BACKGROUND);
48
49
  const [drawingMode, setDrawingMode] = React.useState(typings.DrawingMode.NONE);
49
50
  const [selectedColor, setSelectedColor] = React.useState(()=>{
@@ -121,7 +122,8 @@ const WMSMapModalContainer = ({ open, onClose, viewMode = typings.ViewMode.EDIT,
121
122
  onUpload: onUpload,
122
123
  getFilenameFQDN: getFilenameFQDN,
123
124
  maxFileSizeKB: maxFileSizeKB,
124
- warehouseIds: warehouseIds
125
+ warehouseIds: warehouseIds,
126
+ fitViewOnLoad: fitViewOnLoad
125
127
  })
126
128
  });
127
129
  };
@@ -1,5 +1,5 @@
1
1
  import React, { FC } from 'react';
2
2
  import { WMSMapContentProps, WMSMapModalProps } from '../../types/index.cjs';
3
- export declare const WMSMapModalContent: ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds, }: WMSMapContentProps) => React.JSX.Element;
3
+ export declare const WMSMapModalContent: ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds, fitViewOnLoad, }: WMSMapContentProps) => React.JSX.Element;
4
4
  declare const WMSMapModalContainer: FC<WMSMapModalProps>;
5
5
  export default WMSMapModalContainer;
@@ -1,5 +1,5 @@
1
1
  import React, { FC } from 'react';
2
2
  import { WMSMapContentProps, WMSMapModalProps } from '../../types/index.js';
3
- export declare const WMSMapModalContent: ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds, }: WMSMapContentProps) => React.JSX.Element;
3
+ export declare const WMSMapModalContent: ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds, fitViewOnLoad, }: WMSMapContentProps) => React.JSX.Element;
4
4
  declare const WMSMapModalContainer: FC<WMSMapModalProps>;
5
5
  export default WMSMapModalContainer;
@@ -9,7 +9,7 @@ import WMSMapContent from './wms-map-content.js';
9
9
  import { setDebugMode } from '../../utils/debug-logger.js';
10
10
  import styles from './wms-map-modal-container.module.scss.js';
11
11
 
12
- const WMSMapModalContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds })=>{
12
+ const WMSMapModalContent = ({ editMode, drawingMode, selectedColor, viewMode, colorPalette, showBreadcrumbEditButton, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onColorChange, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds, fitViewOnLoad = true })=>{
13
13
  return /*#__PURE__*/ jsx("div", {
14
14
  className: styles.content,
15
15
  children: /*#__PURE__*/ jsx(ReactFlowProvider, {
@@ -34,12 +34,13 @@ const WMSMapModalContent = ({ editMode, drawingMode, selectedColor, viewMode, co
34
34
  onUpload: onUpload,
35
35
  getFilenameFQDN: getFilenameFQDN,
36
36
  maxFileSizeKB: maxFileSizeKB,
37
- warehouseIds: warehouseIds
37
+ warehouseIds: warehouseIds,
38
+ fitViewOnLoad: fitViewOnLoad
38
39
  })
39
40
  })
40
41
  });
41
42
  };
42
- const WMSMapModalContainer = ({ open, onClose, viewMode = ViewMode.EDIT, colorPalette, showBreadcrumbEditButton, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, debugMode = false, title, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds })=>{
43
+ const WMSMapModalContainer = ({ open, onClose, viewMode = ViewMode.EDIT, colorPalette, showBreadcrumbEditButton, onNodeClick, onNodeDoubleClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, debugMode = false, title, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds, fitViewOnLoad = true })=>{
43
44
  const [editMode, setEditMode] = useState(EditMode.BACKGROUND);
44
45
  const [drawingMode, setDrawingMode] = useState(DrawingMode.NONE);
45
46
  const [selectedColor, setSelectedColor] = useState(()=>{
@@ -117,7 +118,8 @@ const WMSMapModalContainer = ({ open, onClose, viewMode = ViewMode.EDIT, colorPa
117
118
  onUpload: onUpload,
118
119
  getFilenameFQDN: getFilenameFQDN,
119
120
  maxFileSizeKB: maxFileSizeKB,
120
- warehouseIds: warehouseIds
121
+ warehouseIds: warehouseIds,
122
+ fitViewOnLoad: fitViewOnLoad
121
123
  })
122
124
  });
123
125
  };
@@ -206,8 +206,6 @@ const ImageNode$1 = ({ data, selected, id, editMode, viewMode, showBackground =
206
206
  style: {
207
207
  width: `${currentSize.width}px`,
208
208
  height: `${currentSize.height}px`,
209
- maxWidth: '100%',
210
- maxHeight: '100%',
211
209
  opacity: opacity
212
210
  },
213
211
  draggable: false
@@ -204,8 +204,6 @@ const ImageNode = ({ data, selected, id, editMode, viewMode, showBackground = tr
204
204
  style: {
205
205
  width: `${currentSize.width}px`,
206
206
  height: `${currentSize.height}px`,
207
- maxWidth: '100%',
208
- maxHeight: '100%',
209
207
  opacity: opacity
210
208
  },
211
209
  draggable: false
@@ -10,11 +10,12 @@ var useContextMenu = require('../../hooks/use-context-menu.cjs');
10
10
  var useTextEditing = require('../../hooks/use-text-editing.cjs');
11
11
  var nodeOperations = require('../../utils/node-operations.cjs');
12
12
  var colorUtils = require('../../utils/color-utils.cjs');
13
+ var previewHighlight = require('../../utils/preview-highlight.cjs');
13
14
  var contextMenu = require('../ui/context-menu.cjs');
14
15
  var pathNode_module = require('./path-node.module.scss.cjs');
15
16
 
16
17
  const PathNode = ({ data, selected, id, editMode, viewMode, onTextEditComplete, onPathPointsChange, onPathPointDragStateChange, isHovered = false })=>{
17
- const { points = [], color = index.DEFAULT_RECTANGLE_COLOR, strokeWidth = 2, label = index.DEFAULT_PATH_LABEL } = data;
18
+ const { points = [], color = index.DEFAULT_RECTANGLE_COLOR, strokeWidth = 2, label = index.DEFAULT_PATH_LABEL, previewHighlighted = false, previewDimmed = false } = data;
18
19
  // Get React Flow instance for viewport and node operations
19
20
  const { setNodes, getNodes, getViewport } = react.useReactFlow();
20
21
  // Dragging state - optimized for performance
@@ -394,7 +395,7 @@ const PathNode = ({ data, selected, id, editMode, viewMode, onTextEditComplete,
394
395
  style: {
395
396
  width: `${width}px`,
396
397
  height: `${height}px`,
397
- opacity: opacity,
398
+ opacity: previewDimmed ? previewHighlight.PREVIEW_DIMMED_OPACITY : opacity,
398
399
  border: selected && isEditable ? '2px solid #3b82f6' : 'none',
399
400
  borderRadius: '4px',
400
401
  position: 'relative',
@@ -413,9 +414,9 @@ const PathNode = ({ data, selected, id, editMode, viewMode, onTextEditComplete,
413
414
  children: /*#__PURE__*/ jsxRuntime.jsx("path", {
414
415
  d: pathString,
415
416
  stroke: displayColor,
416
- strokeWidth: strokeWidth,
417
+ strokeWidth: previewHighlighted ? Math.max(strokeWidth, previewHighlight.PREVIEW_HIGHLIGHT_STROKE_WIDTH) : strokeWidth,
417
418
  fill: isClosedPath ? displayColor : 'none',
418
- fillOpacity: isClosedPath ? 0.2 : 0,
419
+ fillOpacity: isClosedPath ? previewHighlighted ? 0.45 : 0.2 : 0,
419
420
  strokeLinecap: "round",
420
421
  strokeLinejoin: "round"
421
422
  })
@@ -3,16 +3,17 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useState, useRef, useCallback } from 'react';
4
4
  import { useReactFlow } from '@xyflow/react';
5
5
  import { ViewMode, EditMode } from '../../typings.js';
6
- import { DEFAULT_PATH_LABEL, DEFAULT_RECTANGLE_COLOR, ACTIVE_OPACITY, RECTANGLE_INACTIVE_OPACITY } from '../../constants/index.js';
6
+ import { DEFAULT_RECTANGLE_COLOR, DEFAULT_PATH_LABEL, ACTIVE_OPACITY, RECTANGLE_INACTIVE_OPACITY } from '../../constants/index.js';
7
7
  import { useContextMenu } from '../../hooks/use-context-menu.js';
8
8
  import { useTextEditing } from '../../hooks/use-text-editing.js';
9
9
  import { createPathCopy } from '../../utils/node-operations.js';
10
10
  import { createHoverColor } from '../../utils/color-utils.js';
11
+ import { PREVIEW_DIMMED_OPACITY, PREVIEW_HIGHLIGHT_STROKE_WIDTH } from '../../utils/preview-highlight.js';
11
12
  import ContextMenu from '../ui/context-menu.js';
12
13
  import styles from './path-node.module.scss.js';
13
14
 
14
15
  const PathNode = ({ data, selected, id, editMode, viewMode, onTextEditComplete, onPathPointsChange, onPathPointDragStateChange, isHovered = false })=>{
15
- const { points = [], color = DEFAULT_RECTANGLE_COLOR, strokeWidth = 2, label = DEFAULT_PATH_LABEL } = data;
16
+ const { points = [], color = DEFAULT_RECTANGLE_COLOR, strokeWidth = 2, label = DEFAULT_PATH_LABEL, previewHighlighted = false, previewDimmed = false } = data;
16
17
  // Get React Flow instance for viewport and node operations
17
18
  const { setNodes, getNodes, getViewport } = useReactFlow();
18
19
  // Dragging state - optimized for performance
@@ -392,7 +393,7 @@ const PathNode = ({ data, selected, id, editMode, viewMode, onTextEditComplete,
392
393
  style: {
393
394
  width: `${width}px`,
394
395
  height: `${height}px`,
395
- opacity: opacity,
396
+ opacity: previewDimmed ? PREVIEW_DIMMED_OPACITY : opacity,
396
397
  border: selected && isEditable ? '2px solid #3b82f6' : 'none',
397
398
  borderRadius: '4px',
398
399
  position: 'relative',
@@ -411,9 +412,9 @@ const PathNode = ({ data, selected, id, editMode, viewMode, onTextEditComplete,
411
412
  children: /*#__PURE__*/ jsx("path", {
412
413
  d: pathString,
413
414
  stroke: displayColor,
414
- strokeWidth: strokeWidth,
415
+ strokeWidth: previewHighlighted ? Math.max(strokeWidth, PREVIEW_HIGHLIGHT_STROKE_WIDTH) : strokeWidth,
415
416
  fill: isClosedPath ? displayColor : 'none',
416
- fillOpacity: isClosedPath ? 0.2 : 0,
417
+ fillOpacity: isClosedPath ? previewHighlighted ? 0.45 : 0.2 : 0,
417
418
  strokeLinecap: "round",
418
419
  strokeLinejoin: "round"
419
420
  })