vue-wiring-diagram 1.0.11 → 1.0.12

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": "vue-wiring-diagram",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "A Vue 3.x component for wiring diagram",
5
5
  "type": "module",
6
6
  "main": "dist/vue-wiring-diagram.umd.js",
@@ -306,8 +306,8 @@ const initStencil = () => {
306
306
  placeholder: '搜索',
307
307
  notFoundText: '未找到匹配项',
308
308
  getDragNode: (node) => {
309
- const copyNode = node.clone({ keepId: true })
310
- if(copyNode.label !== '文本') {
309
+ const copyNode = node.clone({keepId: true})
310
+ if (copyNode.label !== '文本') {
311
311
  copyNode.label = ''
312
312
  }
313
313
  return copyNode
@@ -349,33 +349,31 @@ const initStencil = () => {
349
349
  // 添加 hover 事件监听器
350
350
  setTimeout(() => {
351
351
  const nodes = stencil.value.container.querySelectorAll('.x6-node');
352
- nodes.forEach((node,index) => {
353
- if(index > baseShape.length) {
352
+ nodes.forEach((node, index) => {
353
+ if (index > baseShape.length) {
354
354
  const text = node.querySelector('text');
355
355
  node.style.position = 'relative';
356
- if(text) {
356
+ if (text) {
357
357
  text.style.display = 'none';
358
- // text 为 svg 控制位置
359
358
  text.setAttribute('x', '0%');
360
- text.setAttribute('y', '30%');
359
+ text.setAttribute('y', '40');
361
360
  text.style.fontSize = '12px';
362
- text.style.fontWeight = 'bold';
363
361
  text.style.fill = '#ffffff';
364
362
  }
365
363
  }
366
364
  // 添加 hover 事件监听器
367
365
  node.addEventListener('mouseenter', (e) => {
368
- if(index > baseShape.length) {
366
+ if (index > baseShape.length) {
369
367
  const text = node.querySelector('text');
370
- if(text) {
368
+ if (text) {
371
369
  text.style.display = 'block';
372
370
  }
373
371
  }
374
372
  })
375
373
  node.addEventListener('mouseleave', (e) => {
376
- if(index > baseShape.length) {
374
+ if (index > baseShape.length) {
377
375
  const text = node.querySelector('text');
378
- if(text) {
376
+ if (text) {
379
377
  text.style.display = 'none';
380
378
  }
381
379
  }
@@ -214,7 +214,7 @@ const replaceAllTemplateLiteralsWithArray = (str, replacements) => {
214
214
  * \@description 画布自适应
215
215
  */
216
216
  const zoomToFit = () => {
217
- graph.value.zoomToFit({maxScale: 1, padding: 20})
217
+ graph.value.zoomToFit({maxScale: 10, padding: 20})
218
218
  }
219
219
 
220
220
  const previewRef = shallowRef()
@@ -27,8 +27,9 @@ export const stencilOptions = {
27
27
  stencilGraphHeight: 0,
28
28
  layoutOptions: {
29
29
  columns: 3,
30
- columnWidth: 70,
31
- resizeToFit: true
30
+ columnWidth: 74,
31
+ resizeToFit: true,
32
+ center: true,
32
33
  },
33
34
  }
34
35