@affino/diagram-vue 0.5.0 → 0.7.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.
package/README.md
CHANGED
|
@@ -90,6 +90,10 @@ For DOM overlays call `getDomEntityStyle(entity, viewport.viewport.value)`; text
|
|
|
90
90
|
|
|
91
91
|
Preview geometry remains transient until pointerup. Start endpoint gestures with `interaction.beginEdgeEndpointHandle(handle.ownerId, "source" | "target", event)` and render `interaction.getPreviewGeometry(edgeId)` while the gesture is active. Entity IDs are opaque strings and may contain `:`. Use `handle.ownerId`, never parse `handle.id`. Escape/pointercancel cancels without history; pointerup commits one undo operation.
|
|
92
92
|
|
|
93
|
+
`useDiagramPointerController()` accepts `snap` options for grid spacing, port snapping, alignment, equal spacing, and screen pixel tolerance. Its `state.value.snapGuides` contains world-space line segments for currently active alignment and equal-spacing matches and clears when the gesture ends.
|
|
94
|
+
|
|
95
|
+
During selection drags, holding Shift constrains movement to the dominant axis from the gesture origin. The Vue pointer adapter forwards `shiftKey` to core on pointer events, so releasing Shift restores free movement during the same drag.
|
|
96
|
+
|
|
93
97
|
### Migration from 0.1.0
|
|
94
98
|
|
|
95
99
|
- Replace `viewBox.width = viewport.width / viewport.zoom` and the corresponding height formula with raw world `viewport.width` and `viewport.height`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ShallowRef } from "vue";
|
|
2
|
-
import { type DiagramInteractionController, type DiagramInteractionSnapshot, type DiagramInteractionTool, type DiagramPoint } from "@affino/diagram-core";
|
|
2
|
+
import { type DiagramInteractionController, type DiagramInteractionSnapOptions, type DiagramInteractionSnapshot, type DiagramInteractionTool, type DiagramPoint } from "@affino/diagram-core";
|
|
3
3
|
import type { DiagramEngineController } from "./useDiagramEngine.js";
|
|
4
4
|
export type DiagramPointerController = Readonly<{
|
|
5
5
|
interaction: DiagramInteractionController;
|
|
@@ -17,6 +17,7 @@ export type DiagramPointerControllerOptions = Readonly<{
|
|
|
17
17
|
toWorldPoint?: (event: PointerEvent) => DiagramPoint;
|
|
18
18
|
setPointerCapture?: (event: PointerEvent) => void;
|
|
19
19
|
releasePointerCapture?: (event: PointerEvent) => void;
|
|
20
|
+
snap?: DiagramInteractionSnapOptions;
|
|
20
21
|
}>;
|
|
21
22
|
export declare function useDiagramPointerController(controller: DiagramEngineController, options?: DiagramPointerControllerOptions): DiagramPointerController;
|
|
22
23
|
//# sourceMappingURL=useDiagramPointerController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDiagramPointerController.d.ts","sourceRoot":"","sources":["../src/useDiagramPointerController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACrC,OAAO,EAAsC,KAAK,4BAA4B,EAAE,KAAK,0BAA0B,EAAE,KAAK,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"useDiagramPointerController.d.ts","sourceRoot":"","sources":["../src/useDiagramPointerController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACrC,OAAO,EAAsC,KAAK,4BAA4B,EAAE,KAAK,6BAA6B,EAAE,KAAK,0BAA0B,EAAE,KAAK,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACjO,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAEpE,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,WAAW,EAAE,4BAA4B,CAAA;IACzC,KAAK,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAA;IAC7C,OAAO,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,IAAI,CAAA;IAC/C,kBAAkB,EAAE,MAAM;QACxB,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;QAC5C,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;QAC5C,WAAW,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;QAC1C,eAAe,EAAE,MAAM,IAAI,CAAA;KAC5B,CAAA;IACD,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAC,CAAA;AAEF,MAAM,MAAM,+BAA+B,GAAG,QAAQ,CAAC;IACrD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY,CAAA;IACpD,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;IACjD,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;IACrD,IAAI,CAAC,EAAE,6BAA6B,CAAA;CACrC,CAAC,CAAA;AAEF,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,uBAAuB,EAAE,OAAO,GAAE,+BAAoC,GAAG,wBAAwB,CAqExJ"}
|
|
@@ -3,6 +3,7 @@ import { createDiagramInteractionController } from "@affino/diagram-core";
|
|
|
3
3
|
export function useDiagramPointerController(controller, options = {}) {
|
|
4
4
|
let refresh = () => { };
|
|
5
5
|
const interaction = createDiagramInteractionController(controller.engine, {
|
|
6
|
+
snap: options.snap,
|
|
6
7
|
scheduleFrame: (callback) => {
|
|
7
8
|
const schedule = typeof globalThis.requestAnimationFrame === "function"
|
|
8
9
|
? globalThis.requestAnimationFrame.bind(globalThis)
|
|
@@ -78,6 +79,7 @@ function sameSnapshot(previous, next) {
|
|
|
78
79
|
&& previous.resizePreview === next.resizePreview
|
|
79
80
|
&& previous.resizePreviewEntries === next.resizePreviewEntries
|
|
80
81
|
&& previous.edgeEndpointPreview === next.edgeEndpointPreview
|
|
82
|
+
&& previous.snapGuides === next.snapGuides
|
|
81
83
|
&& previous.marquee === next.marquee;
|
|
82
84
|
}
|
|
83
85
|
function toWorldPoint(event, mapper) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@affino/diagram-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"author": "Anton Pavlov <a.pavlov@affino.dev>",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Vue adapter for @affino/diagram-core",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"vue": "^3.3.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@affino/diagram-core": "^0.
|
|
24
|
+
"@affino/diagram-core": "^0.9.0"
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|