@zhangqingcq/vgce 0.1.20 → 0.1.22

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.20",
3
+ "version": "0.1.22",
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()
@@ -627,9 +651,16 @@
627
651
  globalStore.setDoneJson(globalStore.done_json)
628
652
  } else if (globalStore.intention == EGlobalStoreIntention.GroupMove) {
629
653
  if (groupMoved) {
630
- //群组移动了
654
+ //群组移动了,从新计算移动过的组件各种坐标信息
655
+ for (let e of globalStore.done_json) {
656
+ if (e.selected) {
657
+ setSvgActualInfo(e)
658
+ }
659
+ }
631
660
  groupMoved = false
632
661
  globalStore.intention = EGlobalStoreIntention.None
662
+ //记录历史记录
663
+ globalStore.setDoneJson(globalStore.done_json)
633
664
  }
634
665
  } else if (globalStore.handle_svg_info?.info && globalStore.intention == EGlobalStoreIntention.Zoom) {
635
666
  //缩放完成后重置中点 新版本中点就是组件坐标
@@ -772,32 +803,6 @@
772
803
  }
773
804
  }
774
805
 
775
- const onLineMouseDown = (e: Record<string, any>) => {
776
- if (globalStore.intention === EGlobalStoreIntention.Connection && globalStore.handle_svg_info) {
777
- if (e.button === 0) {
778
- //鼠标左键创建新线段
779
- if (globalStore.handle_svg_info.info.props.point_position.val.length !== 2) {
780
- //鼠标移动后的实时位置(相对于起始点,只在创建第一个点时记录了鼠标原始位置)
781
- globalStore.handle_svg_info.info.props.point_position.val.push({
782
- x:
783
- globalStore.mouse_info.new_position_x -
784
- globalStore.mouse_info.position_x -
785
- svgEditLayoutStore.center_offset.x,
786
- y:
787
- globalStore.mouse_info.new_position_y -
788
- globalStore.mouse_info.position_y -
789
- svgEditLayoutStore.center_offset.y
790
- })
791
- }
792
- } else if (e.button === 2) {
793
- //鼠标右键结束线段绘制
794
- globalStore.intention = EGlobalStoreIntention.None
795
- setSvgActualInfo(globalStore.done_json[globalStore.handle_svg_info.index])
796
- globalStore.setHandleSvgInfo(null)
797
- }
798
- }
799
- }
800
-
801
806
  function onMousewheel(e: any) {
802
807
  if (e?.wheelDelta) {
803
808
  if (e.wheelDelta > 0) {
@@ -1036,7 +1041,6 @@
1036
1041
  v-if="item.type === EDoneJsonType.ConnectionLine"
1037
1042
  :item-info="item"
1038
1043
  :point-visible="visible_info.connection_line && visible_info.select_item.info?.id == item.id"
1039
- @mousedown="onLineMouseDown"
1040
1044
  />
1041
1045
  <use
1042
1046
  v-else-if="item.type === EDoneJsonType.File"