@zhangqingcq/vgce 0.1.19 → 0.1.21

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.19",
3
+ "version": "0.1.21",
4
4
  "description": "Vector graphics configure editor. svg组态编辑器。基于vue3.3+ts+element-plus+vite",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -207,6 +207,30 @@
207
207
  canvasRef.value?.focus()
208
208
  if (globalStore.intention === EGlobalStoreIntention.Connection) {
209
209
  e.stopPropagation()
210
+ if (globalStore.handle_svg_info) {
211
+ if (e.button === 0) {
212
+ //鼠标左键创建新线段
213
+ 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) {
215
+ //鼠标移动后的实时位置(相对于起始点,只在创建第一个点时记录了鼠标原始位置)
216
+ l.push({
217
+ x:
218
+ globalStore.mouse_info.new_position_x -
219
+ globalStore.mouse_info.position_x -
220
+ svgEditLayoutStore.center_offset.x,
221
+ y:
222
+ globalStore.mouse_info.new_position_y -
223
+ globalStore.mouse_info.position_y -
224
+ svgEditLayoutStore.center_offset.y
225
+ })
226
+ }
227
+ } else if (e.button === 2) {
228
+ //鼠标右键结束线段绘制
229
+ globalStore.intention = EGlobalStoreIntention.None
230
+ setSvgActualInfo(globalStore.done_json[globalStore.handle_svg_info.index])
231
+ globalStore.setHandleSvgInfo(null)
232
+ }
233
+ }
210
234
  return
211
235
  }
212
236
  e.preventDefault()
@@ -287,6 +311,7 @@
287
311
  }
288
312
  }
289
313
  }
314
+
290
315
  const onSvgMouseEnter = (select_item: IDoneJson, index: number, e: MouseEvent) => {
291
316
  e.preventDefault()
292
317
  e.stopPropagation()
@@ -613,6 +638,7 @@
613
638
  }
614
639
  }
615
640
  }
641
+
616
642
  const onCanvasMouseUp = () => {
617
643
  //如果鼠标不是按下状态
618
644
  if (globalStore.mouse_info.state != EMouseInfoState.Down) {
@@ -666,7 +692,11 @@
666
692
  globalStore.setHandleSvgInfo(null)
667
693
  for (let e of globalStore.done_json) {
668
694
  const t = selectRect.value
669
- e.selected = e.x > t.x && e.x < t.x + t.with && e.y > t.y && e.y < t.y + t.height
695
+ e.selected =
696
+ e.center_position.x > t.x &&
697
+ e.center_position.x < t.x + t.with &&
698
+ e.center_position.y > t.y &&
699
+ e.center_position.y < t.y + t.height
670
700
  }
671
701
  globalStore.intention = EGlobalStoreIntention.None
672
702
  } else if (globalStore.intention != EGlobalStoreIntention.Select) {
@@ -683,6 +713,7 @@
683
713
  }
684
714
  contextMenuStore.display = false
685
715
  }
716
+
686
717
  const onCanvasMouseDown = (e: MouseEvent) => {
687
718
  const { clientX, clientY } = e
688
719
  if (globalStore.intention === EGlobalStoreIntention.Connection) {
@@ -157,7 +157,7 @@
157
157
  <el-scrollbar max-height="60vh">
158
158
  <div class="font-bold mb-10px text-15px guide-title" style="padding-top: 16px">多选</div>
159
159
  <div
160
- >在画布空白区域按住鼠标左键可以框选(图形坐标在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选</div
160
+ >在画布空白区域按住鼠标左键可以框选(图形中心点在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选</div
161
161
  >
162
162
  <div class="el-divider el-divider--horizontal" role="separator" style="--el-border-style: solid"></div>
163
163
  <div class="font-bold mb-10px text-15px guide-title">拖动画布</div>
@@ -6,7 +6,7 @@ const t: IConfigItem = {
6
6
  type: EDoneJsonType.File,
7
7
  config: {
8
8
  can_zoom: true,
9
- have_anchor: true,
9
+ have_anchor: false,
10
10
  actual_rect: true
11
11
  },
12
12
  display: true,
@@ -8,7 +8,7 @@ const t: IConfigItem = {
8
8
  type: EDoneJsonType.CustomSvg,
9
9
  config: {
10
10
  can_zoom: true,
11
- have_anchor: true,
11
+ have_anchor: false,
12
12
  actual_rect: true
13
13
  },
14
14
  display: true,
@@ -8,7 +8,7 @@ const t: IConfigItem = {
8
8
  type: EDoneJsonType.CustomSvg,
9
9
  config: {
10
10
  can_zoom: true,
11
- have_anchor: true,
11
+ have_anchor: false,
12
12
  actual_rect: true
13
13
  },
14
14
  display: true,
@@ -9,7 +9,7 @@ const t: IConfigItem = {
9
9
  display: true,
10
10
  config: {
11
11
  can_zoom: true,
12
- have_anchor: true,
12
+ have_anchor: false,
13
13
  actual_rect: true
14
14
  },
15
15
  props: {
@@ -9,7 +9,7 @@ const t: IConfigItem = {
9
9
  display: true,
10
10
  config: {
11
11
  can_zoom: true,
12
- have_anchor: true,
12
+ have_anchor: false,
13
13
  actual_rect: true
14
14
  },
15
15
  props: {
@@ -7,7 +7,7 @@ const t: IConfigItem = {
7
7
  type: EDoneJsonType.File,
8
8
  config: {
9
9
  can_zoom: true,
10
- have_anchor: true,
10
+ have_anchor: false,
11
11
  actual_rect: true
12
12
  },
13
13
  display: true,
@@ -8,7 +8,7 @@ const t: IConfigItem = {
8
8
  type: EDoneJsonType.Vue,
9
9
  config: {
10
10
  can_zoom: false,
11
- have_anchor: true,
11
+ have_anchor: false,
12
12
  actual_rect: true
13
13
  },
14
14
  display: true,
@@ -8,7 +8,7 @@ const t: IConfigItem = {
8
8
  type: EDoneJsonType.Vue,
9
9
  config: {
10
10
  can_zoom: false,
11
- have_anchor: true,
11
+ have_anchor: false,
12
12
  actual_rect: true
13
13
  },
14
14
  display: true,
@@ -8,7 +8,7 @@ const t: IConfigItem = {
8
8
  type: EDoneJsonType.Vue,
9
9
  config: {
10
10
  can_zoom: false,
11
- have_anchor: true,
11
+ have_anchor: false,
12
12
  actual_rect: true
13
13
  },
14
14
  display: true,
@@ -8,7 +8,7 @@ const t: IConfigItem = {
8
8
  type: EDoneJsonType.Vue,
9
9
  config: {
10
10
  can_zoom: true,
11
- have_anchor: true,
11
+ have_anchor: false,
12
12
  actual_rect: true
13
13
  },
14
14
  display: true,
@@ -8,7 +8,7 @@ const t: IConfigItem = {
8
8
  type: EDoneJsonType.Vue,
9
9
  config: {
10
10
  can_zoom: true,
11
- have_anchor: true,
11
+ have_anchor: false,
12
12
  actual_rect: true
13
13
  },
14
14
  display: true,