w-flow-vue 1.0.21 → 1.0.22

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.
@@ -43,7 +43,7 @@
43
43
  />
44
44
 
45
45
  <!-- w-flow-vue -->
46
- <script src="https://cdn.jsdelivr.net/npm/w-flow-vue@1.0.21/dist/w-flow-vue.umd.js"></script>
46
+ <script src="https://cdn.jsdelivr.net/npm/w-flow-vue@1.0.22/dist/w-flow-vue.umd.js"></script>
47
47
 
48
48
  <!-- lodash -->
49
49
  <script src="https://cdn.jsdelivr.net/npm/lodash/lodash.min.js"></script>
@@ -43,7 +43,7 @@
43
43
  />
44
44
 
45
45
  <!-- w-flow-vue -->
46
- <script src="https://cdn.jsdelivr.net/npm/w-flow-vue@1.0.21/dist/w-flow-vue.umd.js"></script>
46
+ <script src="https://cdn.jsdelivr.net/npm/w-flow-vue@1.0.22/dist/w-flow-vue.umd.js"></script>
47
47
 
48
48
  <!-- lodash -->
49
49
  <script src="https://cdn.jsdelivr.net/npm/lodash/lodash.min.js"></script>
package/docs/global.html CHANGED
@@ -2354,7 +2354,7 @@ Used when nodes are too close for OrthConnector (tooShort).</p></li></ul></dd>
2354
2354
  <br class="clear">
2355
2355
 
2356
2356
  <footer>
2357
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2357
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2358
2358
  </footer>
2359
2359
 
2360
2360
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -71,7 +71,7 @@
71
71
  <br class="clear">
72
72
 
73
73
  <footer>
74
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
75
75
  </footer>
76
76
 
77
77
  <script>prettyPrint();</script>
