fl-web-component 2.0.0-beta.8 → 2.0.0
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/dist/fl-web-component.common.js +34645 -1611
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/package.json +4 -15
- package/packages/components/com-card/index.vue +1 -1
- package/packages/components/com-flcanvas/components/bspline.js +31 -34
- package/packages/components/com-flcanvas/components/entityFormatting.js +810 -849
- package/packages/components/com-flcanvas/components/round10.js +17 -17
- package/packages/components/com-flcanvas/index.vue +314 -333
- package/packages/components/com-formDialog/index.vue +6 -4
- package/packages/components/com-graphics/component/ann-tool.vue +263 -208
- package/packages/components/com-graphics/index.vue +366 -773
- package/packages/components/com-graphics/pid.vue +304 -295
- package/packages/components/com-table/column-default.vue +2 -3
- package/packages/components/com-table/column-dynamic.vue +7 -4
- package/packages/components/com-table/column.vue +1 -2
- package/packages/components/com-table/index.vue +6 -5
- package/packages/components/com-tabs/index.vue +1 -2
- package/packages/components/com-tiles/index.vue +134 -136
- package/packages/components/com-treeDynamic/index.vue +1 -1
- package/packages/utils/StreamLoader.js +1548 -1489
- package/packages/utils/StreamLoaderParser.worker.js +9 -14
- package/src/main.js +2 -8
- package/src/utils/cloud.js +28 -28
- package/src/utils/cursor.js +11 -9
- package/src/utils/flgltf-parser.js +257 -245
- package/src/utils/instance-parser.js +20 -22
- package/src/utils/mini-devtool.js +94 -39
- package/src/utils/threejs/measure-angle.js +51 -13
- package/src/utils/threejs/measure-area.js +43 -12
- package/src/utils/threejs/measure-distance.js +43 -12
- package/src/utils/threejs/rain-shader.js +10 -10
- package/src/utils/threejs/snow-shader.js +9 -9
|
@@ -6,337 +6,346 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
<embed v-show="canvasShow" type="image/svg+xml" id="svg-tigger" :src="currentSvg" />
|
|
8
8
|
</div>
|
|
9
|
-
|
|
10
9
|
</template>
|
|
11
10
|
<script>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
watch: {
|
|
33
|
-
src(newVal) {
|
|
34
|
-
this.currentSvg = newVal
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
components: {
|
|
38
|
-
AnnTool
|
|
39
|
-
},
|
|
40
|
-
data() {
|
|
41
|
-
return {
|
|
42
|
-
currentSvg: '',
|
|
43
|
-
activeObj: null,
|
|
44
|
-
canvasShow: true,
|
|
45
|
-
toolbarShow: false,
|
|
46
|
-
svgInitStyle: {}
|
|
47
|
-
};
|
|
11
|
+
import svgPanZoom from 'svg-pan-zoom';
|
|
12
|
+
import html2canvas from 'html2canvas';
|
|
13
|
+
import AnnTool from './component/ann-tool.vue';
|
|
14
|
+
var svgCon = {},
|
|
15
|
+
svgTigger = {},
|
|
16
|
+
svgEmbed = {};
|
|
17
|
+
var preTargetCon = [],
|
|
18
|
+
preTargetStyle = [];
|
|
19
|
+
var firstTime = 0,
|
|
20
|
+
lastTime = 0;
|
|
21
|
+
var inspectionRect = null,
|
|
22
|
+
pointerRect = null;
|
|
23
|
+
export default {
|
|
24
|
+
name: 'FlSvg',
|
|
25
|
+
props: {
|
|
26
|
+
src: {
|
|
27
|
+
typeof: String,
|
|
28
|
+
default: '',
|
|
48
29
|
},
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
},
|
|
31
|
+
watch: {
|
|
32
|
+
src(newVal) {
|
|
33
|
+
this.currentSvg = newVal;
|
|
51
34
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
},
|
|
36
|
+
components: {
|
|
37
|
+
AnnTool,
|
|
38
|
+
},
|
|
39
|
+
data() {
|
|
40
|
+
return {
|
|
41
|
+
currentSvg: '',
|
|
42
|
+
activeObj: null,
|
|
43
|
+
canvasShow: true,
|
|
44
|
+
toolbarShow: false,
|
|
45
|
+
svgInitStyle: {},
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
created() {
|
|
49
|
+
this.currentSvg = this.src;
|
|
50
|
+
},
|
|
51
|
+
mounted() {
|
|
52
|
+
this.$nextTick(() => {
|
|
53
|
+
svgEmbed = document.getElementById('svg-tigger');
|
|
54
|
+
svgEmbed.style.width = this.$refs.svgComponent.clientWidth + 'px';
|
|
55
|
+
svgEmbed.style.height = this.$refs.svgComponent.clientHeight + 'px';
|
|
56
|
+
svgEmbed.addEventListener('resize', () => {
|
|
57
|
+
this.onWindowResize;
|
|
58
|
+
});
|
|
59
|
+
svgEmbed.addEventListener('load', () => {
|
|
60
|
+
preTargetCon.splice(0);
|
|
61
|
+
preTargetStyle.splice(0);
|
|
62
|
+
svgTigger = svgPanZoom('#svg-tigger', {
|
|
63
|
+
viewportSelector: '.svg-pan-zoom_viewport',
|
|
64
|
+
panEnabled: true,
|
|
65
|
+
zoomEnabled: true,
|
|
66
|
+
preventMouseEventsDefault: false,
|
|
67
|
+
fit: true,
|
|
68
|
+
center: true,
|
|
59
69
|
});
|
|
60
|
-
svgEmbed.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
inspectionRect = svgCon.createSVGRect();
|
|
76
|
-
inspectionRect.width = 10;
|
|
77
|
-
inspectionRect.height = 10;
|
|
78
|
-
pointerRect = svgCon.createSVGPoint();
|
|
79
|
-
this.onWindowResize();
|
|
80
|
-
// 禁止右键菜单栏
|
|
81
|
-
svgCon.addEventListener('contextmenu', e => {
|
|
82
|
-
e.preventDefault();
|
|
83
|
-
});
|
|
84
|
-
// 鼠标的按下与抬起事件
|
|
85
|
-
svgCon.addEventListener('mousedown', this.mousedown);
|
|
86
|
-
svgCon.addEventListener('mouseup', this.mouseup);
|
|
87
|
-
// 加载完成后会通知
|
|
88
|
-
this.$emit('loaded');
|
|
70
|
+
svgCon = svgEmbed.getSVGDocument().querySelector('svg');
|
|
71
|
+
svgCon.style = 'cursor: pointer;user-select: none;';
|
|
72
|
+
this.svgInitStyle = svgEmbed
|
|
73
|
+
.getSVGDocument()
|
|
74
|
+
.getElementsByClassName('svg-pan-zoom_viewport')[0]
|
|
75
|
+
.getBoundingClientRect();
|
|
76
|
+
svgCon.setAttribute('viewBox', '0 0 ' + svgEmbed.offsetWidth + ' ' + svgEmbed.offsetHeight);
|
|
77
|
+
inspectionRect = svgCon.createSVGRect();
|
|
78
|
+
inspectionRect.width = 10;
|
|
79
|
+
inspectionRect.height = 10;
|
|
80
|
+
pointerRect = svgCon.createSVGPoint();
|
|
81
|
+
this.onWindowResize();
|
|
82
|
+
// 禁止右键菜单栏
|
|
83
|
+
svgCon.addEventListener('contextmenu', e => {
|
|
84
|
+
e.preventDefault();
|
|
89
85
|
});
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
// 鼠标的按下与抬起事件
|
|
87
|
+
svgCon.addEventListener('mousedown', this.mousedown);
|
|
88
|
+
svgCon.addEventListener('mouseup', this.mouseup);
|
|
89
|
+
// 加载完成后会通知
|
|
90
|
+
this.$emit('loaded');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
methods: {
|
|
95
|
+
changeSvg(url) {
|
|
96
|
+
this.$set(this, 'currentSvg', url);
|
|
97
|
+
preTargetCon.splice(0);
|
|
98
|
+
preTargetStyle.splice(0);
|
|
92
99
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const tp = pointerRect.matrixTransform(svgCon.getScreenCTM());
|
|
121
|
-
inspectionRect.x = tp.x;
|
|
122
|
-
inspectionRect.y = tp.y;
|
|
123
|
-
const intersectionList = svgCon.getIntersectionList(inspectionRect, null);
|
|
124
|
-
targetElement =
|
|
125
|
-
intersectionList.length > 0 ? intersectionList[intersectionList.length - 1] : null;
|
|
126
|
-
}
|
|
127
|
-
if (targetElement && !targetElement.id) {
|
|
128
|
-
this.searchSvgId(targetElement.parentNode)
|
|
129
|
-
} else {
|
|
130
|
-
this.activeObj = targetElement
|
|
131
|
-
}
|
|
132
|
-
if (evt.button === 0) {
|
|
133
|
-
this.$emit('leftClick', this.activeObj);
|
|
134
|
-
} else if (evt.button === 2) {
|
|
135
|
-
console.log('rightClick')
|
|
136
|
-
this.$emit('rightClick', {
|
|
137
|
-
event: evt,
|
|
138
|
-
targetObj: this.activeObj
|
|
139
|
-
});
|
|
140
|
-
}
|
|
100
|
+
// 改变窗口大小
|
|
101
|
+
onWindowResize() {
|
|
102
|
+
svgCon.removeAttribute('width');
|
|
103
|
+
svgCon.removeAttribute('height');
|
|
104
|
+
},
|
|
105
|
+
// 鼠标按下
|
|
106
|
+
mousedown() {
|
|
107
|
+
firstTime = new Date().getTime();
|
|
108
|
+
},
|
|
109
|
+
// 鼠标抬起
|
|
110
|
+
mouseup(evt) {
|
|
111
|
+
evt.stopPropagation();
|
|
112
|
+
lastTime = new Date().getTime();
|
|
113
|
+
let targetElement = null;
|
|
114
|
+
// 判断鼠标按下到抬起的时间间隔是否超过300ms 没有超过 则判断为点击
|
|
115
|
+
if (lastTime - firstTime <= 300) {
|
|
116
|
+
if (evt.target.nodeName !== 'svg') {
|
|
117
|
+
targetElement = evt.target;
|
|
118
|
+
} else {
|
|
119
|
+
pointerRect.x = evt.clientX;
|
|
120
|
+
pointerRect.y = evt.clientY;
|
|
121
|
+
const tp = pointerRect.matrixTransform(svgCon.getScreenCTM());
|
|
122
|
+
inspectionRect.x = tp.x;
|
|
123
|
+
inspectionRect.y = tp.y;
|
|
124
|
+
const intersectionList = svgCon.getIntersectionList(inspectionRect, null);
|
|
125
|
+
targetElement =
|
|
126
|
+
intersectionList.length > 0 ? intersectionList[intersectionList.length - 1] : null;
|
|
141
127
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.searchSvgId(dom.parentNode)
|
|
147
|
-
} else if (dom.id) {
|
|
148
|
-
this.activeObj = dom
|
|
128
|
+
if (targetElement && !targetElement.id) {
|
|
129
|
+
this.searchSvgId(targetElement.parentNode);
|
|
130
|
+
} else {
|
|
131
|
+
this.activeObj = targetElement;
|
|
149
132
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
133
|
+
if (evt.button === 0) {
|
|
134
|
+
this.$emit('leftClick', this.activeObj);
|
|
135
|
+
} else if (evt.button === 2) {
|
|
136
|
+
console.log('rightClick');
|
|
137
|
+
this.$emit('rightClick', {
|
|
138
|
+
event: evt,
|
|
139
|
+
targetObj: this.activeObj,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
// 查找对象的id
|
|
145
|
+
searchSvgId(dom) {
|
|
146
|
+
if (!dom.id) {
|
|
147
|
+
this.searchSvgId(dom.parentNode);
|
|
148
|
+
} else if (dom.id) {
|
|
149
|
+
this.activeObj = dom;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
// 高亮目标元素
|
|
153
|
+
/*
|
|
153
154
|
参数:svgIds: [], 需要高亮的id的集合, flag: true / false, 是否要定位目标元素, color: '', 高亮的颜色
|
|
154
155
|
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
if (flag) {
|
|
167
|
-
svgTigger.reset();
|
|
168
|
-
let firstCon = svgCon.getElementById(svgIds[0].svgId);
|
|
169
|
-
setTimeout(() => {
|
|
170
|
-
svgTigger.zoomAtPoint(4, {
|
|
171
|
-
x: firstCon.getBoundingClientRect().x,
|
|
172
|
-
y: firstCon.getBoundingClientRect().y,
|
|
173
|
-
});
|
|
174
|
-
}, 100);
|
|
175
|
-
}
|
|
156
|
+
highLight(svgIds, flag = false, color) {
|
|
157
|
+
if (svgIds === null || svgIds === undefined) {
|
|
158
|
+
throw new Error('svgIds should be an array');
|
|
159
|
+
} else {
|
|
160
|
+
for (let index = 0; index < svgIds.length; index++) {
|
|
161
|
+
let element = svgIds[index];
|
|
162
|
+
let targetCon = svgCon.getElementById(element.svgId);
|
|
163
|
+
console.log(targetCon);
|
|
164
|
+
if (!targetCon) return;
|
|
165
|
+
this.depthTraversal(targetCon.children, color);
|
|
176
166
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
} else {
|
|
185
|
-
preTargetCon.push(svgCon[i]);
|
|
186
|
-
preTargetStyle.push({
|
|
187
|
-
// fillOpacity: svgCon[i].style.fillOpacity,
|
|
188
|
-
stroke: svgCon[i].style.stroke,
|
|
189
|
-
// strokeWidth: svgCon[i].style.strokeWidth,
|
|
190
|
-
fill: svgCon[i].style.fill
|
|
167
|
+
if (flag) {
|
|
168
|
+
svgTigger.reset();
|
|
169
|
+
let firstCon = svgCon.getElementById(svgIds[0].svgId);
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
svgTigger.zoomAtPoint(4, {
|
|
172
|
+
x: firstCon.getBoundingClientRect().x,
|
|
173
|
+
y: firstCon.getBoundingClientRect().y,
|
|
191
174
|
});
|
|
192
|
-
|
|
193
|
-
svgCon[i].style.stroke = color;
|
|
194
|
-
if (svgCon[i].nodeName === 'text' || (svgCon[i].style.fill && svgCon[i].style.fill!== 'none')) {
|
|
195
|
-
(svgCon[i].style.fill = color)
|
|
196
|
-
}
|
|
197
|
-
// svgCon[i].style.strokeWidth = 0.5;
|
|
198
|
-
}
|
|
175
|
+
}, 100);
|
|
199
176
|
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
// pid组高亮 深度遍历
|
|
180
|
+
depthTraversal(svgCon, color) {
|
|
181
|
+
for (let i = 0; i < svgCon.length; i++) {
|
|
182
|
+
if (svgCon[i].children.length > 0) {
|
|
183
|
+
this.depthTraversal(svgCon[i].children, color);
|
|
184
|
+
} else {
|
|
185
|
+
preTargetCon.push(svgCon[i]);
|
|
186
|
+
preTargetStyle.push({
|
|
187
|
+
// fillOpacity: svgCon[i].style.fillOpacity,
|
|
188
|
+
stroke: svgCon[i].style.stroke,
|
|
189
|
+
// strokeWidth: svgCon[i].style.strokeWidth,
|
|
190
|
+
fill: svgCon[i].style.fill,
|
|
191
|
+
});
|
|
192
|
+
// svgCon[i].style.fillOpacity = '0';
|
|
193
|
+
svgCon[i].style.stroke = color;
|
|
194
|
+
if (
|
|
195
|
+
svgCon[i].nodeName === 'text' ||
|
|
196
|
+
(svgCon[i].style.fill && svgCon[i].style.fill !== 'none')
|
|
197
|
+
) {
|
|
198
|
+
svgCon[i].style.fill = color;
|
|
199
|
+
}
|
|
200
|
+
// svgCon[i].style.strokeWidth = 0.5;
|
|
208
201
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
// 清除上一次的高亮
|
|
205
|
+
resetHightLight() {
|
|
206
|
+
for (let i = 0; i < preTargetCon.length; i++) {
|
|
207
|
+
// preTargetCon[i].style.fillOpacity = preTargetStyle[i].fillOpacity;
|
|
208
|
+
preTargetCon[i].style.stroke = preTargetStyle[i].stroke;
|
|
209
|
+
// preTargetCon[i].style.strokeWidth = preTargetStyle[i].strokeWidth;
|
|
210
|
+
preTargetCon[i].style.fill = preTargetStyle[i].fill;
|
|
211
|
+
}
|
|
212
|
+
preTargetStyle.splice(0);
|
|
213
|
+
preTargetCon.splice(0);
|
|
214
|
+
},
|
|
215
|
+
// 修改颜色要区分text text填充为fill
|
|
216
|
+
// 设置对象的属性 obj是需要被修改的对象, properties是需要修改的属性{}
|
|
217
|
+
setPorperty(obj, properties) {
|
|
218
|
+
if (obj.children.length > 0) {
|
|
219
|
+
let arr = obj.children;
|
|
220
|
+
for (let index = 0; index < arr.length; index++) {
|
|
221
|
+
const element = arr[index];
|
|
222
|
+
if (element.nodeName !== 'g') {
|
|
223
|
+
for (const key in properties) {
|
|
224
|
+
// 记录一下原始状态
|
|
225
|
+
element.setAttribute(`data-${key}`, element['style'][key]);
|
|
226
|
+
if (key === 'fill') {
|
|
227
|
+
if (
|
|
228
|
+
element.nodeName === 'text' ||
|
|
229
|
+
(element.style.fill && element.style.fill !== 'none')
|
|
230
|
+
) {
|
|
231
|
+
element['style']['fill'] = properties[key];
|
|
229
232
|
}
|
|
233
|
+
} else {
|
|
234
|
+
element['style'][key] = properties[key];
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
|
-
if (element.children && element.children.length > 0) {
|
|
233
|
-
this.setPorperty(element, properties)
|
|
234
|
-
}
|
|
235
237
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
for (const key in properties) {
|
|
239
|
-
if (key === 'fill') {
|
|
240
|
-
if (element.nodeName === 'text' || (element.style.fill && element.style.fill !== 'none')) {
|
|
241
|
-
element['style']['fill'] = properties[fill]
|
|
242
|
-
}
|
|
243
|
-
} else {
|
|
244
|
-
element['style'][key] = properties[key]
|
|
245
|
-
}
|
|
246
|
-
}
|
|
238
|
+
if (element.children && element.children.length > 0) {
|
|
239
|
+
this.setPorperty(element, properties);
|
|
247
240
|
}
|
|
248
|
-
|
|
249
241
|
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
element['style'][
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
this.resetPorperty(element, properties)
|
|
242
|
+
} else {
|
|
243
|
+
if (obj.nodeName !== 'g') {
|
|
244
|
+
for (const key in properties) {
|
|
245
|
+
if (key === 'fill') {
|
|
246
|
+
if (
|
|
247
|
+
element.nodeName === 'text' ||
|
|
248
|
+
(element.style.fill && element.style.fill !== 'none')
|
|
249
|
+
) {
|
|
250
|
+
element['style']['fill'] = properties[fill];
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
element['style'][key] = properties[key];
|
|
263
254
|
}
|
|
264
255
|
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
resetPorperty(obj, properties) {
|
|
260
|
+
if (obj.children.length > 0) {
|
|
261
|
+
let arr = obj.children;
|
|
262
|
+
for (let index = 0; index < arr.length; index++) {
|
|
263
|
+
const element = arr[index];
|
|
264
|
+
if (element.nodeName !== 'g') {
|
|
265
|
+
properties.forEach(item => {
|
|
266
|
+
element['style'][item] = element.getAttribute(`data-${item}`);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
if (element.children && element.children.length > 0) {
|
|
270
|
+
this.resetPorperty(element, properties);
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
} else {
|
|
278
|
-
return []
|
|
273
|
+
} else {
|
|
274
|
+
if (obj.nodeName !== 'g') {
|
|
275
|
+
properties.forEach(item => {
|
|
276
|
+
element['style'][item] = element.getAttribute(`data-${item}`);
|
|
277
|
+
});
|
|
279
278
|
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
getAllNode() {
|
|
282
|
+
let node = svgCon.querySelector('.svg-pan-zoom_viewport');
|
|
283
|
+
if (node) {
|
|
284
|
+
return node.children;
|
|
285
|
+
} else {
|
|
286
|
+
return [];
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
getNodeById(id) {
|
|
290
|
+
return svgCon.getElementById(id);
|
|
291
|
+
},
|
|
292
|
+
// 更新图纸/切换图纸
|
|
293
|
+
/*
|
|
286
294
|
参数:url: 图纸的路径
|
|
287
295
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
296
|
+
switchSvg(url) {
|
|
297
|
+
this.$set(this, 'currentSvg', url);
|
|
298
|
+
preTargetCon.splice(0);
|
|
299
|
+
preTargetStyle.splice(0);
|
|
300
|
+
inspectionRect = null;
|
|
301
|
+
pointerRect = null;
|
|
302
|
+
},
|
|
303
|
+
// 图纸恢复到主视图
|
|
304
|
+
resetView() {
|
|
305
|
+
svgTigger.reset();
|
|
306
|
+
},
|
|
307
|
+
saveCanvas(canvasStyle) {
|
|
308
|
+
this.$refs.AnnToolbar.toolbarShow = false; // 关闭画板工具条
|
|
309
|
+
svgTigger.reset();
|
|
310
|
+
svgTigger.zoom(canvasStyle.width / this.svgInitStyle.width);
|
|
311
|
+
svgTigger.pan({ x: -canvasStyle.scrollLeft, y: -canvasStyle.scrollTop });
|
|
312
|
+
this.$nextTick(() => {
|
|
313
|
+
this.screenShot(); // 保存批注
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
// 截图导出
|
|
317
|
+
screenShot() {
|
|
318
|
+
let shotObj = this.$refs.svgComponent;
|
|
319
|
+
html2canvas(shotObj, { allowTaint: true, useCORS: true }).then(canvas => {
|
|
320
|
+
const link = document.createElement('a');
|
|
321
|
+
link.href = canvas.toDataURL('image/png');
|
|
322
|
+
link.download = 'screenshot.png';
|
|
323
|
+
link.click();
|
|
324
|
+
});
|
|
325
|
+
},
|
|
326
|
+
// 打开批注模式
|
|
327
|
+
openAnnToolbar() {
|
|
328
|
+
console.log('openAnnToolbar');
|
|
329
|
+
this.canvasShow = false;
|
|
330
|
+
this.toolbarShow = true;
|
|
331
|
+
},
|
|
332
|
+
closeAnnMode() {
|
|
333
|
+
this.canvasShow = true;
|
|
334
|
+
this.toolbarShow = false;
|
|
335
|
+
this.$emit('closeAnn');
|
|
329
336
|
},
|
|
330
|
-
}
|
|
337
|
+
},
|
|
338
|
+
};
|
|
331
339
|
</script>
|
|
332
340
|
<style lang="scss" scoped>
|
|
333
|
-
#svg-component,
|
|
341
|
+
#svg-component,
|
|
342
|
+
#svg-tigger {
|
|
334
343
|
cursor: pointer;
|
|
335
344
|
height: 100%;
|
|
336
345
|
width: 100%;
|
|
337
346
|
position: relative;
|
|
338
347
|
}
|
|
339
|
-
#toolbar-show{
|
|
348
|
+
#toolbar-show {
|
|
340
349
|
z-index: 20;
|
|
341
350
|
position: absolute;
|
|
342
351
|
width: 100%;
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
key="index"
|
|
22
22
|
:index="indexMethod"
|
|
23
23
|
align="center"
|
|
24
|
-
>
|
|
25
|
-
</component>
|
|
24
|
+
></component>
|
|
26
25
|
</div>
|
|
27
26
|
</template>
|
|
28
27
|
|
|
@@ -57,7 +56,7 @@ export default {
|
|
|
57
56
|
rowDrop() {
|
|
58
57
|
if (!this.comTable.$refs.table) return;
|
|
59
58
|
const el = this.comTable.$refs.table.$el.querySelectorAll(this.config.dropRowClass)[0];
|
|
60
|
-
this.comTable.tableDrop('row', el,
|
|
59
|
+
this.comTable.tableDrop('row', el, evt => {
|
|
61
60
|
const oldIndex = evt.oldIndex;
|
|
62
61
|
const newIndex = evt.newIndex;
|
|
63
62
|
const targetRow = this.comTable.list.splice(oldIndex, 1)[0];
|