@zhangqingcq/vgce 0.1.20 → 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.20",
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()
@@ -772,32 +796,6 @@
772
796
  }
773
797
  }
774
798
 
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
799
  function onMousewheel(e: any) {
802
800
  if (e?.wheelDelta) {
803
801
  if (e.wheelDelta > 0) {
@@ -1036,7 +1034,6 @@
1036
1034
  v-if="item.type === EDoneJsonType.ConnectionLine"
1037
1035
  :item-info="item"
1038
1036
  :point-visible="visible_info.connection_line && visible_info.select_item.info?.id == item.id"
1039
- @mousedown="onLineMouseDown"
1040
1037
  />
1041
1038
  <use
1042
1039
  v-else-if="item.type === EDoneJsonType.File"