@dineug/erd-editor 5.0.0 → 5.0.1
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/LICENSE +1 -1
- package/dist/components/erd/canvas/stagePressScope.d.ts +1 -1
- package/dist/components/erd/canvas/stagePressScope.js +41 -14
- package/dist/erd-editor.umd.js +504 -504
- package/dist/erd-viewer.umd.js +109 -109
- package/dist/services/elk-layout/index.js +1 -1
- package/dist/services/export-png/index.js +1 -1
- package/dist/services/shiki/index.js +1 -1
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2019-present SeungHwan-Lee
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Stage } from 'konva/lib/Stage';
|
|
2
2
|
/**
|
|
3
|
-
* Forgets the shapes a stage was last pressed and lifted on
|
|
3
|
+
* Forgets the shapes a stage was last pressed and lifted on after a press starts
|
|
4
4
|
* anywhere else, so a click and a double click need their presses on this one:
|
|
5
5
|
* konva arms both on every stage of its copy, wherever the press landed.
|
|
6
6
|
*
|
|
@@ -1,22 +1,49 @@
|
|
|
1
1
|
//#region src/components/erd/canvas/stagePressScope.ts
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var PRESSES = [
|
|
3
|
+
[
|
|
4
|
+
"mousedown",
|
|
5
|
+
"mouseup",
|
|
6
|
+
"mouse"
|
|
7
|
+
],
|
|
8
|
+
[
|
|
9
|
+
"pointerdown",
|
|
10
|
+
"pointerup",
|
|
11
|
+
"pointer"
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
"touchstart",
|
|
15
|
+
"touchend",
|
|
16
|
+
"touch"
|
|
17
|
+
]
|
|
18
|
+
];
|
|
19
|
+
function listen(target, type, listener) {
|
|
20
|
+
target.addEventListener(type, listener, {
|
|
21
|
+
capture: true,
|
|
22
|
+
passive: true
|
|
23
|
+
});
|
|
24
|
+
return () => target.removeEventListener(type, listener, { capture: true });
|
|
25
|
+
}
|
|
7
26
|
function scopeClicksToStage(stage) {
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
27
|
+
const { content } = stage;
|
|
28
|
+
const view = content.ownerDocument.defaultView ?? window;
|
|
29
|
+
const removes = PRESSES.flatMap(([press, lift, kind]) => {
|
|
30
|
+
let elsewhere = false;
|
|
31
|
+
const forget = () => {
|
|
12
32
|
Reflect.set(stage, `${kind}ClickStartShape`, void 0);
|
|
13
33
|
Reflect.set(stage, `${kind}ClickEndShape`, void 0);
|
|
14
34
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
return [
|
|
36
|
+
listen(view, press, () => {
|
|
37
|
+
if (elsewhere) forget();
|
|
38
|
+
elsewhere = true;
|
|
39
|
+
}),
|
|
40
|
+
listen(content, press, () => {
|
|
41
|
+
elsewhere = false;
|
|
42
|
+
}),
|
|
43
|
+
listen(content, lift, () => {
|
|
44
|
+
if (elsewhere) forget();
|
|
45
|
+
})
|
|
46
|
+
];
|
|
20
47
|
});
|
|
21
48
|
return () => removes.forEach((remove) => remove());
|
|
22
49
|
}
|