@zhangqingcq/vgce 0.0.29 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/style.css +1 -1
- package/dist/vgce.js +1790 -1773
- package/dist/vgce.umd.cjs +37 -37
- package/package.json +1 -1
- package/src/components/svg-editor/center-panel.vue +3 -1
- package/src/components/svg-viewer.vue +13 -8
- package/src/config/types.ts +3 -11
- package/src/config/vue/component/common-table.ts +5 -0
- package/src/stores/system/index.ts +1 -1
- package/src/utils/index.ts +5 -1
package/package.json
CHANGED
@@ -16,7 +16,8 @@
|
|
16
16
|
prosToVBind,
|
17
17
|
randomString,
|
18
18
|
resetHandlePointOld,
|
19
|
-
setSvgActualInfo
|
19
|
+
setSvgActualInfo,
|
20
|
+
stopEvent
|
20
21
|
} from '@/utils'
|
21
22
|
import {
|
22
23
|
calculateBottom,
|
@@ -982,6 +983,7 @@
|
|
982
983
|
:key="item.id"
|
983
984
|
:transform="`translate(${item.x},${item.y})rotate(0)scale(1)`"
|
984
985
|
v-show="item.display"
|
986
|
+
@mousewheel="stopEvent"
|
985
987
|
>
|
986
988
|
<g :class="`${getCommonClass(item)}`">
|
987
989
|
<g
|
@@ -3,7 +3,7 @@
|
|
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 { getCommonClass, prosToVBind, setArrItemByID, stopEvent, valFormat } from '@/utils'
|
7
7
|
|
8
8
|
import { EDoneJsonType, EEventAction, EEventType } from '@/config/types'
|
9
9
|
import ConnectionLine from '@/components/svg-editor/connection-line.vue'
|
@@ -152,6 +152,7 @@
|
|
152
152
|
return { cursor: t ? 'pointer' : 'default' }
|
153
153
|
}
|
154
154
|
const eventHandle = (root: IDoneJson, type: EEventType) => {
|
155
|
+
console.log(root.events, type)
|
155
156
|
if (root.events?.length > 0) {
|
156
157
|
for (let e of root.events) {
|
157
158
|
if (e.type === type) {
|
@@ -174,7 +175,7 @@
|
|
174
175
|
if (e.attrs && e.attrs.length > 0) {
|
175
176
|
let t
|
176
177
|
if (e.target) {
|
177
|
-
for (let item of
|
178
|
+
for (let item of preview_data.done_json) {
|
178
179
|
if (item.id === e.target) {
|
179
180
|
t = item
|
180
181
|
break
|
@@ -225,12 +226,6 @@
|
|
225
226
|
}
|
226
227
|
}
|
227
228
|
|
228
|
-
onMounted(() => {
|
229
|
-
connectNet()
|
230
|
-
})
|
231
|
-
|
232
|
-
onBeforeUnmount(close)
|
233
|
-
|
234
229
|
const connectNet = () => {
|
235
230
|
const m = preview_data.config.net.mqtt
|
236
231
|
if (m && m.url && m.user && m.pwd && m.topics) {
|
@@ -246,6 +241,12 @@
|
|
246
241
|
}
|
247
242
|
}
|
248
243
|
|
244
|
+
onMounted(() => {
|
245
|
+
connectNet()
|
246
|
+
})
|
247
|
+
|
248
|
+
onBeforeUnmount(close)
|
249
|
+
|
249
250
|
defineExpose({
|
250
251
|
setNodeAttrByID
|
251
252
|
})
|
@@ -277,6 +278,10 @@
|
|
277
278
|
v-show="item.display"
|
278
279
|
:style="getStyle(item)"
|
279
280
|
@click="eventHandle(item, EEventType.Click)"
|
281
|
+
@mousedown="stopEvent"
|
282
|
+
@mousemove="stopEvent"
|
283
|
+
@mouseup="stopEvent"
|
284
|
+
@mousewheel="stopEvent"
|
280
285
|
>
|
281
286
|
<g :class="`${getCommonClass(item)}`">
|
282
287
|
<g
|
package/src/config/types.ts
CHANGED
@@ -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 =
|
102
|
+
temp_item.id = randomString()
|
103
103
|
temp_item.title += '-copy'
|
104
104
|
temp_item.x += 10
|
105
105
|
temp_item.y += 10
|
package/src/utils/index.ts
CHANGED
@@ -11,6 +11,10 @@ import { useConfigStore } from '@/stores/config'
|
|
11
11
|
import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
|
12
12
|
import { kebabCase } from 'lodash-es'
|
13
13
|
|
14
|
+
export const stopEvent = (e: any) => {
|
15
|
+
e.stopPropagation()
|
16
|
+
}
|
17
|
+
|
14
18
|
/**
|
15
19
|
* 生成随机字符串
|
16
20
|
* @param len 生成个数
|
@@ -471,7 +475,7 @@ export const createLine = (e: MouseEvent, type?: ELineBindAnchors, itemInfo?: ID
|
|
471
475
|
)
|
472
476
|
}
|
473
477
|
const done_item_json = {
|
474
|
-
id:
|
478
|
+
id: randomString(),
|
475
479
|
x: x,
|
476
480
|
y: y,
|
477
481
|
client: {
|