@zhangqingcq/vgce 0.0.20 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/style.css +2 -2
- package/dist/vgce.js +15858 -15276
- package/dist/vgce.umd.cjs +82 -129
- package/package.json +13 -15
- package/src/assets/base.less +79 -31
- package/src/assets/icons/delete-gray.svg +1 -0
- package/src/assets/icons/delete.svg +1 -12
- package/src/assets/icons/export.svg +1 -1
- package/src/assets/icons/import.svg +1 -1
- package/src/assets/icons/line-active.svg +1 -0
- package/src/assets/icons/line.svg +1 -0
- package/src/assets/icons/menu-fold.svg +1 -9
- package/src/assets/icons/menu-unfold.svg +1 -9
- package/src/assets/icons/preview.svg +1 -6
- package/src/assets/icons/question.svg +1 -0
- package/src/assets/icons/redo-gray.svg +1 -0
- package/src/assets/icons/redo.svg +1 -8
- package/src/assets/icons/return.svg +1 -8
- package/src/assets/icons/rotate.svg +1 -1
- package/src/assets/icons/save.svg +1 -9
- package/src/assets/icons/undo-gray.svg +1 -0
- package/src/assets/icons/undo.svg +1 -7
- package/src/assets/svgs/sheet-border.svg +1 -0
- package/src/assets/svgs/svg-text.svg +1 -5
- package/src/components/svg-analysis/index.vue +1 -1
- package/src/components/svg-editor/center-panel/index.vue +508 -176
- package/src/components/svg-editor/component-tree/index.vue +4 -0
- package/src/components/svg-editor/connection-line/index.vue +12 -8
- package/src/components/svg-editor/connection-panel/index.vue +121 -181
- package/src/components/svg-editor/handle-panel/index.vue +32 -24
- package/src/components/svg-editor/index.vue +24 -25
- package/src/components/svg-editor/left-panel/index.vue +2 -2
- package/src/components/svg-editor/right-panel/bind-anchor.vue +124 -0
- package/src/components/svg-editor/right-panel/code-edit-modal.vue +1 -1
- package/src/components/svg-editor/right-panel/dynamic-el-form-item.vue +8 -1
- package/src/components/svg-editor/right-panel/index.vue +117 -56
- package/src/components/svg-editor/top-panel/index.vue +109 -25
- package/src/components/svg-viewer/index.vue +31 -21
- package/src/components/vue3-ruler-tool/index.vue +329 -372
- package/src/config/files/clock-a.vue +64 -64
- package/src/config/svg/animation/index.ts +1 -1
- package/src/config/svg/custom/svg-text.ts +2 -2
- package/src/config/svg/stateful/index.ts +1 -1
- package/src/config/svg/stateless/index.ts +3 -2
- package/src/config/svg/stateless/sheet-border.ts +22 -0
- package/src/config/types.ts +1 -0
- package/src/stores/config/index.ts +1 -8
- package/src/stores/config/types.ts +0 -8
- package/src/stores/global/index.ts +0 -10
- package/src/stores/global/types.ts +33 -10
- package/src/stores/svg-edit-layout/index.ts +7 -0
- package/src/stores/svg-edit-layout/types.ts +1 -0
- package/src/utils/index.ts +227 -103
- package/src/utils/scale-core.ts +1 -0
- package/src/views/EditorS.vue +1 -1
@@ -8,6 +8,10 @@
|
|
8
8
|
const global_store = useGlobalStore(pinia)
|
9
9
|
const current_node_key = ref(global_store.handle_svg_info?.info.id || '')
|
10
10
|
const handleNodeClick = (data: IDoneJson) => {
|
11
|
+
for (let e of global_store.done_json) {
|
12
|
+
e.selected = false
|
13
|
+
e.old_position = { x: 0, y: 0 }
|
14
|
+
}
|
11
15
|
global_store.intention = EGlobalStoreIntention.Select
|
12
16
|
global_store.setHandleSvgInfo(data)
|
13
17
|
}
|
@@ -5,9 +5,13 @@
|
|
5
5
|
import { pinia } from '@/hooks'
|
6
6
|
import { useGlobalStore } from '@/stores/global'
|
7
7
|
import { EConfigAnimationsType } from '@/config/types'
|
8
|
+
import { useConfigStore } from '@/stores/config'
|
9
|
+
import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
|
8
10
|
|
9
11
|
const props = withDefaults(defineProps<{ itemInfo: IDoneJson; pointVisible: boolean }>(), { pointVisible: false })
|
10
12
|
const globalStore = useGlobalStore(pinia)
|
13
|
+
const configStore = useConfigStore(pinia)
|
14
|
+
const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
|
11
15
|
const setConnectionLineNode = (point_index: number, e: MouseEvent, x: number, y: number) => {
|
12
16
|
if (globalStore.intention === EGlobalStoreIntention.Connection) {
|
13
17
|
return
|
@@ -23,15 +27,15 @@
|
|
23
27
|
point_index: point_index
|
24
28
|
}
|
25
29
|
globalStore.intention = EGlobalStoreIntention.SetConnectionLineNode
|
26
|
-
globalStore.
|
30
|
+
globalStore.mouse_info = {
|
27
31
|
state: EMouseInfoState.Down,
|
28
|
-
position_x: clientX,
|
29
|
-
position_y: clientY,
|
30
|
-
now_position_x:
|
31
|
-
now_position_y:
|
32
|
+
position_x: Math.round((clientX - svgEditLayoutStore.canvasInfo.left) / configStore.svg.scale),
|
33
|
+
position_y: Math.round((clientY - svgEditLayoutStore.canvasInfo.top) / configStore.svg.scale),
|
34
|
+
now_position_x: 0,
|
35
|
+
now_position_y: 0,
|
32
36
|
new_position_x: 0,
|
33
37
|
new_position_y: 0
|
34
|
-
}
|
38
|
+
}
|
35
39
|
}
|
36
40
|
</script>
|
37
41
|
|
@@ -47,7 +51,7 @@
|
|
47
51
|
: props.itemInfo.props.stroke.val
|
48
52
|
"
|
49
53
|
:stroke-width="props.itemInfo.props['stroke-width'].val"
|
50
|
-
style="cursor: move"
|
54
|
+
:style="{ cursor: globalStore.intention === EGlobalStoreIntention.Connection ? 'crosshair' : 'move' }"
|
51
55
|
stroke-dashoffset="0"
|
52
56
|
:stroke-dasharray="
|
53
57
|
props.itemInfo.animations?.type.val === EConfigAnimationsType.Electricity
|
@@ -107,7 +111,7 @@
|
|
107
111
|
</animateMotion>
|
108
112
|
</circle>
|
109
113
|
<!-- 更改线段 -->
|
110
|
-
<g
|
114
|
+
<g>
|
111
115
|
<circle
|
112
116
|
v-for="(item, index) in props.itemInfo.props.point_position.val"
|
113
117
|
:key="index"
|
@@ -1,197 +1,137 @@
|
|
1
1
|
<!-- 连线组件 -->
|
2
2
|
<script lang="ts" setup>
|
3
|
-
import { straight_line_system } from '@/components/config'
|
4
3
|
import { ELineBindAnchors } from '@/components/config/types'
|
5
|
-
import type { ISystemStraightLine } from '@/components/config/types'
|
6
|
-
import { pinia } from '@/hooks'
|
7
|
-
import { useConfigStore } from '@/stores/config'
|
8
|
-
import { useGlobalStore } from '@/stores/global'
|
9
|
-
import { EGlobalStoreIntention, EMouseInfoState } from '@/stores/global/types'
|
10
4
|
import type { IDoneJson } from '@/stores/global/types'
|
11
|
-
import {
|
5
|
+
import { EGlobalStoreIntention } from '@/stores/global/types'
|
6
|
+
import { createLine, getCoordinateOffset, moveAnchors } from '@/utils'
|
7
|
+
import { useGlobalStore } from '@/stores/global'
|
8
|
+
import { pinia } from '@/hooks'
|
12
9
|
|
13
|
-
const props = defineProps<{
|
14
|
-
|
15
|
-
|
10
|
+
const props = defineProps<{
|
11
|
+
itemInfo: IDoneJson
|
12
|
+
}>()
|
16
13
|
const offset = ref(4)
|
17
|
-
const fill = ref('#
|
14
|
+
const fill = ref('#ab712e')
|
18
15
|
const radius = ref(4)
|
19
|
-
|
20
|
-
|
21
|
-
* @param bind_anchor_type 绑定锚点类型
|
22
|
-
* @param e
|
23
|
-
*/
|
24
|
-
const onConnectionMouseDown = (bind_anchor_type: ELineBindAnchors, e: MouseEvent) => {
|
25
|
-
e.preventDefault()
|
16
|
+
const outRadius = ref(12)
|
17
|
+
const globalStore = useGlobalStore(pinia)
|
26
18
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
x
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
actual_bound
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
19
|
+
const cxT = computed(
|
20
|
+
() => props.itemInfo.actual_bound.x + props.itemInfo.actual_bound.width / 2 - offset.value + radius.value
|
21
|
+
)
|
22
|
+
|
23
|
+
const cyT = computed(
|
24
|
+
() =>
|
25
|
+
props.itemInfo.actual_bound.y -
|
26
|
+
offset.value -
|
27
|
+
getCoordinateOffset(props.itemInfo.actual_bound.height, props.itemInfo.scale_y) +
|
28
|
+
radius.value
|
29
|
+
)
|
30
|
+
|
31
|
+
const cxR = computed(
|
32
|
+
() =>
|
33
|
+
props.itemInfo.actual_bound.x -
|
34
|
+
offset.value +
|
35
|
+
props.itemInfo.actual_bound.width +
|
36
|
+
getCoordinateOffset(props.itemInfo.actual_bound.width, props.itemInfo.scale_x) +
|
37
|
+
radius.value
|
38
|
+
)
|
39
|
+
|
40
|
+
const cyR = computed(
|
41
|
+
() =>
|
42
|
+
props.itemInfo.actual_bound.y -
|
43
|
+
offset.value +
|
44
|
+
(props.itemInfo.actual_bound.height * props.itemInfo.scale_y) / 2 -
|
45
|
+
getCoordinateOffset(props.itemInfo.actual_bound.height, props.itemInfo.scale_y) +
|
46
|
+
radius.value
|
47
|
+
)
|
48
|
+
|
49
|
+
const cxB = computed(
|
50
|
+
() => props.itemInfo.actual_bound.x - offset.value + props.itemInfo.actual_bound.width / 2 + radius.value
|
51
|
+
)
|
52
|
+
const cyB = computed(
|
53
|
+
() =>
|
54
|
+
props.itemInfo.actual_bound.y -
|
55
|
+
offset.value +
|
56
|
+
props.itemInfo.actual_bound.height +
|
57
|
+
getCoordinateOffset(props.itemInfo.actual_bound.height, props.itemInfo.scale_y) +
|
58
|
+
radius.value
|
59
|
+
)
|
60
|
+
|
61
|
+
const cxL = computed(
|
62
|
+
() =>
|
63
|
+
props.itemInfo.actual_bound.x -
|
64
|
+
offset.value -
|
65
|
+
getCoordinateOffset(props.itemInfo.actual_bound.width, props.itemInfo.scale_x) +
|
66
|
+
radius.value
|
67
|
+
)
|
68
|
+
const cyL = computed(
|
69
|
+
() =>
|
70
|
+
props.itemInfo.actual_bound.y -
|
71
|
+
offset.value +
|
72
|
+
(props.itemInfo.actual_bound.height * props.itemInfo.scale_y) / 2 -
|
73
|
+
getCoordinateOffset(props.itemInfo.actual_bound.height, props.itemInfo.scale_y) +
|
74
|
+
radius.value
|
75
|
+
)
|
76
|
+
const bindAnchor = (e: any, type: ELineBindAnchors) => {
|
77
|
+
if (globalStore.intention === EGlobalStoreIntention.None) {
|
78
|
+
createLine(e, type, props.itemInfo)
|
79
|
+
} else if (globalStore.intention === EGlobalStoreIntention.Connection) {
|
80
|
+
//点击锚上在连线的情况下点击结束连线并绑定锚点
|
81
|
+
e.stopPropagation()
|
82
|
+
if (globalStore.handle_svg_info?.info.bind_anchors) {
|
83
|
+
globalStore.handle_svg_info.info.bind_anchors.end = {
|
84
|
+
type: type,
|
85
|
+
target_id: props.itemInfo.id
|
88
86
|
}
|
89
|
-
|
90
|
-
|
87
|
+
globalStore.intention = EGlobalStoreIntention.None
|
88
|
+
globalStore.setHandleSvgInfo(null)
|
89
|
+
nextTick(function () {
|
90
|
+
moveAnchors(props.itemInfo)
|
91
|
+
})
|
92
|
+
}
|
91
93
|
}
|
92
|
-
done_item_json.props.point_position.val.push({
|
93
|
-
x: configStore.svg.svg_position_center.x,
|
94
|
-
y: configStore.svg.svg_position_center.y
|
95
|
-
})
|
96
|
-
globalStore.setHandleSvgInfo(done_item_json, globalStore.done_json.length)
|
97
|
-
globalStore.setDoneJson(done_item_json)
|
98
|
-
|
99
|
-
globalStore.intention = EGlobalStoreIntention.Connection
|
100
|
-
globalStore.setMouseInfo({
|
101
|
-
state: EMouseInfoState.Down,
|
102
|
-
position_x: clientX,
|
103
|
-
position_y: clientY,
|
104
|
-
now_position_x: clientX,
|
105
|
-
now_position_y: clientY,
|
106
|
-
new_position_x: 0,
|
107
|
-
new_position_y: 0
|
108
|
-
})
|
109
94
|
}
|
110
95
|
</script>
|
111
96
|
|
112
97
|
<template>
|
113
|
-
<g
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
"
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
:
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
:cx="
|
134
|
-
|
135
|
-
|
136
|
-
getCoordinateOffset(props.itemInfo.actual_bound.width, props.itemInfo.scale_x) +
|
137
|
-
radius
|
138
|
-
"
|
139
|
-
:cy="
|
140
|
-
props.itemInfo.actual_bound.y -
|
141
|
-
offset +
|
142
|
-
(props.itemInfo.actual_bound.height * props.itemInfo.scale_y) / 2 -
|
143
|
-
getCoordinateOffset(props.itemInfo.actual_bound.height, props.itemInfo.scale_y) +
|
144
|
-
radius
|
145
|
-
"
|
146
|
-
:r="radius"
|
147
|
-
stroke="rgba(0,0,0,0)"
|
148
|
-
stroke-width="2"
|
149
|
-
:fill="fill"
|
150
|
-
:style="{ 'vector-effect': 'non-scaling-stroke', cursor: 'pointer' }"
|
151
|
-
pointer-events="all"
|
152
|
-
@mousedown="onConnectionMouseDown(ELineBindAnchors.Left, $event)"
|
153
|
-
/>
|
154
|
-
<circle
|
155
|
-
id="connection_r"
|
156
|
-
:cx="
|
157
|
-
props.itemInfo.actual_bound.x -
|
158
|
-
offset +
|
159
|
-
props.itemInfo.actual_bound.width +
|
160
|
-
getCoordinateOffset(props.itemInfo.actual_bound.width, props.itemInfo.scale_x) +
|
161
|
-
radius
|
162
|
-
"
|
163
|
-
:cy="
|
164
|
-
props.itemInfo.actual_bound.y -
|
165
|
-
offset +
|
166
|
-
(props.itemInfo.actual_bound.height * props.itemInfo.scale_y) / 2 -
|
167
|
-
getCoordinateOffset(props.itemInfo.actual_bound.height, props.itemInfo.scale_y) +
|
168
|
-
radius
|
169
|
-
"
|
170
|
-
:r="radius"
|
171
|
-
stroke="rgba(0,0,0,0)"
|
172
|
-
stroke-width="2"
|
173
|
-
:fill="fill"
|
174
|
-
:style="{ 'vector-effect': 'non-scaling-stroke', cursor: 'pointer' }"
|
175
|
-
pointer-events="all"
|
176
|
-
@mousedown="onConnectionMouseDown(ELineBindAnchors.Right, $event)"
|
177
|
-
/>
|
178
|
-
<circle
|
179
|
-
id="connection_bc"
|
180
|
-
:cx="props.itemInfo.actual_bound.x - offset + props.itemInfo.actual_bound.width / 2 + radius"
|
181
|
-
:cy="
|
182
|
-
props.itemInfo.actual_bound.y -
|
183
|
-
offset +
|
184
|
-
props.itemInfo.actual_bound.height +
|
185
|
-
getCoordinateOffset(props.itemInfo.actual_bound.height, props.itemInfo.scale_y) +
|
186
|
-
radius
|
187
|
-
"
|
188
|
-
:r="radius"
|
189
|
-
stroke="rgba(0,0,0,0)"
|
190
|
-
stroke-width="2"
|
191
|
-
:fill="fill"
|
192
|
-
:style="{ 'vector-effect': 'non-scaling-stroke', cursor: 'pointer' }"
|
193
|
-
pointer-events="all"
|
194
|
-
@mousedown="onConnectionMouseDown(ELineBindAnchors.BottomCenter, $event)"
|
195
|
-
/>
|
98
|
+
<g
|
99
|
+
style="vector-effect: non-scaling-stroke"
|
100
|
+
class="connect-points"
|
101
|
+
:fill="fill"
|
102
|
+
stroke-width="2"
|
103
|
+
stroke="rgba(0,0,0,0)"
|
104
|
+
>
|
105
|
+
<g @mousedown="bindAnchor($event, ELineBindAnchors.TopCenter)">
|
106
|
+
<circle class="out-circle" :cx="cxT" :cy="cyT" :r="outRadius" fill-opacity=".3" />
|
107
|
+
<circle id="connection_tc" :cx="cxT" :cy="cyT" :r="radius" pointer-events="all" />
|
108
|
+
</g>
|
109
|
+
<g @mousedown="bindAnchor($event, ELineBindAnchors.Right)">
|
110
|
+
<circle class="out-circle" :cx="cxR" :cy="cyR" :r="outRadius" fill-opacity=".3" />
|
111
|
+
<circle id="connection_r" :cx="cxR" :cy="cyR" :r="radius" pointer-events="all" />
|
112
|
+
</g>
|
113
|
+
<g @mousedown="bindAnchor($event, ELineBindAnchors.BottomCenter)">
|
114
|
+
<circle class="out-circle" :cx="cxB" :cy="cyB" :r="outRadius" fill-opacity=".3" />
|
115
|
+
<circle id="connection_bc" :cx="cxB" :cy="cyB" :r="radius" pointer-events="all" />
|
116
|
+
</g>
|
117
|
+
<g @mousedown="bindAnchor($event, ELineBindAnchors.Left)">
|
118
|
+
<circle class="out-circle" :cx="cxL" :cy="cyL" :r="outRadius" fill-opacity=".3" />
|
119
|
+
<circle id="connection_l" :cx="cxL" :cy="cyL" :r="radius" :style="{ cursor: 'crosshair' }" pointer-events="all" />
|
120
|
+
</g>
|
196
121
|
</g>
|
197
122
|
</template>
|
123
|
+
<style lang="less" scoped>
|
124
|
+
.connect-points g {
|
125
|
+
cursor: crosshair;
|
126
|
+
|
127
|
+
&:hover {
|
128
|
+
.out-circle {
|
129
|
+
visibility: visible;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
.out-circle {
|
134
|
+
visibility: hidden;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
</style>
|
@@ -6,12 +6,14 @@
|
|
6
6
|
import { EGlobalStoreIntention, EMouseInfoState, EScaleInfoType } from '@/stores/global/types'
|
7
7
|
import type { IDoneJson } from '@/stores/global/types'
|
8
8
|
import { getCoordinateOffset } from '@/utils'
|
9
|
+
import { useConfigStore } from '@/stores/config'
|
9
10
|
|
10
11
|
const props = defineProps<{ itemInfo: IDoneJson }>()
|
11
12
|
const globalStore = useGlobalStore(pinia)
|
13
|
+
const configStore = useConfigStore(pinia)
|
12
14
|
const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
|
13
15
|
const offset = ref(4)
|
14
|
-
const fill = ref('#
|
16
|
+
const fill = ref('#ab712e')
|
15
17
|
const angle_to_cursor = [
|
16
18
|
{
|
17
19
|
start: 338,
|
@@ -63,20 +65,26 @@
|
|
63
65
|
}
|
64
66
|
]
|
65
67
|
const onHandleMouseDown = (type: EScaleInfoType, e: MouseEvent) => {
|
66
|
-
console.log('
|
68
|
+
console.log('handMousedown', e)
|
67
69
|
const { clientX, clientY } = e
|
68
70
|
e.stopPropagation()
|
69
71
|
globalStore.intention = EGlobalStoreIntention.Zoom
|
70
|
-
|
72
|
+
const x = Math.round(
|
73
|
+
(clientX - svgEditLayoutStore.canvasInfo.left) / configStore.svg.scale - svgEditLayoutStore.center_offset.x
|
74
|
+
)
|
75
|
+
const y = Math.round(
|
76
|
+
(clientY - svgEditLayoutStore.canvasInfo.top) / configStore.svg.scale - svgEditLayoutStore.center_offset.y
|
77
|
+
)
|
78
|
+
globalStore.mouse_info = {
|
71
79
|
state: EMouseInfoState.Down,
|
72
|
-
position_x:
|
73
|
-
position_y:
|
74
|
-
now_position_x:
|
75
|
-
now_position_y:
|
80
|
+
position_x: x,
|
81
|
+
position_y: y,
|
82
|
+
now_position_x: x,
|
83
|
+
now_position_y: y,
|
76
84
|
new_position_x: 0,
|
77
85
|
new_position_y: 0
|
78
|
-
}
|
79
|
-
globalStore.
|
86
|
+
}
|
87
|
+
globalStore.scale_info = {
|
80
88
|
type: type,
|
81
89
|
scale_times: {
|
82
90
|
x: props.itemInfo.scale_x,
|
@@ -87,33 +95,33 @@
|
|
87
95
|
y: props.itemInfo.y
|
88
96
|
},
|
89
97
|
symmetric_point: {
|
90
|
-
x:
|
91
|
-
|
92
|
-
Math.abs(clientX - svgEditLayoutStore.center_offset.x - props.itemInfo.client.x) *
|
93
|
-
(clientX - svgEditLayoutStore.center_offset.x < props.itemInfo.client.x ? 1 : -1),
|
94
|
-
y:
|
95
|
-
props.itemInfo.client.y +
|
96
|
-
Math.abs(clientY - svgEditLayoutStore.center_offset.y - props.itemInfo.client.y) *
|
97
|
-
(clientY - svgEditLayoutStore.center_offset.y < props.itemInfo.client.y ? 1 : -1)
|
98
|
+
x: x + Math.abs(x - props.itemInfo.center_position.x) * 2 * (x > props.itemInfo.center_position.x ? -1 : 1),
|
99
|
+
y: y + Math.abs(y - props.itemInfo.center_position.y) * 2 * (y > props.itemInfo.center_position.y ? -1 : 1)
|
98
100
|
}
|
99
|
-
}
|
101
|
+
}
|
100
102
|
}
|
101
103
|
const onRotateCircleMouseDown = (e: MouseEvent) => {
|
102
104
|
const { clientX, clientY } = e
|
105
|
+
const x = Math.round(
|
106
|
+
(clientX - svgEditLayoutStore.canvasInfo.left) / configStore.svg.scale - svgEditLayoutStore.center_offset.x
|
107
|
+
)
|
108
|
+
const y = Math.round(
|
109
|
+
(clientY - svgEditLayoutStore.canvasInfo.top) / configStore.svg.scale - svgEditLayoutStore.center_offset.y
|
110
|
+
)
|
103
111
|
e.stopPropagation()
|
104
112
|
globalStore.intention = EGlobalStoreIntention.Rotate
|
105
113
|
globalStore.rotate_info = {
|
106
114
|
angle: props.itemInfo.rotate
|
107
115
|
}
|
108
|
-
globalStore.
|
116
|
+
globalStore.mouse_info = {
|
109
117
|
state: EMouseInfoState.Down,
|
110
|
-
position_x:
|
111
|
-
position_y:
|
112
|
-
now_position_x:
|
113
|
-
now_position_y:
|
118
|
+
position_x: x,
|
119
|
+
position_y: y,
|
120
|
+
now_position_x: x,
|
121
|
+
now_position_y: y,
|
114
122
|
new_position_x: 0,
|
115
123
|
new_position_y: 0
|
116
|
-
}
|
124
|
+
}
|
117
125
|
}
|
118
126
|
/**
|
119
127
|
* 获取旋转之后的光标样式
|
@@ -31,17 +31,15 @@
|
|
31
31
|
import { useGlobalStore } from '@/stores/global'
|
32
32
|
import { useConfigStore } from '@/stores/config'
|
33
33
|
import { fileRead, fileWrite } from '@/utils/file-read-write'
|
34
|
+
import { useEditPrivateStore } from '@/stores/system'
|
34
35
|
|
35
36
|
const props = withDefaults(defineProps<{ customToolbar?: IConfig; data?: string; saveFile?: boolean }>(), {
|
36
37
|
saveFile: false
|
37
38
|
})
|
38
|
-
const presetLine = ref([])
|
39
|
-
const input = (list: any) => {
|
40
|
-
presetLine.value = list
|
41
|
-
}
|
42
39
|
const globalStore = useGlobalStore(pinia)
|
43
40
|
const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
|
44
41
|
const configStore = useConfigStore(pinia)
|
42
|
+
const editPrivateStore = useEditPrivateStore(pinia)
|
45
43
|
const importJsonRef = ref<InstanceType<typeof ImportJson>>()
|
46
44
|
const visible_conf: IVisibleConf = reactive({
|
47
45
|
[EVisibleConfKey.ExportJson]: false,
|
@@ -74,6 +72,9 @@
|
|
74
72
|
globalStore.setDoneJson(done_json)
|
75
73
|
}
|
76
74
|
onMounted(() => {
|
75
|
+
//清除外部传入不同数据,形成历史记录的问题
|
76
|
+
editPrivateStore.history_doneComponent = []
|
77
|
+
editPrivateStore.history_now_index = 0
|
77
78
|
if (props.data) {
|
78
79
|
useImportDataModel(props.data)
|
79
80
|
} else {
|
@@ -81,9 +82,6 @@
|
|
81
82
|
}
|
82
83
|
globalStore.intention = EGlobalStoreIntention.None
|
83
84
|
})
|
84
|
-
defineExpose({
|
85
|
-
setGraphNodeJson
|
86
|
-
})
|
87
85
|
|
88
86
|
const { appContext } = getCurrentInstance()!
|
89
87
|
|
@@ -101,6 +99,10 @@
|
|
101
99
|
emits('onSave', d)
|
102
100
|
}
|
103
101
|
}
|
102
|
+
|
103
|
+
defineExpose({
|
104
|
+
setGraphNodeJson
|
105
|
+
})
|
104
106
|
</script>
|
105
107
|
<template>
|
106
108
|
<div>
|
@@ -114,27 +116,27 @@
|
|
114
116
|
></top-panel>
|
115
117
|
</el-header>
|
116
118
|
<el-container class="middle">
|
117
|
-
<el-aside
|
119
|
+
<el-aside
|
120
|
+
class="side-nav"
|
121
|
+
:class="svgEditLayoutStore.left_nav ? 'show-nav' : 'hide-nav'"
|
122
|
+
style="border-right: 1px solid #efefef"
|
123
|
+
>
|
118
124
|
<el-scrollbar class="el-scroll-pc">
|
119
125
|
<left-panel class="content-left" :custom-toolbar="props.customToolbar" />
|
120
126
|
</el-scrollbar>
|
121
127
|
</el-aside>
|
122
128
|
<el-main class="middle main">
|
123
129
|
<div class="canvas-main-pc">
|
124
|
-
<Vue3RulerTool
|
125
|
-
|
126
|
-
:value="presetLine"
|
127
|
-
:step-length="50"
|
128
|
-
:parent="true"
|
129
|
-
:is-scale-revise="false"
|
130
|
-
v-model:visible="configStore.svg.ruler"
|
131
|
-
@input="input"
|
132
|
-
>
|
133
|
-
<center-panel></center-panel>
|
130
|
+
<Vue3RulerTool class="canvas-main-pc" :visible="configStore.svg.ruler">
|
131
|
+
<center-panel />
|
134
132
|
</Vue3RulerTool>
|
135
133
|
</div>
|
136
134
|
</el-main>
|
137
|
-
<el-aside
|
135
|
+
<el-aside
|
136
|
+
class="side-nav"
|
137
|
+
:class="svgEditLayoutStore.right_nav ? 'show-nav' : 'hide-nav'"
|
138
|
+
style="border-left: 1px solid #efefef"
|
139
|
+
>
|
138
140
|
<el-scrollbar class="el-scroll-pc">
|
139
141
|
<right-panel></right-panel>
|
140
142
|
</el-scrollbar>
|
@@ -177,9 +179,9 @@
|
|
177
179
|
height: calc(100vh - @headerHeight - 1px);
|
178
180
|
|
179
181
|
&.main {
|
180
|
-
margin: 0 5px;
|
181
182
|
background-color: #ffffff;
|
182
|
-
padding: 0
|
183
|
+
padding: 0;
|
184
|
+
overflow: hidden;
|
183
185
|
}
|
184
186
|
|
185
187
|
.side-nav {
|
@@ -188,8 +190,6 @@
|
|
188
190
|
position: relative;
|
189
191
|
overflow: inherit;
|
190
192
|
transition: all 0.5s;
|
191
|
-
// background-color: rgb(250, 251, 253);
|
192
|
-
box-shadow: 0 0 2px #dfcfcf;
|
193
193
|
|
194
194
|
.content-left {
|
195
195
|
overflow: hidden;
|
@@ -214,8 +214,7 @@
|
|
214
214
|
display: flex;
|
215
215
|
flex-direction: row;
|
216
216
|
align-items: center;
|
217
|
-
|
218
|
-
margin-bottom: 1px;
|
217
|
+
border-bottom: 1px solid #efefef;
|
219
218
|
height: @headerHeight;
|
220
219
|
}
|
221
220
|
|
@@ -37,10 +37,10 @@
|
|
37
37
|
</script>
|
38
38
|
<template>
|
39
39
|
<div>
|
40
|
-
<el-collapse v-model="activeNames">
|
40
|
+
<el-collapse v-model="activeNames" style="border-top: none">
|
41
41
|
<el-collapse-item :name="item.groupType" v-for="item of left_tool_bar" :key="item.title">
|
42
42
|
<template #title>
|
43
|
-
<div
|
43
|
+
<div>{{ item.title }}</div>
|
44
44
|
</template>
|
45
45
|
<div class="component-group flex flex-wrap">
|
46
46
|
<div
|