@zhangqingcq/vgce 0.0.19 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/style.css +2 -2
- package/dist/vgce.js +15857 -15275
- package/dist/vgce.umd.cjs +82 -129
- package/package.json +4 -6
- package/src/assets/base.less +79 -31
- package/src/assets/icons/delete-gray.svg +1 -0
- package/src/assets/icons/delete.svg +1 -12
- package/src/assets/icons/export.svg +1 -1
- package/src/assets/icons/import.svg +1 -1
- package/src/assets/icons/line-active.svg +1 -0
- package/src/assets/icons/line.svg +1 -0
- package/src/assets/icons/menu-fold.svg +1 -9
- package/src/assets/icons/menu-unfold.svg +1 -9
- package/src/assets/icons/preview.svg +1 -6
- package/src/assets/icons/question.svg +1 -0
- package/src/assets/icons/redo-gray.svg +1 -0
- package/src/assets/icons/redo.svg +1 -8
- package/src/assets/icons/return.svg +1 -8
- package/src/assets/icons/rotate.svg +1 -1
- package/src/assets/icons/save.svg +1 -9
- package/src/assets/icons/undo-gray.svg +1 -0
- package/src/assets/icons/undo.svg +1 -7
- package/src/assets/svgs/sheet-border.svg +1 -0
- package/src/assets/svgs/svg-text.svg +1 -5
- package/src/components/svg-analysis/index.vue +1 -1
- package/src/components/svg-editor/center-panel/index.vue +508 -176
- package/src/components/svg-editor/component-tree/index.vue +4 -0
- package/src/components/svg-editor/connection-line/index.vue +12 -8
- package/src/components/svg-editor/connection-panel/index.vue +121 -181
- package/src/components/svg-editor/handle-panel/index.vue +32 -24
- package/src/components/svg-editor/index.vue +15 -22
- package/src/components/svg-editor/left-panel/index.vue +2 -2
- package/src/components/svg-editor/right-panel/bind-anchor.vue +124 -0
- package/src/components/svg-editor/right-panel/code-edit-modal.vue +1 -1
- package/src/components/svg-editor/right-panel/dynamic-el-form-item.vue +8 -1
- package/src/components/svg-editor/right-panel/index.vue +117 -56
- package/src/components/svg-editor/top-panel/index.vue +109 -25
- package/src/components/svg-viewer/index.vue +31 -21
- package/src/components/vue3-ruler-tool/index.vue +329 -372
- package/src/config/files/clock-a.vue +64 -64
- package/src/config/svg/animation/index.ts +1 -1
- package/src/config/svg/custom/svg-text.ts +2 -2
- package/src/config/svg/stateful/index.ts +1 -1
- package/src/config/svg/stateless/index.ts +3 -2
- package/src/config/svg/stateless/sheet-border.ts +22 -0
- package/src/config/types.ts +1 -0
- package/src/stores/config/index.ts +1 -8
- package/src/stores/config/types.ts +0 -8
- package/src/stores/global/index.ts +0 -10
- package/src/stores/global/types.ts +33 -10
- package/src/stores/svg-edit-layout/index.ts +7 -0
- package/src/stores/svg-edit-layout/types.ts +1 -0
- package/src/utils/index.ts +227 -103
- package/src/utils/scale-core.ts +1 -0
- package/src/views/EditorS.vue +1 -1
- package/types/index.d.ts +4 -6
@@ -20,7 +20,6 @@
|
|
20
20
|
const instance = getCurrentInstance()
|
21
21
|
Object.keys(vueComp).forEach((key: string) => {
|
22
22
|
if (!Object.keys(instance?.appContext?.components as any).includes(key)) {
|
23
|
-
// @ts-ignore
|
24
23
|
instance?.appContext.app.component(key, vueComp[key])
|
25
24
|
}
|
26
25
|
})
|
@@ -37,14 +36,7 @@
|
|
37
36
|
svg: {
|
38
37
|
background_color: '#fff',
|
39
38
|
scale: 1,
|
40
|
-
|
41
|
-
x: -333,
|
42
|
-
y: -113
|
43
|
-
},
|
44
|
-
svg_position_center: {
|
45
|
-
x: 50,
|
46
|
-
y: 50
|
47
|
-
}
|
39
|
+
grid_color: '#ebebeb'
|
48
40
|
},
|
49
41
|
net: {
|
50
42
|
mqtt: {
|
@@ -60,6 +52,7 @@
|
|
60
52
|
)
|
61
53
|
const globalStore = useGlobalStore(pinia)
|
62
54
|
|
55
|
+
const cursor_style = computed(() => (globalStore.intention == EGlobalStoreIntention.MoveCanvas ? 'grab' : 'default'))
|
63
56
|
const onCanvasMouseMove = (e: MouseEvent) => {
|
64
57
|
//如果鼠标不是按下状态 连线除外
|
65
58
|
if (
|
@@ -91,7 +84,7 @@
|
|
91
84
|
if (globalStore.intention != EGlobalStoreIntention.Select) {
|
92
85
|
globalStore.intention = EGlobalStoreIntention.None
|
93
86
|
}
|
94
|
-
globalStore.
|
87
|
+
globalStore.mouse_info = {
|
95
88
|
state: EMouseInfoState.Up,
|
96
89
|
position_x: 0,
|
97
90
|
position_y: 0,
|
@@ -99,14 +92,13 @@
|
|
99
92
|
now_position_y: 0,
|
100
93
|
new_position_x: 0,
|
101
94
|
new_position_y: 0
|
102
|
-
}
|
95
|
+
}
|
103
96
|
}
|
104
97
|
const onCanvasMouseDown = (e: MouseEvent) => {
|
105
|
-
console.log('onCanvasMouseDown', e)
|
106
98
|
const { clientX, clientY } = e
|
107
99
|
//点击画布 未选中组件 拖动画布
|
108
100
|
globalStore.intention = EGlobalStoreIntention.MoveCanvas
|
109
|
-
globalStore.
|
101
|
+
globalStore.mouse_info = {
|
110
102
|
state: EMouseInfoState.Down,
|
111
103
|
position_x: clientX,
|
112
104
|
position_y: clientY,
|
@@ -114,8 +106,19 @@
|
|
114
106
|
now_position_y: preview_data.layout_center.y,
|
115
107
|
new_position_x: preview_data.layout_center.x,
|
116
108
|
new_position_y: preview_data.layout_center.y
|
117
|
-
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
function onMousewheel(e: any) {
|
113
|
+
if (e?.wheelDelta) {
|
114
|
+
if (e.wheelDelta > 0) {
|
115
|
+
preview_data.config.svg.scale = parseFloat((preview_data.config.svg.scale + 0.1).toFixed(1))
|
116
|
+
} else {
|
117
|
+
preview_data.config.svg.scale = parseFloat((preview_data.config.svg.scale - 0.1).toFixed(1))
|
118
|
+
}
|
119
|
+
}
|
118
120
|
}
|
121
|
+
|
119
122
|
const getActualBoundScale = (
|
120
123
|
actual_bound: {
|
121
124
|
x: number
|
@@ -237,7 +240,13 @@
|
|
237
240
|
</script>
|
238
241
|
|
239
242
|
<template>
|
240
|
-
<div
|
243
|
+
<div
|
244
|
+
class="canvas"
|
245
|
+
@mousedown="onCanvasMouseDown"
|
246
|
+
@mousemove="onCanvasMouseMove"
|
247
|
+
@mouseup="onCanvasMouseUp"
|
248
|
+
@mousewheel="onMousewheel"
|
249
|
+
>
|
241
250
|
<svg
|
242
251
|
xmlns="http://www.w3.org/2000/svg"
|
243
252
|
:style="{ backgroundColor: preview_data.config.svg.background_color }"
|
@@ -245,9 +254,9 @@
|
|
245
254
|
height="100%"
|
246
255
|
>
|
247
256
|
<g
|
248
|
-
:transform="`translate(${preview_data.
|
249
|
-
preview_data.config.svg.
|
250
|
-
})
|
257
|
+
:transform="`translate(${preview_data.layout_center.x},${preview_data.layout_center.y})rotate(${0})scale(${
|
258
|
+
preview_data.config.svg.scale
|
259
|
+
})`"
|
251
260
|
>
|
252
261
|
<g
|
253
262
|
v-for="item in preview_data.done_json"
|
@@ -326,24 +335,25 @@
|
|
326
335
|
.canvas {
|
327
336
|
width: 100%;
|
328
337
|
height: 100vh;
|
338
|
+
cursor: v-bind('cursor_style');
|
329
339
|
}
|
330
340
|
|
331
341
|
.svg-item-none {
|
332
342
|
cursor: move;
|
333
343
|
|
334
344
|
&:hover {
|
335
|
-
outline: 1px solid #
|
345
|
+
outline: 1px solid #f8d032;
|
336
346
|
}
|
337
347
|
}
|
338
348
|
|
339
349
|
.svg-item-move {
|
340
350
|
cursor: move;
|
341
|
-
outline: 1px dashed rgb(23, 222
|
351
|
+
outline: 1px dashed rgb(149, 23, 222);
|
342
352
|
}
|
343
353
|
|
344
354
|
.svg-item-select {
|
345
355
|
cursor: move;
|
346
|
-
outline: 1px solid rgb(23, 222
|
356
|
+
outline: 1px solid rgb(149, 23, 222);
|
347
357
|
}
|
348
358
|
|
349
359
|
.common-ani {
|