@zhangqingcq/vgce 0.0.30 → 0.0.32

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.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "Vector graphics configure editor. svg组态编辑器。基于vue3.3+ts+element-plus+vite",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,3 +1,5 @@
1
+ @import '@/assets/variables';
2
+
1
3
  *,
2
4
  *::before,
3
5
  *::after {
@@ -44,15 +46,15 @@ body {
44
46
  }
45
47
 
46
48
  .icon-out {
47
- fill: #64A0CF;
49
+ fill: @iconOutColor;
48
50
  }
49
51
 
50
52
  .icon-in {
51
- fill: #9EEFD9;
53
+ fill: @iconInColor;
52
54
  }
53
55
 
54
56
  .icon-middle {
55
- fill: #33DEB4;
57
+ fill: @iconMiddleColor;
56
58
  }
57
59
 
58
60
  .gray{
@@ -71,15 +73,15 @@ body {
71
73
 
72
74
  .active{
73
75
  .icon-out {
74
- fill: #008fff;
76
+ fill: @activeIconOut;
75
77
  }
76
78
 
77
79
  .icon-in {
78
- fill: #44fac9;
80
+ fill: @activeIconIn;
79
81
  }
80
82
 
81
83
  .icon-middle {
82
- fill: #00ffc0;
84
+ fill: @activeIconMiddle;
83
85
  }
84
86
  }
85
87
 
@@ -95,3 +97,18 @@ body {
95
97
  color: #aaa;
96
98
  }
97
99
  }
100
+
101
+ .foreignObject {
102
+ > span {
103
+ /*解决span标签显示不完整的问题*/
104
+ position: relative;
105
+ bottom: 2px;
106
+ }
107
+ }
108
+
109
+ .tree-v {
110
+ --el-color-primary-light-9: @listActiveColor;
111
+ &.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{
112
+ color: #fff;
113
+ }
114
+ }
@@ -0,0 +1,8 @@
1
+ //颜色
2
+ @listActiveColor: #6ab4ff;
3
+ @iconOutColor:#5fadff;
4
+ @iconInColor:#9EEFD9;
5
+ @iconMiddleColor:#33DEB4;
6
+ @activeIconOut:#008fff;
7
+ @activeIconIn:#44fac9;
8
+ @activeIconMiddle:#00ffc0;
@@ -6,6 +6,7 @@
6
6
  import { EGlobalStoreIntention, EMouseInfoState, EScaleInfoType } from '@/stores/global/types'
7
7
  import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
8
8
  import {
9
+ componentsRegister,
9
10
  createLine,
10
11
  getCenterPoint,
11
12
  getCommonClass,
@@ -16,7 +17,8 @@
16
17
  prosToVBind,
17
18
  randomString,
18
19
  resetHandlePointOld,
19
- setSvgActualInfo
20
+ setSvgActualInfo,
21
+ stopEvent
20
22
  } from '@/utils'
21
23
  import {
22
24
  calculateBottom,
@@ -34,24 +36,17 @@
34
36
  import { EDoneJsonType } from '@/config/types'
35
37
  import ConnectionLine from '@/components/svg-editor/connection-line.vue'
36
38
  import type { IVisibleInfo } from '../config'
37
- import { vueComp } from '@/config'
38
39
  import { useContextMenuStore, useEditPrivateStore } from '@/stores/system'
39
40
  import { EContextMenuInfoType } from '@/stores/system/types'
40
- import { computed } from 'vue'
41
+ import ImportJson from '@/components/svg-editor/import-json.vue'
41
42
 
42
- //注册所有组件
43
- const instance = getCurrentInstance()
44
- Object.keys(vueComp).forEach((key) => {
45
- if (!Object.keys(instance?.appContext?.components as any).includes(key)) {
46
- // @ts-ignore
47
- instance?.appContext.app.component(key, vueComp[key])
48
- }
49
- })
50
43
  const globalStore = useGlobalStore(pinia)
51
44
  const configStore = useConfigStore(pinia)
52
45
  const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
53
46
  const editPrivateStore = useEditPrivateStore(pinia)
54
47
  const contextMenuStore = useContextMenuStore(pinia)
48
+
49
+ componentsRegister()
55
50
  const contextMenuRef = ref<HTMLElement>()
56
51
  const canvasRef = ref<HTMLElement>()
57
52
  const ct: Record<string, any> = {
@@ -209,17 +204,19 @@
209
204
  const onSvgMouseDown = (select_item: IDoneJson, index: number, e: MouseEvent) => {
210
205
  canvasRef.value?.focus()
211
206
  if (globalStore.intention === EGlobalStoreIntention.Connection) {
207
+ e.stopPropagation()
212
208
  return
213
209
  }
214
210
  e.preventDefault()
215
211
  e.stopPropagation()
216
212
  if (e.ctrlKey && e.button === 0) {
217
213
  //ctrl+鼠标左键 多选组件
218
- if (globalStore.handle_svg_info?.index) {
214
+ if (globalStore.handle_svg_info?.index || globalStore.handle_svg_info?.index === 0) {
219
215
  globalStore.done_json[globalStore.handle_svg_info.index].selected = true
220
216
  globalStore.setHandleSvgInfo(null)
221
- select_item.selected = !select_item.selected
217
+ globalStore.intention = EGlobalStoreIntention.None
222
218
  }
219
+ select_item.selected = !select_item.selected
223
220
  } else if (isGroup.value) {
224
221
  //有框选的组件
225
222
  globalStore.intention = EGlobalStoreIntention.GroupMove
@@ -940,6 +937,8 @@
940
937
  }
941
938
  })
942
939
  })
940
+
941
+ defineExpose({ onCanvasMouseUp })
943
942
  </script>
944
943
 
945
944
  <template>
@@ -982,6 +981,7 @@
982
981
  :key="item.id"
983
982
  :transform="`translate(${item.x},${item.y})rotate(0)scale(1)`"
984
983
  v-show="item.display"
984
+ @mousewheel="stopEvent"
985
985
  >
986
986
  <g :class="`${getCommonClass(item)}`">
987
987
  <g
@@ -1085,7 +1085,11 @@
1085
1085
  />
1086
1086
 
1087
1087
  <handle-panel
1088
- v-if="globalStore.handle_svg_info?.info.id === item.id && visible_info.handle_panel"
1088
+ v-if="
1089
+ globalStore.handle_svg_info?.info.id === item.id &&
1090
+ visible_info.handle_panel &&
1091
+ item.type !== EDoneJsonType.ConnectionLine
1092
+ "
1089
1093
  :item-info="item"
1090
1094
  />
1091
1095
  <connection-panel
@@ -1134,6 +1138,8 @@
1134
1138
  </template>
1135
1139
 
1136
1140
  <style lang="less" scoped>
1141
+ @import '@/assets/variables';
1142
+
1137
1143
  .canvas {
1138
1144
  width: 100%;
1139
1145
  height: 100%;
@@ -1166,14 +1172,6 @@
1166
1172
  outline: 1px solid rgb(222, 69, 23);
1167
1173
  }
1168
1174
 
1169
- .foreignObject {
1170
- > span {
1171
- /*解决span标签显示不完整的问题*/
1172
- position: relative;
1173
- bottom: 2px;
1174
- }
1175
- }
1176
-
1177
1175
  .contextMenu {
1178
1176
  position: fixed;
1179
1177
  z-index: 99999;
@@ -1206,7 +1204,7 @@
1206
1204
  }
1207
1205
 
1208
1206
  p:hover {
1209
- background-color: #0cf;
1207
+ background-color: @listActiveColor;
1210
1208
  color: #ffffff;
1211
1209
  cursor: default;
1212
1210
  }
@@ -1218,6 +1216,7 @@
1218
1216
  .disabled:hover {
1219
1217
  color: #999;
1220
1218
  background-color: transparent;
1219
+ cursor: not-allowed;
1221
1220
  }
1222
1221
 
1223
1222
  li.separator {
@@ -6,7 +6,7 @@
6
6
  import type { IDoneJson } from '@/stores/global/types'
7
7
 
8
8
  const global_store = useGlobalStore(pinia)
9
- const current_node_key = ref(global_store.handle_svg_info?.info.id || '')
9
+ const current_node_key = computed(() => global_store.handle_svg_info?.info.id ?? '')
10
10
  const handleNodeClick = (data: IDoneJson) => {
11
11
  for (let e of global_store.done_json) {
12
12
  e.selected = false
@@ -24,12 +24,13 @@
24
24
 
25
25
  <template>
26
26
  <el-tree
27
+ class="tree-v"
27
28
  :data="global_store.done_json"
28
29
  :props="defaultProps"
29
30
  @node-click="handleNodeClick"
30
31
  :default-expand-all="true"
31
32
  :expand-on-click-node="false"
32
- :highlight-current="true"
33
+ :highlight-current="Boolean(current_node_key)"
33
34
  node-key="id"
34
35
  :current-node-key="current_node_key"
35
36
  />
@@ -40,7 +40,29 @@
40
40
  </script>
41
41
 
42
42
  <template>
43
- <g>
43
+ <g :style="{ cursor: globalStore.intention === EGlobalStoreIntention.Connection ? 'crosshair' : 'move' }">
44
+ <!-- 选中效果 -->
45
+ <path
46
+ :d="positionArrToPath(props.itemInfo.props.point_position.val)"
47
+ fill="none"
48
+ fill-opacity="0"
49
+ stroke="#DE4517"
50
+ :stroke-width="props.itemInfo.props['stroke-width'].val + 1"
51
+ stroke-linecap="round"
52
+ stroke-linejoin="round"
53
+ v-show="props.itemInfo.selected || props.itemInfo.id === globalStore.handle_svg_info?.info.id"
54
+ />
55
+ <!-- 打底 -->
56
+ <path
57
+ :d="positionArrToPath(props.itemInfo.props.point_position.val)"
58
+ fill="none"
59
+ fill-opacity="0"
60
+ stroke="#fff"
61
+ stroke-opacity=".01"
62
+ :stroke-width="props.itemInfo.props['stroke-width'].val"
63
+ stroke-linecap="round"
64
+ stroke-linejoin="round"
65
+ />
44
66
  <path
45
67
  :id="props.itemInfo.id"
46
68
  :d="positionArrToPath(props.itemInfo.props.point_position.val)"
@@ -51,13 +73,13 @@
51
73
  : props.itemInfo.props.stroke.val
52
74
  "
53
75
  :stroke-width="props.itemInfo.props['stroke-width'].val"
54
- :style="{ cursor: globalStore.intention === EGlobalStoreIntention.Connection ? 'crosshair' : 'move' }"
55
76
  stroke-dashoffset="0"
56
77
  :stroke-dasharray="
57
78
  props.itemInfo.animations?.type.val === EConfigAnimationsType.Electricity
58
79
  ? props.itemInfo.props['stroke-width'].val * 3
59
80
  : 0
60
81
  "
82
+ stroke-linejoin="round"
61
83
  >
62
84
  <animate
63
85
  v-if="props.itemInfo.animations?.type.val === EConfigAnimationsType.Electricity"
@@ -79,6 +101,7 @@
79
101
  :stroke-dasharray="props.itemInfo.props['stroke-width'].val * 3"
80
102
  stroke-dashoffset="0"
81
103
  stroke-linecap="round"
104
+ stroke-linejoin="round"
82
105
  >
83
106
  <animate
84
107
  attributeName="stroke-dashoffset"
@@ -94,7 +117,7 @@
94
117
  v-else-if="props.itemInfo.animations?.type.val === EConfigAnimationsType.Track"
95
118
  cx="0"
96
119
  cy="0"
97
- :r="props.itemInfo.props['stroke-width'].val * 2"
120
+ :r="Math.ceil(props.itemInfo.props['stroke-width'].val * 0.6) + 2"
98
121
  :fill="props.itemInfo.animations.color.val"
99
122
  >
100
123
  <animateMotion
@@ -110,8 +133,21 @@
110
133
  >
111
134
  </animateMotion>
112
135
  </circle>
113
- <!-- 更改线段 -->
114
136
  <g>
137
+ <!-- 节点选中效果 -->
138
+ <circle
139
+ v-for="(item, index) in props.itemInfo.props.point_position.val"
140
+ :key="index"
141
+ :cx="item.x"
142
+ :cy="item.y"
143
+ :r="props.itemInfo.props.point_r.val + 1"
144
+ fill="none"
145
+ fill-opacity="0"
146
+ stroke-width="1"
147
+ stroke="#DE4517"
148
+ v-show="props.itemInfo.selected || props.itemInfo.id === globalStore.handle_svg_info?.info.id"
149
+ />
150
+ <!-- 更改线段 -->
115
151
  <circle
116
152
  v-for="(item, index) in props.itemInfo.props.point_position.val"
117
153
  :key="index"
@@ -6,6 +6,7 @@
6
6
  import { createLine, getCoordinateOffset, moveAnchors } from '@/utils'
7
7
  import { useGlobalStore } from '@/stores/global'
8
8
  import { pinia } from '@/hooks'
9
+ import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
9
10
 
10
11
  const props = defineProps<{
11
12
  itemInfo: IDoneJson
@@ -15,6 +16,7 @@
15
16
  const radius = ref(4)
16
17
  const outRadius = ref(12)
17
18
  const globalStore = useGlobalStore(pinia)
19
+ const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
18
20
 
19
21
  const cxT = computed(
20
22
  () => props.itemInfo.actual_bound.x + props.itemInfo.actual_bound.width / 2 - offset.value + radius.value
@@ -105,6 +107,28 @@
105
107
  const bindAnchor = (e: any, type: ELineBindAnchors) => {
106
108
  if (globalStore.intention === EGlobalStoreIntention.None) {
107
109
  createLine(e, type, props.itemInfo)
110
+ if (globalStore.handle_svg_info) {
111
+ //鼠标左键创建新线段
112
+ if (globalStore.handle_svg_info.info.props.point_position.val.length !== 1) {
113
+ //鼠标移动后的实时位置(相对于起始点,只在创建第一个点时记录了鼠标原始位置)
114
+ globalStore.handle_svg_info.info.props.point_position.val.push({
115
+ x:
116
+ globalStore.mouse_info.new_position_x -
117
+ globalStore.mouse_info.position_x -
118
+ svgEditLayoutStore.center_offset.x,
119
+ y:
120
+ globalStore.mouse_info.new_position_y -
121
+ globalStore.mouse_info.position_y -
122
+ svgEditLayoutStore.center_offset.y
123
+ })
124
+ } else {
125
+ //第二个点,在鼠标没有移动的情况下,就是起始点
126
+ globalStore.handle_svg_info.info.props.point_position.val.push({
127
+ x: 0,
128
+ y: 0
129
+ })
130
+ }
131
+ }
108
132
  } else if (globalStore.intention === EGlobalStoreIntention.Connection) {
109
133
  //在连线的情况下,点击锚点,结束连线并绑定锚点
110
134
  e.stopPropagation()
@@ -34,6 +34,7 @@
34
34
  import { useEditPrivateStore } from '@/stores/system'
35
35
 
36
36
  //todo 优化自带组件使用体验
37
+ const emits = defineEmits(['onReturn', 'onPreview', 'onSave'])
37
38
  const props = withDefaults(defineProps<{ customToolbar?: IConfig; data?: string; saveFile?: boolean }>(), {
38
39
  saveFile: false
39
40
  })
@@ -41,13 +42,14 @@
41
42
  const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
42
43
  const configStore = useConfigStore(pinia)
43
44
  const editPrivateStore = useEditPrivateStore(pinia)
45
+
46
+ const centerRef = ref()
44
47
  const importJsonRef = ref<InstanceType<typeof ImportJson>>()
45
48
  const visible_conf: IVisibleConf = reactive({
46
49
  [EVisibleConfKey.ExportJson]: false,
47
50
  [EVisibleConfKey.ImportJson]: false,
48
51
  [EVisibleConfKey.ImportFile]: false
49
52
  })
50
- const emits = defineEmits(['onReturn', 'onPreview', 'onSave'])
51
53
  const changeVisible = (key: EVisibleConfKey, val: boolean) => {
52
54
  visible_conf[key] = val
53
55
  }
@@ -116,6 +118,10 @@
116
118
  }
117
119
  }
118
120
 
121
+ function onLineMouseUp() {
122
+ centerRef.value.onCanvasMouseUp()
123
+ }
124
+
119
125
  defineExpose({
120
126
  setGraphNodeJson
121
127
  })
@@ -143,8 +149,8 @@
143
149
  </el-aside>
144
150
  <el-main class="middle main">
145
151
  <div class="canvas-main-pc">
146
- <Vue3RulerTool class="canvas-main-pc" :visible="configStore.svg.ruler">
147
- <center-panel />
152
+ <Vue3RulerTool class="canvas-main-pc" :visible="configStore.svg.ruler" @onLineMouseUp="onLineMouseUp">
153
+ <center-panel ref="centerRef" />
148
154
  </Vue3RulerTool>
149
155
  </div>
150
156
  </el-main>
@@ -156,13 +156,15 @@
156
156
  <el-dialog v-model="open" title="使用说明" width="60%" class="guide-dialog">
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
- <div>鼠标按住左键可以框选,也可以按住ctrl+鼠标左键点图形进行多选</div>
159
+ <div
160
+ >在画布空白区域按住鼠标左键可以框选(图形坐标在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选</div
161
+ >
160
162
  <div class="el-divider el-divider--horizontal" role="separator" style="--el-border-style: solid"></div>
161
163
  <div class="font-bold mb-10px text-15px guide-title">拖动画布</div>
162
- <div>右键画布然后拖动即可,右侧面板‘图纸’栏可微调或重置位置</div>
164
+ <div>在画布空白区域按住右键可拖动画布,右侧面板‘图纸’栏可微调或重置位置</div>
163
165
  <div class="el-divider el-divider--horizontal" role="separator" style="--el-border-style: solid"></div>
164
166
  <div class="font-bold mb-10px text-15px guide-title">画布缩放</div>
165
- <div>使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放</div>
167
+ <div>在画布空白区使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放</div>
166
168
  <div class="el-divider el-divider--horizontal" role="separator" style="--el-border-style: solid"></div>
167
169
  <div class="font-bold mb-10px text-15px guide-title">标尺辅助线</div>
168
170
  <div>在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线</div>
@@ -3,12 +3,19 @@
3
3
  import { useGlobalStore } from '@/stores/global'
4
4
  import { EGlobalStoreIntention, EMouseInfoState } from '@/stores/global/types'
5
5
  import type { IDoneJson } from '@/stores/global/types'
6
- import { getCommonClass, prosToVBind, setArrItemByID, valFormat } from '@/utils'
6
+ import {
7
+ componentsRegister,
8
+ getCommonClass,
9
+ preventDefault,
10
+ prosToVBind,
11
+ setArrItemByID,
12
+ stopEvent,
13
+ valFormat
14
+ } from '@/utils'
7
15
 
8
16
  import { EDoneJsonType, EEventAction, EEventType } from '@/config/types'
9
17
  import ConnectionLine from '@/components/svg-editor/connection-line.vue'
10
18
 
11
- import { vueComp } from '@/config'
12
19
  import type { IDataModel } from '@/components/svg-editor/types'
13
20
  import 'element-plus/dist/index.css'
14
21
  import 'animate.css'
@@ -16,16 +23,11 @@
16
23
  import { sub, close } from '@/utils/mqtt-net'
17
24
 
18
25
  const emit = defineEmits(['onMessage'])
19
- //注册所有组件
20
- const instance = getCurrentInstance()
21
- Object.keys(vueComp).forEach((key: string) => {
22
- if (!Object.keys(instance?.appContext?.components as any).includes(key)) {
23
- instance?.appContext.app.component(key, vueComp[key])
24
- }
25
- })
26
26
  const props = withDefaults(defineProps<{ data?: IDataModel; canvasDrag?: boolean }>(), {
27
27
  canvasDrag: true
28
28
  })
29
+ const globalStore = useGlobalStore(pinia)
30
+ componentsRegister()
29
31
  const preview_data = reactive(
30
32
  props.data ?? {
31
33
  layout_center: {
@@ -50,7 +52,6 @@
50
52
  done_json: []
51
53
  }
52
54
  )
53
- const globalStore = useGlobalStore(pinia)
54
55
 
55
56
  const cursor_style = computed(() => (globalStore.intention == EGlobalStoreIntention.MoveCanvas ? 'grab' : 'default'))
56
57
  const onCanvasMouseMove = (e: MouseEvent) => {
@@ -135,9 +136,6 @@
135
136
  height: actual_bound.height * scale_y
136
137
  }
137
138
  }
138
- const setNodeAttrByID = (id: string, attr: string, val: any) => {
139
- return setArrItemByID(id, attr, val, preview_data.done_json)
140
- }
141
139
 
142
140
  const getStyle = (root: IDoneJson) => {
143
141
  let t = false
@@ -226,12 +224,6 @@
226
224
  }
227
225
  }
228
226
 
229
- onMounted(() => {
230
- connectNet()
231
- })
232
-
233
- onBeforeUnmount(close)
234
-
235
227
  const connectNet = () => {
236
228
  const m = preview_data.config.net.mqtt
237
229
  if (m && m.url && m.user && m.pwd && m.topics) {
@@ -247,6 +239,16 @@
247
239
  }
248
240
  }
249
241
 
242
+ const setNodeAttrByID = (id: string, attr: string, val: any) => {
243
+ return setArrItemByID(id, attr, val, preview_data.done_json)
244
+ }
245
+
246
+ onMounted(() => {
247
+ connectNet()
248
+ })
249
+
250
+ onBeforeUnmount(close)
251
+
250
252
  defineExpose({
251
253
  setNodeAttrByID
252
254
  })
@@ -259,6 +261,7 @@
259
261
  @mousemove="onCanvasMouseMove"
260
262
  @mouseup="onCanvasMouseUp"
261
263
  @mousewheel="onMousewheel"
264
+ @contextmenu="preventDefault"
262
265
  >
263
266
  <svg
264
267
  xmlns="http://www.w3.org/2000/svg"
@@ -278,6 +281,10 @@
278
281
  v-show="item.display"
279
282
  :style="getStyle(item)"
280
283
  @click="eventHandle(item, EEventType.Click)"
284
+ @mousedown="stopEvent"
285
+ @mousemove="stopEvent"
286
+ @mouseup="stopEvent"
287
+ @mousewheel="stopEvent"
281
288
  >
282
289
  <g :class="`${getCommonClass(item)}`">
283
290
  <g
@@ -322,6 +329,7 @@
322
329
  v-else-if="item.type === EDoneJsonType.Vue"
323
330
  v-bind="getActualBoundScale(item.actual_bound, item.scale_x, item.scale_y)"
324
331
  :id="`foreign-object${item.id}`"
332
+ class="foreignObject"
325
333
  >
326
334
  <component
327
335
  :is="item.tag"
@@ -352,24 +360,6 @@
352
360
  cursor: v-bind('cursor_style');
353
361
  }
354
362
 
355
- .svg-item-none {
356
- cursor: move;
357
-
358
- &:hover {
359
- outline: 1px solid #f8d032;
360
- }
361
- }
362
-
363
- .svg-item-move {
364
- cursor: move;
365
- outline: 1px dashed rgb(149, 23, 222);
366
- }
367
-
368
- .svg-item-select {
369
- cursor: move;
370
- outline: 1px solid rgb(149, 23, 222);
371
- }
372
-
373
363
  .common-ani {
374
364
  transform-box: fill-box;
375
365
  }
@@ -2,7 +2,9 @@
2
2
  import { pinia } from '@/hooks'
3
3
  import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
4
4
  import { useConfigStore } from '@/stores/config'
5
+ import { preventDefault, stopEvent } from '@/utils'
5
6
 
7
+ const emit = defineEmits(['onLineMouseUp'])
6
8
  const props = withDefaults(
7
9
  defineProps<{
8
10
  visible?: boolean
@@ -291,6 +293,10 @@
291
293
  dragFlag = 'v'
292
294
  dragLineId = id
293
295
  }
296
+
297
+ const lineMouseUp = () => {
298
+ emit('onLineMouseUp')
299
+ }
294
300
  </script>
295
301
 
296
302
  <template>
@@ -317,6 +323,8 @@
317
323
  :key="item.id"
318
324
  :class="`vue-ruler-ref-line-${item.type}`"
319
325
  @mousedown="handleDragLine(item)"
326
+ @mouseup="lineMouseUp"
327
+ @contextmenu="preventDefault"
320
328
  />
321
329
  </section>
322
330
  <div ref="content" class="vue-ruler-content" :style="contentStyle">
@@ -427,6 +435,7 @@
427
435
  height: 4px;
428
436
  cursor: n-resize;
429
437
  border-top: 1px dashed #999;
438
+
430
439
  span {
431
440
  left: 30px;
432
441
  top: 3px;
@@ -439,6 +448,7 @@
439
448
  _height: 9999px;
440
449
  cursor: w-resize;
441
450
  border-left: 1px dashed #999;
451
+
442
452
  span {
443
453
  top: 30px;
444
454
  left: 7px;
@@ -1,15 +1,7 @@
1
- /**
2
- * 组件分组数据格式
3
- * @property {string} groupType 组件分组类型
4
- * @property {string} title 组件分组标题
5
- * @property {Array} list 分组包含的组件项列表
6
- * @export
7
- * @interface IConfigComponentGroup
8
- */
9
1
  export interface IConfigComponentGroup {
10
- groupType: string
11
- title: string
12
- list: Array<IConfigItem>
2
+ groupType: string //组件分组类型
3
+ title: string //组件分组标题
4
+ list: Array<IConfigItem> //分组包含的组件项列表
13
5
  }
14
6
 
15
7
  export type IConfig = IConfigComponentGroup[]
@@ -79,6 +79,11 @@ export const common_table: IConfigItem = {
79
79
  type: EConfigItemPropsType.InputNumber,
80
80
  val: 200
81
81
  },
82
+ maxHeight: {
83
+ title: '最大高度',
84
+ type: EConfigItemPropsType.InputNumber,
85
+ val: 200
86
+ },
82
87
  stripe: {
83
88
  title: '斑马纹',
84
89
  type: EConfigItemPropsType.Switch,
@@ -99,7 +99,7 @@ export const useContextMenuStore = defineStore('context-menu-store', {
99
99
  switch (type) {
100
100
  case EContextMenuInfoType.Copy:
101
101
  const temp_item = objectDeepClone<IDoneJson>(globalStore.handle_svg_info.info)
102
- temp_item.id = temp_item.name + randomString()
102
+ temp_item.id = randomString()
103
103
  temp_item.title += '-copy'
104
104
  temp_item.x += 10
105
105
  temp_item.y += 10