@@ -92,7 +92,7 @@ export const CONN_DEFAULTS = {
92
92
  <br class="clear">
93
93
 
94
94
  <footer>
95
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
95
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
96
96
  </footer>
97
97
 
98
98
  <script>prettyPrint();</script>
@@ -342,7 +342,7 @@ function labelAtHalfLength(pts) {
342
342
  <br class="clear">
343
343
 
344
344
  <footer>
345
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
345
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
346
346
  </footer>
347
347
 
348
348
  <script>prettyPrint();</script>
@@ -85,7 +85,7 @@ export default fixSvgNs
85
85
  <br class="clear">
86
86
 
87
87
  <footer>
88
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
88
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
89
89
  </footer>
90
90
 
91
91
  <script>prettyPrint();</script>
@@ -285,7 +285,7 @@ export function snapPosition(position, gridSize) {
285
285
  <br class="clear">
286
286
 
287
287
  <footer>
288
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
288
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
289
289
  </footer>
290
290
 
291
291
  <script>prettyPrint();</script>
@@ -96,7 +96,7 @@ export function generateId() {
96
96
  <br class="clear">
97
97
 
98
98
  <footer>
99
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
99
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
100
100
  </footer>
101
101
 
102
102
  <script>prettyPrint();</script>
@@ -333,7 +333,7 @@ function segmentFallback(sx, sy, tx, ty, sObs, tObs) {
333
333
  <br class="clear">
334
334
 
335
335
  <footer>
336
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
336
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
337
337
  </footer>
338
338
 
339
339
  <script>prettyPrint();</script>
@@ -4186,7 +4186,7 @@ Any value of the wrong type (or an empty string) falls back to the default liste
4186
4186
  <br class="clear">
4187
4187
 
4188
4188
  <footer>
4189
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
4189
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 23 2026 10:05:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
4190
4190
  </footer>
4191
4191
 
4192
4192
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-flow-vue",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "main": "dist/w-flow-vue.umd.js",
5
5
  "dependencies": {
6
6
  "w-component-vue": "^2.5.2",
@@ -377,6 +377,7 @@ export default {
377
377
  document.addEventListener('keyup', this.onKeyUp)
378
378
  document.addEventListener('mousemove', this.onDocMouseMove)
379
379
  document.addEventListener('mouseup', this.onDocMouseUp)
380
+ window.addEventListener('blur', this.onWindowBlur)
380
381
  },
381
382
  beforeDestroy() {
382
383
  if (this._panAnimId) {
@@ -387,6 +388,7 @@ export default {
387
388
  document.removeEventListener('keyup', this.onKeyUp)
388
389
  document.removeEventListener('mousemove', this.onDocMouseMove)
389
390
  document.removeEventListener('mouseup', this.onDocMouseUp)
391
+ window.removeEventListener('blur', this.onWindowBlur)
390
392
  },
391
393
  computed: {
392
394
  widthInp() {
@@ -766,6 +768,8 @@ export default {
766
768
  },
767
769
  onCanvasWheel(event) {
768
770
  if (!this.zoomOnScroll) return
771
+ //滾輪縮放亦為viewport寫入者, 先取消程式動畫避免二者互相覆寫
772
+ this.cancelViewportAnimation()
769
773
  const delta = -event.deltaY * 0.001
770
774
  const currentZoom = this.viewport.zoom
771
775
  // fitView may set zoom below zoomMin; use the current level as the
@@ -789,6 +793,14 @@ export default {
789
793
 
790
794
  // --- Document-level mouse ---
791
795
  onDocMouseMove(event) {
796
+ //按鍵已放開卻仍處於進行中狀態: 代表收尾事件未送達(於瀏覽器視窗外放開/視窗失焦/手勢被原生拖曳接管),
797
+ //此時須主動走既有收尾路徑清除狀態; 只return不清狀態無效, 旗標續留為真下次移動仍會誤判
798
+ if ((event.buttons & 1) === 0) {
799
+ if (this.isPanning || this.isDraggingNode || this.isConnecting || this.isSelecting) {
800
+ this.onDocMouseUp(event)
801
+ }
802
+ return
803
+ }
792
804
  if (this.isPanning) {
793
805
  this.doPan(event)
794
806
  }
@@ -802,6 +814,13 @@ export default {
802
814
  this.doSelection(event)
803
815
  }
804
816
  },
817
+ onWindowBlur() {
818
+ //視窗失焦後不會再收到mouseup與keyup, 於此統一收尾避免狀態黏住
819
+ if (this.isPanning) {
820
+ this.endPan()
821
+ }
822
+ this.keysPressed = {}
823
+ },
805
824
  onDocMouseUp(event) {
806
825
  if (this.isPanning) {
807
826
  this.endPan()
@@ -819,6 +838,8 @@ export default {
819
838
 
820
839
  // --- Pan ---
821
840
  startPan(event) {
841
+ //手動平移優先於程式動畫, 否則二者同時寫viewport而互相覆寫
842
+ this.cancelViewportAnimation()
822
843
  this.isPanning = true
823
844
  this.panStartPos = { x: event.clientX, y: event.clientY }
824
845
  },
@@ -1252,6 +1273,19 @@ export default {
1252
1273
  emitViewportChange() {
1253
1274
  this.$emit('viewport-change', { ...this.viewport })
1254
1275
  },
1276
+ getViewport() {
1277
+ //即時視口: viewport-change僅於手勢結束才發出, 平移途中呼叫端需要當下值時走此方法
1278
+ //(呼叫端若以viewport-change快取之值為基準回寫setViewport, 會於平移途中以過期值覆寫使用者正在進行的平移)
1279
+ let vp = this.viewport
1280
+ return { x: vp.x, y: vp.y, zoom: vp.zoom }
1281
+ },
1282
+ cancelViewportAnimation() {
1283
+ //取消進行中之視口動畫(panToNode), 否則動畫與手動手勢會同時寫入同一個viewport
1284
+ if (this._panAnimId) {
1285
+ cancelAnimationFrame(this._panAnimId)
1286
+ this._panAnimId = null
1287
+ }
1288
+ },
1255
1289
  emitSelectionChange() {
1256
1290
  this.$emit('selection-change', this.getSelectedElements())
1257
1291
  },