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.
- package/README.md +1 -1
- package/dist/w-flow-vue.umd.js +2 -2
- package/dist/w-flow-vue.umd.js.map +1 -1
- package/docs/components_WFlowVue.vue.html +35 -1
- package/docs/components_ui_Controls.vue.html +1 -1
- package/docs/examples/app.html +1 -1
- package/docs/examples/app.umd.js +3 -3
- package/docs/examples/app.umd.js.map +1 -1
- package/docs/examples/ex-AppBasic.html +1 -1
- package/docs/examples/ex-AppConnectivity.html +1 -1
- package/docs/global.html +1 -1
- package/docs/index.html +1 -1
- package/docs/js_defaults.mjs.html +1 -1
- package/docs/js_edgePath.mjs.html +1 -1
- package/docs/js_fixSvgNs.mjs.html +1 -1
- package/docs/js_geometry.mjs.html +1 -1
- package/docs/js_graph.mjs.html +1 -1
- package/docs/js_stepRouting.mjs.html +1 -1
- package/docs/module-WFlowVue.html +1 -1
- package/package.json +1 -1
- package/src/components/WFlowVue.vue +34 -0
|
@@ -424,6 +424,7 @@ export default {
|
|
|
424
424
|
document.addEventListener('keyup', this.onKeyUp)
|
|
425
425
|
document.addEventListener('mousemove', this.onDocMouseMove)
|
|
426
426
|
document.addEventListener('mouseup', this.onDocMouseUp)
|
|
427
|
+
window.addEventListener('blur', this.onWindowBlur)
|
|
427
428
|
},
|
|
428
429
|
beforeDestroy() {
|
|
429
430
|
if (this._panAnimId) {
|
|
@@ -434,6 +435,7 @@ export default {
|
|
|
434
435
|
document.removeEventListener('keyup', this.onKeyUp)
|
|
435
436
|
document.removeEventListener('mousemove', this.onDocMouseMove)
|
|
436
437
|
document.removeEventListener('mouseup', this.onDocMouseUp)
|
|
438
|
+
window.removeEventListener('blur', this.onWindowBlur)
|
|
437
439
|
},
|
|
438
440
|
computed: {
|
|
439
441
|
widthInp() {
|
|
@@ -813,6 +815,8 @@ export default {
|
|
|
813
815
|
},
|
|
814
816
|
onCanvasWheel(event) {
|
|
815
817
|
if (!this.zoomOnScroll) return
|
|
818
|
+
//滾輪縮放亦為viewport寫入者, 先取消程式動畫避免二者互相覆寫
|
|
819
|
+
this.cancelViewportAnimation()
|
|
816
820
|
const delta = -event.deltaY * 0.001
|
|
817
821
|
const currentZoom = this.viewport.zoom
|
|
818
822
|
// fitView may set zoom below zoomMin; use the current level as the
|
|
@@ -836,6 +840,14 @@ export default {
|
|
|
836
840
|
|
|
837
841
|
// --- Document-level mouse ---
|
|
838
842
|
onDocMouseMove(event) {
|
|
843
|
+
//按鍵已放開卻仍處於進行中狀態: 代表收尾事件未送達(於瀏覽器視窗外放開/視窗失焦/手勢被原生拖曳接管),
|
|
844
|
+
//此時須主動走既有收尾路徑清除狀態; 只return不清狀態無效, 旗標續留為真下次移動仍會誤判
|
|
845
|
+
if ((event.buttons & 1) === 0) {
|
|
846
|
+
if (this.isPanning || this.isDraggingNode || this.isConnecting || this.isSelecting) {
|
|
847
|
+
this.onDocMouseUp(event)
|
|
848
|
+
}
|
|
849
|
+
return
|
|
850
|
+
}
|
|
839
851
|
if (this.isPanning) {
|
|
840
852
|
this.doPan(event)
|
|
841
853
|
}
|
|
@@ -849,6 +861,13 @@ export default {
|
|
|
849
861
|
this.doSelection(event)
|
|
850
862
|
}
|
|
851
863
|
},
|
|
864
|
+
onWindowBlur() {
|
|
865
|
+
//視窗失焦後不會再收到mouseup與keyup, 於此統一收尾避免狀態黏住
|
|
866
|
+
if (this.isPanning) {
|
|
867
|
+
this.endPan()
|
|
868
|
+
}
|
|
869
|
+
this.keysPressed = {}
|
|
870
|
+
},
|
|
852
871
|
onDocMouseUp(event) {
|
|
853
872
|
if (this.isPanning) {
|
|
854
873
|
this.endPan()
|
|
@@ -866,6 +885,8 @@ export default {
|
|
|
866
885
|
|
|
867
886
|
// --- Pan ---
|
|
868
887
|
startPan(event) {
|
|
888
|
+
//手動平移優先於程式動畫, 否則二者同時寫viewport而互相覆寫
|
|
889
|
+
this.cancelViewportAnimation()
|
|
869
890
|
this.isPanning = true
|
|
870
891
|
this.panStartPos = { x: event.clientX, y: event.clientY }
|
|
871
892
|
},
|
|
@@ -1299,6 +1320,19 @@ export default {
|
|
|
1299
1320
|
emitViewportChange() {
|
|
1300
1321
|
this.$emit('viewport-change', { ...this.viewport })
|
|
1301
1322
|
},
|
|
1323
|
+
getViewport() {
|
|
1324
|
+
//即時視口: viewport-change僅於手勢結束才發出, 平移途中呼叫端需要當下值時走此方法
|
|
1325
|
+
//(呼叫端若以viewport-change快取之值為基準回寫setViewport, 會於平移途中以過期值覆寫使用者正在進行的平移)
|
|
1326
|
+
let vp = this.viewport
|
|
1327
|
+
return { x: vp.x, y: vp.y, zoom: vp.zoom }
|
|
1328
|
+
},
|
|
1329
|
+
cancelViewportAnimation() {
|
|
1330
|
+
//取消進行中之視口動畫(panToNode), 否則動畫與手動手勢會同時寫入同一個viewport
|
|
1331
|
+
if (this._panAnimId) {
|
|
1332
|
+
cancelAnimationFrame(this._panAnimId)
|
|
1333
|
+
this._panAnimId = null
|
|
1334
|
+
}
|
|
1335
|
+
},
|
|
1302
1336
|
emitSelectionChange() {
|
|
1303
1337
|
this.$emit('selection-change', this.getSelectedElements())
|
|
1304
1338
|
},
|
|
@@ -1449,7 +1483,7 @@ export default {
|
|
|
1449
1483
|
<br class="clear">
|
|
1450
1484
|
|
|
1451
1485
|
<footer>
|
|
1452
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
1486
|
+
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.
|
|
1453
1487
|
</footer>
|
|
1454
1488
|
|
|
1455
1489
|
<script>prettyPrint();</script>
|
|
@@ -265,7 +265,7 @@ export default {
|
|
|
265
265
|
<br class="clear">
|
|
266
266
|
|
|
267
267
|
<footer>
|
|
268
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
268
|
+
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.
|
|
269
269
|
</footer>
|
|
270
270
|
|
|
271
271
|
<script>prettyPrint();</script>
|
package/docs/examples/app.html
CHANGED