zydx-plus 1.33.354 → 1.33.355

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.33.354",
3
+ "version": "1.33.355",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="drag-pop" :class="{trans: transAll}" :style="position" :id="id" @click.stop="dragTap">
3
- <div class="drag-head" :style="{'background-color':titleColor}">
2
+ <div class="drag-pop" :class="{trans: transAll, 'drag-pop-shadow': !fixedStart}" :style="position" :id="id" @click.stop="dragTap">
3
+ <div v-show="!fixedStart" class="drag-head" :style="{'background-color':titleColor}">
4
4
  <span @mousedown.stop="mousedown"
5
5
  @mousemove.stop="mousemove"
6
6
  @mouseup.stop="mouseup"
@@ -14,16 +14,18 @@
14
14
  <i v-if="closeShow" @click.stop="close"></i>
15
15
  </div>
16
16
  </div>
17
- <div :class="{'drag-cont': dragStatus || dragTextShow,'drag-conts': !dragStatus || !dragTextShow}"
17
+ <div :class="{'drag-cont2': fixedStart,'drag-cont': dragStatus || dragTextShow,'drag-conts': !dragStatus || !dragTextShow}"
18
18
  @mousemove.stop="footMove" @mouseleave.stop="footMove">
19
19
  <div class="drag-cont-slot">
20
20
  <slot name="content"></slot>
21
21
  </div>
22
- <i class="drag-down" v-if="dragStatus" @mousedown.stop="footDown($event,'d')" @mouseup.stop="footUp"></i>
23
- <i class="drag-in" v-if="dragStatus" @mousedown.stop="footDown($event,'in')" @mouseup.stop="footUp"></i>
24
- <i class="drag-right" v-if="dragStatus" @mousedown.stop="footDown($event,'r')" @mouseup.stop="footUp"></i>
22
+ <div v-show="!fixedStart">
23
+ <i class="drag-down" v-if="dragStatus" @mousedown.stop="footDown($event,'d')" @mouseup.stop="footUp"></i>
24
+ <i class="drag-in" v-if="dragStatus" @mousedown.stop="footDown($event,'in')" @mouseup.stop="footUp"></i>
25
+ <i class="drag-right" v-if="dragStatus" @mousedown.stop="footDown($event,'r')" @mouseup.stop="footUp"></i>
26
+ </div>
25
27
  </div>
26
- <div class="down-text" v-if="dragStatus&&dragTextShow">
28
+ <div class="down-text" v-if="dragStatus&&dragTextShow&&!fixedStart">
27
29
  <div class="down-text-cont">
28
30
  <slot name="down"></slot>
29
31
  <!-- <img-->
@@ -52,7 +54,9 @@ export default {
52
54
  state: false,//是否显示
53
55
  clientWidth: 0,
54
56
  clientHeight: 0,
55
- transAll: false
57
+ transAll: false,
58
+ fixedStart: false,
59
+ initWidth: 1280
56
60
  }
57
61
  },
