@zhangqingcq/vgce 0.1.29 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangqingcq/vgce",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Vector graphics configure editor. svg组态编辑器。基于vue3.3+ts+element-plus+vite",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -11,15 +11,15 @@
11
11
  getCenterPoint,
12
12
  getCommonClass,
13
13
  getSvgNowPosition,
14
+ getZoomPosition,
14
15
  moveAnchors,
15
16
  moveHandlePoint,
17
+ myFixed,
16
18
  objectDeepClone,
17
19
  prosToVBind,
18
20
  randomString,
19
21
  resetHandlePointOld,
20
- setSvgActualInfo,
21
- getZoomPosition,
22
- myFixed
22
+ setSvgActualInfo
23
23
  } from '@/utils'
24
24
  import {
25
25
  calculateBottom,
@@ -33,8 +33,7 @@
33
33
  } from '@/utils/scale-core'
34
34
  import HandlePanel from '@/components/svg-editor/handle-panel.vue'
35
35
  import ConnectionPanel from '@/components/svg-editor/connection-panel.vue'
36
- import type { IConfigItem } from '@/config/types'
37
- import { EDoneJsonType } from '@/config/types'
36
+ import { EDoneJsonType, type IConfigItem } from '@/config/types'
38
37
  import ConnectionLine from '@/components/svg-editor/connection-line.vue'
39
38
  import type { IVisibleInfo } from '../config'
40
39
  import { useContextMenuStore, useEditPrivateStore } from '@/stores/system'
@@ -207,11 +206,15 @@
207
206
  canvasRef.value?.focus()
