@zhangqingcq/vgce 0.0.19 → 0.0.21

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.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/dist/style.css +2 -2
  3. package/dist/vgce.js +15857 -15275
  4. package/dist/vgce.umd.cjs +82 -129
  5. package/package.json +4 -6
  6. package/src/assets/base.less +79 -31
  7. package/src/assets/icons/delete-gray.svg +1 -0
  8. package/src/assets/icons/delete.svg +1 -12
  9. package/src/assets/icons/export.svg +1 -1
  10. package/src/assets/icons/import.svg +1 -1
  11. package/src/assets/icons/line-active.svg +1 -0
  12. package/src/assets/icons/line.svg +1 -0
  13. package/src/assets/icons/menu-fold.svg +1 -9
  14. package/src/assets/icons/menu-unfold.svg +1 -9
  15. package/src/assets/icons/preview.svg +1 -6
  16. package/src/assets/icons/question.svg +1 -0
  17. package/src/assets/icons/redo-gray.svg +1 -0
  18. package/src/assets/icons/redo.svg +1 -8
  19. package/src/assets/icons/return.svg +1 -8
  20. package/src/assets/icons/rotate.svg +1 -1
  21. package/src/assets/icons/save.svg +1 -9
  22. package/src/assets/icons/undo-gray.svg +1 -0
  23. package/src/assets/icons/undo.svg +1 -7
  24. package/src/assets/svgs/sheet-border.svg +1 -0
  25. package/src/assets/svgs/svg-text.svg +1 -5
  26. package/src/components/svg-analysis/index.vue +1 -1
  27. package/src/components/svg-editor/center-panel/index.vue +508 -176
  28. package/src/components/svg-editor/component-tree/index.vue +4 -0
  29. package/src/components/svg-editor/connection-line/index.vue +12 -8
  30. package/src/components/svg-editor/connection-panel/index.vue +121 -181
  31. package/src/components/svg-editor/handle-panel/index.vue +32 -24
  32. package/src/components/svg-editor/index.vue +15 -22
  33. package/src/components/svg-editor/left-panel/index.vue +2 -2
  34. package/src/components/svg-editor/right-panel/bind-anchor.vue +124 -0
  35. package/src/components/svg-editor/right-panel/code-edit-modal.vue +1 -1
  36. package/src/components/svg-editor/right-panel/dynamic-el-form-item.vue +8 -1
  37. package/src/components/svg-editor/right-panel/index.vue +117 -56
  38. package/src/components/svg-editor/top-panel/index.vue +109 -25
  39. package/src/components/svg-viewer/index.vue +31 -21
  40. package/src/components/vue3-ruler-tool/index.vue +329 -372
  41. package/src/config/files/clock-a.vue +64 -64
  42. package/src/config/svg/animation/index.ts +1 -1
  43. package/src/config/svg/custom/svg-text.ts +2 -2
  44. package/src/config/svg/stateful/index.ts +1 -1
  45. package/src/config/svg/stateless/index.ts +3 -2
  46. package/src/config/svg/stateless/sheet-border.ts +22 -0
  47. package/src/config/types.ts +1 -0
  48. package/src/stores/config/index.ts +1 -8
  49. package/src/stores/config/types.ts +0 -8
  50. package/src/stores/global/index.ts +0 -10
  51. package/src/stores/global/types.ts +33 -10
  52. package/src/stores/svg-edit-layout/index.ts +7 -0
  53. package/src/stores/svg-edit-layout/types.ts +1 -0
  54. package/src/utils/index.ts +227 -103
  55. package/src/utils/scale-core.ts +1 -0
  56. package/src/views/EditorS.vue +1 -1
  57. 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
- position_center: {
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.setMouseInfo({
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.setMouseInfo({
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 class="canvas" @mousedown="onCanvasMouseDown" @mousemove="onCanvasMouseMove" @mouseup="onCanvasMouseUp">
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.config.svg.position_center.x + preview_data.layout_center.x},${
249
- preview_data.config.svg.position_center.y + preview_data.layout_center.y
250
- })rotate(${0})scale(${preview_data.config.svg.scale})`"
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 #0cf;
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, 30);
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, 30);
356
+ outline: 1px solid rgb(149, 23, 222);
347
357
  }
348
358
 
349
359
  .common-ani {