@zhangqingcq/vgce 0.0.20 → 0.0.21
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 +15857 -15275
- 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 +15 -22
- 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
@@ -1,64 +1,64 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
const props = withDefaults(defineProps<{ id: string }>(), { id: '' })
|
3
|
-
const nowTime = ref(new Date())
|
4
|
-
const s = nowTime.value.getSeconds()
|
5
|
-
const m = nowTime.value.getMinutes()
|
6
|
-
const h = Math.floor((nowTime.value.getHours() + (m + s / 60) / 60) * 30)
|
7
|
-
</script>
|
8
|
-
<template>
|
9
|
-
<g :id="props.id">
|
10
|
-
<symbol :id="`${props.id}clock-a-n`" viewBox="0 0 1024 1024">
|
11
|
-
<path d="M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z" fill="#429BCF" />
|
12
|
-
<path d="M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z" fill="#FFFFFF" />
|
13
|
-
<path
|
14
|
-
d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z"
|
15
|
-
fill="#2D416C"
|
16
|
-
>
|
17
|
-
<animateTransform
|
18
|
-
attributeName="transform"
|
19
|
-
attributeType="XML"
|
20
|
-
type="rotate"
|
21
|
-
:from="`${-45 + h} 512.3 506.3`"
|
22
|
-
:to="`${315 + h} 512.3 506.3`"
|
23
|
-
dur="43200s"
|
24
|
-
repeatCount="indefinite"
|
25
|
-
/>
|
26
|
-
</path>
|
27
|
-
<path
|
28
|
-
d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z"
|
29
|
-
fill="#365087"
|
30
|
-
>
|
31
|
-
<animateTransform
|
32
|
-
attributeName="transform"
|
33
|
-
attributeType="XML"
|
34
|
-
type="rotate"
|
35
|
-
:from="`${45 + m * 6} 512.3 506.3`"
|
36
|
-
:to="`${405 + m * 6} 512.3 506.3`"
|
37
|
-
dur="3600s"
|
38
|
-
repeatCount="indefinite"
|
39
|
-
/>
|
40
|
-
</path>
|
41
|
-
<path d="M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z" fill="#365087" />
|
42
|
-
<path
|
43
|
-
d="M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z"
|
44
|
-
fill="#2D416C"
|
45
|
-
/>
|
46
|
-
<path
|
47
|
-
d="M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z"
|
48
|
-
fill="#C11B16"
|
49
|
-
>
|
50
|
-
<animateTransform
|
51
|
-
attributeName="transform"
|
52
|
-
attributeType="XML"
|
53
|
-
type="rotate"
|
54
|
-
:from="`${135.5 + s * 6} 512.3 506.3`"
|
55
|
-
:to="`${495.5 + s * 6} 512.3 506.3`"
|
56
|
-
dur="60s"
|
57
|
-
repeatCount="indefinite"
|
58
|
-
/>
|
59
|
-
</path>
|
60
|
-
<path d="M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z" fill="#fff" />
|
61
|
-
</symbol>
|
62
|
-
<use :xlink:href="`#${props.id}clock-a-n`" width="
|
63
|
-
</g>
|
64
|
-
</template>
|
1
|
+
<script lang="ts" setup>
|
2
|
+
const props = withDefaults(defineProps<{ id: string }>(), { id: '' })
|
3
|
+
const nowTime = ref(new Date())
|
4
|
+
const s = nowTime.value.getSeconds()
|
5
|
+
const m = nowTime.value.getMinutes()
|
6
|
+
const h = Math.floor((nowTime.value.getHours() + (m + s / 60) / 60) * 30)
|
7
|
+
</script>
|
8
|
+
<template>
|
9
|
+
<g :id="props.id">
|
10
|
+
<symbol :id="`${props.id}clock-a-n`" viewBox="0 0 1024 1024">
|
11
|
+
<path d="M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z" fill="#429BCF" />
|
12
|
+
<path d="M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z" fill="#FFFFFF" />
|
13
|
+
<path
|
14
|
+
d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z"
|
15
|
+
fill="#2D416C"
|
16
|
+
>
|
17
|
+
<animateTransform
|
18
|
+
attributeName="transform"
|
19
|
+
attributeType="XML"
|
20
|
+
type="rotate"
|
21
|
+
:from="`${-45 + h} 512.3 506.3`"
|
22
|
+
:to="`${315 + h} 512.3 506.3`"
|
23
|
+
dur="43200s"
|
24
|
+
repeatCount="indefinite"
|
25
|
+
/>
|
26
|
+
</path>
|
27
|
+
<path
|
28
|
+
d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z"
|
29
|
+
fill="#365087"
|
30
|
+
>
|
31
|
+
<animateTransform
|
32
|
+
attributeName="transform"
|
33
|
+
attributeType="XML"
|
34
|
+
type="rotate"
|
35
|
+
:from="`${45 + m * 6} 512.3 506.3`"
|
36
|
+
:to="`${405 + m * 6} 512.3 506.3`"
|
37
|
+
dur="3600s"
|
38
|
+
repeatCount="indefinite"
|
39
|
+
/>
|
40
|
+
</path>
|
41
|
+
<path d="M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z" fill="#365087" />
|
42
|
+
<path
|
43
|
+
d="M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z"
|
44
|
+
fill="#2D416C"
|
45
|
+
/>
|
46
|
+
<path
|
47
|
+
d="M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z"
|
48
|
+
fill="#C11B16"
|
49
|
+
>
|
50
|
+
<animateTransform
|
51
|
+
attributeName="transform"
|
52
|
+
attributeType="XML"
|
53
|
+
type="rotate"
|
54
|
+
:from="`${135.5 + s * 6} 512.3 506.3`"
|
55
|
+
:to="`${495.5 + s * 6} 512.3 506.3`"
|
56
|
+
dur="60s"
|
57
|
+
repeatCount="indefinite"
|
58
|
+
/>
|
59
|
+
</path>
|
60
|
+
<path d="M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z" fill="#fff" />
|
61
|
+
</symbol>
|
62
|
+
<use :xlink:href="`#${props.id}clock-a-n`" width="100" height="100" />
|
63
|
+
</g>
|
64
|
+
</template>
|
@@ -2,9 +2,10 @@ import type { IConfigComponentGroup } from '@/config/types'
|
|
2
2
|
import { alternator_svg_file } from './alternator'
|
3
3
|
import { svg_house } from './house'
|
4
4
|
import { svg_bot_2 } from './bot-2'
|
5
|
+
import { sheet_border } from './sheet-border'
|
5
6
|
|
6
7
|
export const stateless_group: IConfigComponentGroup = {
|
7
8
|
groupType: 'stateless',
|
8
|
-
title: '
|
9
|
-
list: [alternator_svg_file, svg_house, svg_bot_2]
|
9
|
+
title: '静态SVG',
|
10
|
+
list: [alternator_svg_file, svg_house, svg_bot_2, sheet_border]
|
10
11
|
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { EDoneJsonType } from '@/config/types'
|
2
|
+
import type { IConfigItem } from '@/config/types'
|
3
|
+
|
4
|
+
export const sheet_border: IConfigItem = {
|
5
|
+
name: 'sheet-border',
|
6
|
+
title: '田字格',
|
7
|
+
type: EDoneJsonType.File,
|
8
|
+
display: true,
|
9
|
+
config: {
|
10
|
+
can_zoom: true,
|
11
|
+
have_anchor: true,
|
12
|
+
actual_rect: true
|
13
|
+
},
|
14
|
+
props: {},
|
15
|
+
common_animations: {
|
16
|
+
val: '',
|
17
|
+
delay: 'delay-0s',
|
18
|
+
speed: 'slow',
|
19
|
+
repeat: 'infinite'
|
20
|
+
},
|
21
|
+
events: []
|
22
|
+
}
|
package/src/config/types.ts
CHANGED
@@ -5,14 +5,6 @@ export interface IPositionCenter {
|
|
5
5
|
export interface IPositionCenterSvg {
|
6
6
|
background_color: string
|
7
7
|
scale: number
|
8
|
-
position_center: {
|
9
|
-
x: number
|
10
|
-
y: number
|
11
|
-
}
|
12
|
-
svg_position_center: {
|
13
|
-
x: number
|
14
|
-
y: number
|
15
|
-
}
|
16
8
|
grid: boolean
|
17
9
|
ruler: boolean
|
18
10
|
}
|
@@ -52,7 +52,6 @@ export const useGlobalStore = defineStore('global-store', {
|
|
52
52
|
}
|
53
53
|
}
|
54
54
|
},
|
55
|
-
getters: {},
|
56
55
|
actions: {
|
57
56
|
setCreateInfo(create_svg_info: IConfigItem | null) {
|
58
57
|
this.intention = EGlobalStoreIntention.Create
|
@@ -74,9 +73,6 @@ export const useGlobalStore = defineStore('global-store', {
|
|
74
73
|
useHistoryRecord(objectDeepClone<IDoneJson[]>(this.done_json))
|
75
74
|
})
|
76
75
|
},
|
77
|
-
setMouseInfo(mouse_info: IMouseInfo) {
|
78
|
-
this.mouse_info = mouse_info
|
79
|
-
},
|
80
76
|
setHandleSvgInfo(info: IDoneJson | null, index?: number) {
|
81
77
|
let current_index = index
|
82
78
|
if (info) {
|
@@ -92,9 +88,6 @@ export const useGlobalStore = defineStore('global-store', {
|
|
92
88
|
this.handle_svg_info = info
|
93
89
|
}
|
94
90
|
},
|
95
|
-
setScaleInfo(info: IScaleInfo) {
|
96
|
-
this.scale_info = info
|
97
|
-
},
|
98
91
|
spliceDoneJson(index: number) {
|
99
92
|
const globalStore = useGlobalStore()
|
100
93
|
globalStore.done_json.splice(index, 1)
|
@@ -102,6 +95,3 @@ export const useGlobalStore = defineStore('global-store', {
|
|
102
95
|
}
|
103
96
|
}
|
104
97
|
})
|
105
|
-
// useGlobalStore().$subscribe((mutation, state) => {
|
106
|
-
// console.log(mutation, state, 102);
|
107
|
-
// });
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { IConfig, IConfigItem } from '@/config/types'
|
2
|
+
import type { IBindAnchors } from '@/components/config/types'
|
2
3
|
|
3
4
|
export interface IGlobalStore {
|
4
5
|
config_center: IConfig
|
@@ -11,6 +12,18 @@ export interface IGlobalStore {
|
|
11
12
|
rotate_info: IRotateInfo
|
12
13
|
connection_line_node_info: IConnectionLineNodeInfo
|
13
14
|
}
|
15
|
+
|
16
|
+
export interface IPointCoordinate {
|
17
|
+
tl: ICoordinate
|
18
|
+
tc: ICoordinate
|
19
|
+
tr: ICoordinate
|
20
|
+
l: ICoordinate
|
21
|
+
r: ICoordinate
|
22
|
+
bl: ICoordinate
|
23
|
+
bc: ICoordinate
|
24
|
+
br: ICoordinate
|
25
|
+
}
|
26
|
+
|
14
27
|
export interface IDoneJson extends IConfigItem {
|
15
28
|
id: string
|
16
29
|
x: number
|
@@ -25,29 +38,32 @@ export interface IDoneJson extends IConfigItem {
|
|
25
38
|
width: number
|
26
39
|
height: number
|
27
40
|
}
|
28
|
-
point_coordinate:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
br: ICoordinate
|
41
|
+
point_coordinate: IPointCoordinate
|
42
|
+
point_coordinate_old?: IPointCoordinate
|
43
|
+
selected?: boolean
|
44
|
+
old_position?: { x: number; y: number }
|
45
|
+
center_position: { x: number; y: number }
|
46
|
+
bind_anchors?: {
|
47
|
+
start: IBindAnchors | null
|
48
|
+
end: IBindAnchors | null
|
37
49
|
}
|
38
50
|
}
|
51
|
+
|
39
52
|
export enum EGlobalStoreIntention {
|
40
53
|
None = 'None',
|
41
54
|
Create = 'Create',
|
42
55
|
Move = 'Move',
|
56
|
+
GroupMove = 'GroupMove',
|
43
57
|
MoveCanvas = 'MoveCanvas',
|
44
58
|
Select = 'Select',
|
45
59
|
Zoom = 'Zoom',
|
46
60
|
Rotate = 'Rotate',
|
47
61
|
Connection = 'Connection',
|
48
62
|
SetConnectionLineNode = 'SetConnectionLineNode',
|
49
|
-
ContextMenu = 'ContextMenu'
|
63
|
+
ContextMenu = 'ContextMenu',
|
64
|
+
SelectArea = 'SelectArea'
|
50
65
|
}
|
66
|
+
|
51
67
|
export interface IMouseInfo {
|
52
68
|
state: EMouseInfoState
|
53
69
|
position_x: number //鼠标指针坐标
|
@@ -57,14 +73,17 @@ export interface IMouseInfo {
|
|
57
73
|
new_position_x: number //移动之后目标的坐标
|
58
74
|
new_position_y: number
|
59
75
|
}
|
76
|
+
|
60
77
|
export enum EMouseInfoState {
|
61
78
|
Down = 'Down',
|
62
79
|
Up = 'Up'
|
63
80
|
}
|
81
|
+
|
64
82
|
export interface IHandleSvgInfo {
|
65
83
|
info: IDoneJson
|
66
84
|
index: number
|
67
85
|
}
|
86
|
+
|
68
87
|
/**
|
69
88
|
* 缩放信息
|
70
89
|
*/
|
@@ -85,12 +104,14 @@ export interface IScaleInfo {
|
|
85
104
|
y: number
|
86
105
|
}
|
87
106
|
}
|
107
|
+
|
88
108
|
/**
|
89
109
|
* 旋转信息
|
90
110
|
*/
|
91
111
|
export interface IRotateInfo {
|
92
112
|
angle: number
|
93
113
|
}
|
114
|
+
|
94
115
|
export enum EScaleInfoType {
|
95
116
|
None = '',
|
96
117
|
TopLeft = 'TopLeft',
|
@@ -102,10 +123,12 @@ export enum EScaleInfoType {
|
|
102
123
|
BottomCenter = 'BottomCenter',
|
103
124
|
BottomRight = 'BottomRight'
|
104
125
|
}
|
126
|
+
|
105
127
|
export interface ICoordinate {
|
106
128
|
x: number
|
107
129
|
y: number
|
108
130
|
}
|
131
|
+
|
109
132
|
export interface IConnectionLineNodeInfo {
|
110
133
|
init_pos: {
|
111
134
|
x: number
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { ISvgEditLayoutStore } from './types'
|
2
|
+
|
2
3
|
/**
|
3
4
|
* 编辑器布局状态
|
4
5
|
*/
|
@@ -10,6 +11,12 @@ export const useSvgEditLayoutStore = defineStore('svg-edit-layout-store', {
|
|
10
11
|
center_offset: {
|
11
12
|
x: 0,
|
12
13
|
y: 0
|
14
|
+
},
|
15
|
+
canvasInfo: {
|
16
|
+
with: 0,
|
17
|
+
height: 0,
|
18
|
+
top: 0,
|
19
|
+
left: 0
|
13
20
|
}
|
14
21
|
}
|
15
22
|
}
|