208
207
  if (globalStore.intention === EGlobalStoreIntention.Connection) {
209
208
  e.stopPropagation()
209
+ if (!globalStore.handle_svg_info) {
210
+ //空白地方画线
211
+ createLine(e)
212
+ }
210
213
  if (globalStore.handle_svg_info) {
211
214
  if (e.button === 0) {
212
215
  //鼠标左键创建新线段
213
216
  const l = globalStore.handle_svg_info.info.props.point_position.val
214
- if (l.length > 1 && l[0].x !== l[1].x && l[0].y !== l[1].y) {
217
+ if (l.length !== 1 && select_item?.type !== EDoneJsonType.ConnectionLine) {
215
218
  //鼠标移动后的实时位置(相对于起始点,只在创建第一个点时记录了鼠标原始位置)
216
219
  l.push({
217
220
  x:
@@ -223,6 +226,12 @@
223
226
  globalStore.mouse_info.position_y -
224
227
  svgEditLayoutStore.center_offset.y
225
228
  })
229
+ } else {
230
+ //第二个点,在鼠标没有移动的情况下,就是起始点
231
+ globalStore.handle_svg_info.info.props.point_position.val.push({
232
+ x: 0,
233
+ y: 0
234
+ })
226
235
  }
227
236
  } else if (e.button === 2) {
228
237
  //鼠标右键结束线段绘制
@@ -105,6 +105,7 @@
105
105
  }
106
106
  }
107
107
  const bindAnchor = (e: any, type: ELineBindAnchors) => {
108
+ e.stopPropagation()
108
109
  if (globalStore.intention === EGlobalStoreIntention.None) {
109
110
  createLine(e, type, props.itemInfo)
110
111
  if (globalStore.handle_svg_info) {
@@ -67,7 +67,6 @@
67
67
 
68
68
  const canZoom = computed(() => props.itemInfo.config.can_zoom)
69
69
  const onHandleMouseDown = (type: EScaleInfoType, e: MouseEvent) => {
70
- console.log('handMousedown', e)
71
70
  const { clientX, clientY } = e
72
71
  e.stopPropagation()
73
72
  globalStore.intention = EGlobalStoreIntention.Zoom
@@ -36,6 +36,11 @@
36
36
  set(v: any) {
37
37
  globalStore.intention = v ? EGlobalStoreIntention.Connection : EGlobalStoreIntention.None
38
38
  if (v) {
39
+ globalStore.done_json.forEach((e: Record<string, any>) => {
40
+ if (e?.selected) {
41
+ e.selected = false
42
+ }
43
+ })
39
44
  globalStore.setHandleSvgInfo(null)
40
45
  }
41
46
  }
@@ -157,16 +162,16 @@
157
162
  <el-scrollbar max-height="60vh">
158
163
  <div class="font-bold mb-10px text-15px guide-title" style="padding-top: 16px">多选</div>
159
164
  <div
160
- >在画布空白区域按住鼠标左键可以框选(图形中心点在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选</div
161
- >
165
+ >在画布空白区域按住鼠标左键可以框选(图形中心点在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选
166
+ </div>
162
167
  <div class="el-divider el-divider--horizontal" role="separator" style="--el-border-style: solid"></div>
163
168
  <div class="font-bold mb-10px text-15px guide-title">拖动画布</div>
164
169
  <div>在画布空白区域按住右键可拖动画布,右侧面板‘图纸’栏可微调或重置位置</div>
165
170
  <div class="el-divider el-divider--horizontal" role="separator" style="--el-border-style: solid"></div>
166
171
  <div class="font-bold mb-10px text-15px guide-title">画布缩放</div>
167
172
  <div
168
- >在画布中使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放,鼠标滚轮以鼠标位置为缩放中心,图纸栏以图纸原点(默认在左上角)为缩放中心</div
169
- >
173
+ >在画布中使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放,鼠标滚轮以鼠标位置为缩放中心,图纸栏以图纸原点(默认在左上角)为缩放中心
174
+ </div>
170
175
  <div class="el-divider el-divider--horizontal" role="separator" style="--el-border-style: solid"></div>
171
176
  <div class="font-bold mb-10px text-15px guide-title">标尺辅助线</div>
172
177
  <div>在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线</div>
@@ -19,7 +19,7 @@ const t: IConfigItem = {
19
19
  val: [
20
20
  {
21
21
  prop: 'date',
22
- label: '第一列',
22
+ label: '序号',
23
23
  width: '120px',
24
24
  fixed: false,
25
25
  sortable: false,
@@ -27,7 +27,7 @@ const t: IConfigItem = {
27
27
  },
28
28
  {
29
29
  prop: 'name',
30
- label: '第二列',
30
+ label: '名字',
31
31
  width: '120px',
32
32
  fixed: false,
33
33
  sortable: false,
@@ -35,7 +35,7 @@ const t: IConfigItem = {
35
35
  },
36
36
  {
37
37
  prop: 'address',
38
- label: '第三列测试',
38
+ label: '年龄',
39
39
  width: '280px',
40
40
  fixed: false,
41
41
  sortable: false,
@@ -48,31 +48,31 @@ const t: IConfigItem = {
48
48
  type: EConfigItemPropsType.JsonEdit,
49
49
  val: [
50
50
  {
51
- date: '2016-05-03',
52
- name: 'Tom',
53
- address: 'No. 189, Grove St, Los Angeles'
51
+ date: '1',
52
+ name: 'Jack',
53
+ address: '34'
54
54
  },
55
55
  {
56
- date: '2016-05-02',
57
- name: 'Tom',
58
- address: 'No. 189, Grove St, Los Angeles'
56
+ date: '2',
57
+ name: 'Marry',
58
+ address: '18'
59
59
  },
60
60
  {
61
- date: '2016-05-04',
62
- name: 'Tom',
63
- address: 'No. 189, Grove St, Los Angeles'
61
+ date: '3',
62
+ name: 'Lee',
63
+ address: '23'
64
64
  },
65
65
  {
66
- date: '2016-05-01',
67
- name: 'Tom',
68
- address: 'No. 189, Grove St, Los Angeles'
66
+ date: '4',
67
+ name: 'Steve',
68
+ address: '31'
69
69
  }
70
70
  ]
71
71
  },
72
72
  width: {
73
73
  title: '宽度',
74
74
  type: EConfigItemPropsType.InputNumber,
75
- val: 500
75
+ val: 350
76
76
  },
77
77
  height: {
78
78
  title: '高度',
@@ -28,24 +28,24 @@ const t: IConfigItem = {
28
28
  type: EConfigItemPropsType.JsonEdit,
29
29
  val: [
30
30
  {
31
- value: 1048,
32
- name: '办公楼A'
31
+ value: 998,
32
+ name: '20岁以下'
33
33
  },
34
34
  {
35
- value: 735,
36
- name: '办公楼B'
35
+ value: 546,
36
+ name: '20-40岁'
37
37
  },
38
38
  {
39
- value: 580,
40
- name: '保安室'
39
+ value: 354,
40
+ name: '40-60岁'
41
41
  },
42
42
  {
43
- value: 484,
44
- name: '地下车库'
43
+ value: 421,
44
+ name: '60-70岁'
45
45
  },
46
46
  {
47
- value: 300,
48
- name: '食堂'
47
+ value: 607,
48
+ name: '70岁以上'
49
49
  }
50
50
  ]
51
51
  }
@@ -29,7 +29,6 @@ export const useEditPrivateStore = defineStore('edit-private-store', {
29
29
  },
30
30
  actions: {
31
31
  topUndoBtnClick() {
32
- console.log('撤销')
33
32
  if (this.history_now_index < 1) {
34
33
  return
35
34
  }
@@ -40,7 +39,6 @@ export const useEditPrivateStore = defineStore('edit-private-store', {
40
39
  global_store.setDoneJson(this.history_doneComponent[this.history_now_index])
41
40
  },
42
41
  topRedoBtnClick() {
43
- console.log('重做')
44
42
  if (this.history_now_index + 1 == this.history_doneComponent.length) {
45
43
  return
46
44
  }