58
62
  props: {
@@ -64,6 +68,18 @@ export default {
64
68
  type: Number,
65
69
  default: 400
66
70
  },
71
+ fixed: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ left: {
76
+ type: Number,
77
+ default: 0
78
+ },
79
+ top: {
80
+ type: Number,
81
+ default: 0
82
+ },
67
83
  titleColor: {
68
84
  type: String,
69
85
  default: 'rgba(19, 191, 108, 1)'
@@ -114,17 +130,25 @@ export default {
114
130
  },
115
131
  watch: {
116
132
  width: {
117
- handler: function (val, oldVal) {
133
+ handler: function (val) {
118
134
  this.footRightOffset = val
119
135
  },
120
136
  immediate: true
121
137
  },
122
138
  height: {
123
- handler: function (val, oldVal) {
139
+ handler: function (val) {
124
140
  this.footDownOffset = val
125
141
  },
126
142
  immediate: true
127
143
  },
144
+ fixed: {
145
+ handler: function (val) {
146
+ this.fixedStart = val
147
+ this.init()
148
+ },
149
+ immediate: true,
150
+ deep: true
151
+ }
128
152
  },
129
153
  mounted() {
130
154
  this.id = Math.random().toString(36).substr(2);
@@ -143,6 +167,21 @@ export default {
143
167
  popArr = (pop === null)? [] : JSON.parse(pop)
144
168
  popArr.push(this.id)
145
169
  sessionStorage.setItem('pop', JSON.stringify(popArr))
170
+ // 监听滚动
171
+ window.onscroll = () => {
172
+ const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
173
+ if(this.fixedStart) {
174
+ this.y = this.top - scrollTop
175
+ }
176
+ }
177
+ // 监听窗口变化
178
+ window.addEventListener('resize', () => {
179
+ const wid = document.getElementById('app').offsetWidth
180
+ if(this.fixedStart) {
181
+ if(wid <= this.initWidth) return
182
+ this.x = this.left + (wid-this.initWidth)/2
183
+ }
184
+ });
146
185
  },
147
186
  computed: {
148
187
  position() {
@@ -174,10 +213,16 @@ export default {
174
213
  this.$emit('dragStatus')
175
214
  },
176
215
  init() {
177
- this.clientWidth = document.documentElement.clientWidth;
178
- this.clientHeight = document.documentElement.clientHeight;
179
- this.x = this.clientWidth / 2 - this.footRightOffset / 2;
180
- this.y = this.clientHeight / 2 - this.footDownOffset / 2;
216
+ if(this.fixedStart) {
217
+ const wid = document.getElementById('app').offsetWidth
218
+ this.x = this.left + (wid-this.initWidth)/2
219
+ this.y = this.top - document.documentElement.scrollTop
220
+ }else {
221
+ this.clientWidth = document.documentElement.clientWidth;
222
+ this.clientHeight = document.documentElement.clientHeight;
223
+ this.x = this.clientWidth / 2 - this.footRightOffset / 2;
224
+ this.y = this.clientHeight / 2 - this.footDownOffset / 2;
225
+ }
181
226
  },
182
227
  getWH(v) {
183
228
  this.transAll = true
@@ -414,13 +459,15 @@ export default {
414
459
  position: fixed;
415
460
  top: 0;
416
461
  left: 0;
417
- box-shadow: 0 0 3px 2px #ccc;
418
462
  background-color: #fff;
419
463
  border-radius: 3px;
420
464
  z-index: 9999;
421
465
  animation: linkDown .3s linear forwards;
422
466
  opacity: 0;
423
467
  }
468
+ .drag-pop-shadow{
469
+ box-shadow: 0 0 3px 2px #ccc;
470
+ }
424
471
  .trans{
425
472
  transition: all .3s;
426
473
  }
@@ -444,4 +491,8 @@ export default {
444
491
  height: calc(100% - 30px);
445
492
  position: relative;
446
493
  }
494
+ .drag-cont2{
495
+ height: 100% !important;
496
+ position: relative;
497
+ }
447
498
  </style>
@@ -312,7 +312,7 @@ export function butJson(editor, data) {
312
312
  name: '上传附件',
313
313
  key: 'group-upload',
314
314
  childMenuKeys: [],
315
- html: `<p contenteditable="false" data-signId="enclosure"><span style="font-weight: 700;font-size: 16px;">附件列表:</span></p>`
315
+ html: `<p data-signId="enclosure"><span style="font-weight: 700;font-size: 16px;">附件列表:</span></p>`
316
316
  },
317
317
  ],
318
318
  }
@@ -3,66 +3,66 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
- import { createElement } from 'react'
7
- import { createRoot } from 'react-dom/client'
8
- import { Tldraw } from 'tldraw'
6
+ import {createElement} from 'react'
7
+ import {createRoot} from 'react-dom/client'
8
+ import {Tldraw} from 'tldraw'
9
9
  import 'tldraw/tldraw.css'
10
10
 
11
11
  const clearJson = {
12
- store:{
13
- "document:document":{
14
- gridSize:10,
15
- name:"",
16
- meta:{},
17
- id:"document:document",
18
- typeName:"document"
19
- },
20
- "page:page":{
21
- meta:{},
22
- id:"page:page",
23
- name:"Page 1",
24
- index:"a1",
25
- typeName:"page"
12
+ store: {
13
+ "document:document": {
14
+ gridSize: 10,
15
+ name: "",
16
+ meta: {},
17
+ id: "document:document",
18
+ typeName: "document"
19
+ },
20
+ "page:page": {
21
+ meta: {},
22
+ id: "page:page",
23
+ name: "Page 1",
24
+ index: "a1",
25
+ typeName: "page"
26
26
  }
27
27
  },
28
- schema:{
29
- schemaVersion:1,
30
- storeVersion:4,
31
- recordVersions:{
32
- asset:{
33
- version:1,
34
- subTypeKey:"type",
35
- subTypeVersions:{
36
- image:3,
37
- video:3,
38
- bookmark:1
28
+ schema: {
29
+ schemaVersion: 1,
30
+ storeVersion: 4,
31
+ recordVersions: {
32
+ asset: {
33
+ version: 1,
34
+ subTypeKey: "type",
35
+ subTypeVersions: {
36
+ image: 3,
37
+ video: 3,
38
+ bookmark: 1
39
39
  }
40
40
  },
41
- camera:{version:1},
42
- document:{version:2},
43
- instance:{version:24},
44
- instance_page_state:{version:5},
45
- page:{"version":1},
46
- shape:{
47
- version:3,
48
- subTypeKey:"type",
49
- subTypeVersions:{
50
- group:0,
51
- text:1,
52
- bookmark:2,
53
- draw:1,
54
- geo:8,
55
- note:5,
56
- line:4,
57
- frame:0,
58
- arrow:3,
59
- highlight:0,
60
- embed:4,
61
- image:3,
62
- video:2
41
+ camera: {version: 1},
42
+ document: {version: 2},
43
+ instance: {version: 24},
44
+ instance_page_state: {version: 5},
45
+ page: {"version": 1},
46
+ shape: {
47
+ version: 3,
48
+ subTypeKey: "type",
49
+ subTypeVersions: {
50
+ group: 0,
51
+ text: 1,
52
+ bookmark: 2,
53
+ draw: 1,
54
+ geo: 8,
55
+ note: 5,
56
+ line: 4,
57
+ frame: 0,
58
+ arrow: 3,
59
+ highlight: 0,
60
+ embed: 4,
61
+ image: 3,
62
+ video: 2
63
63
  }
64
64
  },
65
- instance_presence:{version:5},pointer:{version:1}
65
+ instance_presence: {version: 5}, pointer: {version: 1}
66
66
  }
67
67
  }
68
68
  }
@@ -71,113 +71,252 @@ export default {
71
71
  name: "zydx-sketchpad",
72
72
  data() {
73
73
  return {
74
- editor:null
74
+ editor: null
75
75
  }
76
76
  },
77
77
  mounted() {
78
+ // 鼠标移入
79
+ this.$refs.reactRef.addEventListener('mouseover', () => {
80
+ document.body.style.overflow = 'hidden'
81
+ });
82
+ // 鼠标移出
83
+ this.$refs.reactRef.addEventListener('mouseleave', () => {
84
+ document.body.style.overflow = 'visible'
85
+ });
86
+
78
87
  const root = createRoot(this.$refs.reactRef)
79
88
  root.render(createElement(Tldraw, {
80
89
  onMount: this.handleMountedEditor,
81
- hideUi: true
90
+ hideUi: true, // 隐藏UI
91
+ // persistenceKey: "example111" // 持久化名字
92
+ autoFocus: false // 聚焦
82
93
  }, null))
83
94
  },
84
95
  methods: {
85
96
  handleMountedEditor(editor) {
97
+ console.log('editor', editor)
86
98
  this.editor = editor
87
- // editor.store.listen((entry) => {
88
- // const up = entry.changes.updated
89
- // })
99
+ setTimeout(() => {
100
+ document.documentElement.scrollTop = 0
101
+ }, 0)
90
102
  },
91
103
  // 清空
92
104
  clear() {
93
105
  this.editor.store.loadSnapshot(clearJson)
106
+ this.isFocused()
94
107
  },
95
108
  // 添加快照
96
109
  setSnapshot(v) {
97
110
  this.editor.store.loadSnapshot(v)
111
+ this.isFocused()
98
112
  },
99
113
  // 获取快照
100
114
  getSnapshot() {
101
115
  return this.editor.store.getSnapshot()
102
116
  },
103
117
  draw(v) {
104
- this.styleProps('draw','color').defaultValue = v?.color?? 'black'
105
- this.styleProps('draw','size').defaultValue = v?.size?? 'm'
118
+ this.styleProps('draw', 'color').defaultValue = v?.color ?? 'black'
119
+ this.styleProps('draw', 'size').defaultValue = v?.size ?? 'm'
120
+ this.styleProps('draw', 'dash').defaultValue = v?.dash ?? 'draw'
121
+ this.styleProps('draw', 'fill').defaultValue = v?.fill ?? 'none'
106
122
  this.editor.setCurrentTool('draw')
107
123
  },
108
124
  select() {
109
125
  this.editor.setCurrentTool('select')
110
126
  },
111
127
  hand() {
112
- this.editor.setCurrentTool('hand')
128
+ this.editor.setCurrentTool('hand')
113
129
  },
114
130
  eraser() {
115
131
  this.editor.setCurrentTool('eraser')
116
132
  },
117
133
  arrow(v) {
118
- this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
119
- this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
134
+ // 'none', 'semi', 'solid', 'pattern'
135
+ this.styleProps('arrow', 'color').defaultValue = v?.color ?? 'black'
136
+ this.styleProps('arrow', 'size').defaultValue = v?.size ?? 'm'
137
+ this.styleProps('arrow', 'dash').defaultValue = v?.dash ?? 'draw'
138
+ this.styleProps('arrow', 'fill').defaultValue = v?.fill ?? 'none'
120
139
  this.editor.setCurrentTool('arrow')
121
140
  },
122
141
  text(v) {
123
- this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
124
- this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
142
+ this.styleProps('arrow', 'color').defaultValue = v?.color ?? 'black'
143
+ this.styleProps('arrow', 'size').defaultValue = v?.size ?? 'm'
144
+ this.styleProps('arrow', 'font').defaultValue = v?.font ?? 'draw' //['draw', 'sans', 'serif', 'mono']
145
+ this.styleProps('arrow', 'align').defaultValue = v?.align ?? 'start'
125
146
  this.editor.setCurrentTool('text')
126
147
  },
127
148
  line(v) {
128
- this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
129
- this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
149
+ this.styleProps('arrow', 'color').defaultValue = v?.color ?? 'black'
150
+ this.styleProps('arrow', 'size').defaultValue = v?.size ?? 'm'
151
+ this.styleProps('arrow', 'dash').defaultValue = v?.dash ?? 'draw'
152
+ this.styleProps('arrow', 'fill').defaultValue = v?.fill ?? 'none'
130
153
  this.editor.setCurrentTool('line')
131
154
  },
132
155
  rectangle(v) {
133
- this.styleProps('geo','geo').defaultValue = 'rectangle'
134
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
135
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
156
+ this.styleProps('geo', 'geo').defaultValue = 'rectangle'
157
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
158
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
159
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
160
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
136
161
  this.editor.setCurrentTool('geo')
137
162
  },
138
163
  ellipse(v) {
139
- this.styleProps('geo','geo').defaultValue = 'ellipse'
140
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
141
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
164
+ this.styleProps('geo', 'geo').defaultValue = 'ellipse'
165
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
166
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
167
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
168
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
142
169
  this.editor.setCurrentTool('geo')
143
170
  },
144
171
  triangle(v) {
145
- this.styleProps('geo','geo').defaultValue = 'triangle'
146
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
147
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
172
+ this.styleProps('geo', 'geo').defaultValue = 'triangle'
173
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
174
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
175
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
176
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
177
+ this.editor.setCurrentTool('geo')
178
+ },
179
+
180
+ rhombus(v) {
181
+ this.styleProps('geo', 'geo').defaultValue = 'rhombus'
182
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
183
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
184
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
185
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
186
+ this.editor.setCurrentTool('geo')
187
+ },
188
+ cloud(v) {
189
+ this.styleProps('geo', 'geo').defaultValue = 'cloud'
190
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
191
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
192
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
193
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
194
+ this.editor.setCurrentTool('geo')
195
+ },
196
+ trapezoid(v) {
197
+ this.styleProps('geo', 'geo').defaultValue = 'trapezoid'
198
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
199
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
200
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
201
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
202
+ this.editor.setCurrentTool('geo')
203
+ },
204
+ diamond(v) {
205
+ this.styleProps('geo', 'geo').defaultValue = 'diamond'
206
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
207
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
208
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
209
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
148
210
  this.editor.setCurrentTool('geo')
149
211
  },
150
212
  star(v) {
151
- this.styleProps('geo','geo').defaultValue = 'star'
152
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
153
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
213
+ this.styleProps('geo', 'geo').defaultValue = 'star'
214
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
215
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
216
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
217
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
218
+ this.editor.setCurrentTool('geo')
219
+ },
220
+
221
+ xBox(v) {
222
+ this.styleProps('geo', 'geo').defaultValue = 'x-box'
223
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
224
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
225
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
226
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
227
+ this.editor.setCurrentTool('geo')
228
+ },
229
+ checkBox(v) {
230
+ this.styleProps('geo', 'geo').defaultValue = 'check-box'
231
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
232
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
233
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
234
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
235
+ this.editor.setCurrentTool('geo')
236
+ },
237
+ oval(v) {
238
+ this.styleProps('geo', 'geo').defaultValue = 'oval'
239
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
240
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
241
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
242
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
243
+ this.editor.setCurrentTool('geo')
244
+ },
245
+ arrowLeft(v) {
246
+ this.styleProps('geo', 'geo').defaultValue = 'arrow-left'
247
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
248
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
249
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
250
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
251
+ this.editor.setCurrentTool('geo')
252
+ },
253
+ arrowRight(v) {
254
+ this.styleProps('geo', 'geo').defaultValue = 'arrow-right'
255
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
256
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
257
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
258
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
259
+ this.editor.setCurrentTool('geo')
260
+ },
261
+ arrowUp(v) {
262
+ this.styleProps('geo', 'geo').defaultValue = 'arrow-up'
263
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
264
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
265
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
266
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
267
+ this.editor.setCurrentTool('geo')
268
+ },
269
+ arrowDown(v) {
270
+ this.styleProps('geo', 'geo').defaultValue = 'arrow-down'
271
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
272
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
273
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
274
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
275
+ this.editor.setCurrentTool('geo')
276
+ },
277
+ hexagon(v) {
278
+ this.styleProps('geo', 'geo').defaultValue = 'hexagon'
279
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
280
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
281
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
282
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
154
283
  this.editor.setCurrentTool('geo')
155
284
  },
156
285
  highlight(v) {
157
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
158
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
286
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
287
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
288
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
289
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
159
290
  this.editor.setCurrentTool('highlight')
160
291
  },
161
292
  laser() {
162
293
  this.editor.setCurrentTool('laser')
163
294
  },
164
- undo(){
295
+ undo() {
165
296
  this.editor.undo()
166
297
  },
167
- redo(){
298
+ redo() {
168
299
  this.editor.redo()
169
300
  },
170
- styleProps(t,e) {
301
+ styleProps(t, e) {
171
302
  const style = [...this.editor.styleProps[t]]
172
303
  const index = style.findIndex(item => item[1] === e)
173
304
  return style[index][0]
305
+ },
306
+ // 重新获取焦点
307
+ isFocused() {
308
+ const top = document.documentElement.scrollTop
309
+ setTimeout(() => {
310
+ this.editor.updateInstanceState({isFocused: true})
311
+ document.documentElement.scrollTop = top
312
+ }, 10)
174
313
  }
175
314
  }
176
315
  }
177
316
  </script>
178
317
 
179
318
  <style scoped>
180
- .react{
319
+ .react {
181
320
  width: 100%;
182
321
  height: 100%;
183
322
  }
package/src/index.js CHANGED
@@ -83,7 +83,7 @@ function install(app) {
83
83
  }
84
84
 
85
85
  export default {
86
- version: '1.33.354',
86
+ version: '1.33.355',
87
87
  install,
88
88
  Calendar,
89
89
  Message,