fl-web-component 1.2.11 → 1.2.13
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/README.md +4 -0
- package/dist/fl-web-component.common.1.js +15 -15
- package/dist/fl-web-component.common.1.js.map +1 -1
- package/dist/fl-web-component.common.2.js.map +1 -1
- package/dist/fl-web-component.common.3.js.map +1 -1
- package/dist/fl-web-component.common.js +160 -115
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/package.json +1 -1
- package/packages/components/com-flcanvas/index.vue +2 -2
- package/packages/components/com-graphics/index.vue +31 -6
- package/src/utils/flgltf-parser.js +68 -50
- package/src/utils/instance-parser.js +39 -30
- package/packages/components/button/index.vue +0 -26
- package/packages/components/model/api/index.js +0 -421
- package/packages/components/model/api/mock/detecttree.js +0 -58
- package/packages/components/model/api/mock/getmodel-line.js +0 -15834
- package/packages/components/model/api/mock/init.js +0 -1
- package/packages/components/model/api/mock/pbstree.js +0 -826
- package/packages/components/model/api/mock/topology.json +0 -3238
- package/packages/components/model/components/TextOverTooltip/index.vue +0 -84
- package/packages/components/model/components/annotation-toolbar.vue +0 -410
- package/packages/components/model/components/check-proofing-model.vue +0 -39
- package/packages/components/model/components/clipping-type.vue +0 -59
- package/packages/components/model/components/com-dialogWrapper/Readme.md +0 -53
- package/packages/components/model/components/com-dialogWrapper/index.vue +0 -114
- package/packages/components/model/components/detect-panel.vue +0 -339
- package/packages/components/model/components/detect-tree.vue +0 -445
- package/packages/components/model/components/firstPer-panel.vue +0 -109
- package/packages/components/model/components/header-button.vue +0 -470
- package/packages/components/model/components/imageViewer/index.vue +0 -126
- package/packages/components/model/components/import-model.vue +0 -127
- package/packages/components/model/components/location-panel.vue +0 -91
- package/packages/components/model/components/measure-type.vue +0 -59
- package/packages/components/model/components/pbs-tree.vue +0 -497
- package/packages/components/model/components/proof-config.vue +0 -72
- package/packages/components/model/components/proof-for-pc.vue +0 -126
- package/packages/components/model/components/proof-history.vue +0 -300
- package/packages/components/model/components/proof-panel-detail.vue +0 -568
- package/packages/components/model/components/proof-panel.vue +0 -846
- package/packages/components/model/components/proof-project-user.vue +0 -445
- package/packages/components/model/components/proof-publish.vue +0 -130
- package/packages/components/model/components/proof-role.vue +0 -504
- package/packages/components/model/components/props-panel.vue +0 -258
- package/packages/components/model/index.vue +0 -3425
- package/packages/components/model/readme.md +0 -31
- package/packages/components/model/utils/annotation-tool.js +0 -333
- package/packages/components/model/utils/cursor.js +0 -23
- package/packages/components/model/utils/detect-v1.js +0 -329
- package/packages/components/model/utils/index.js +0 -48
- package/packages/components/model/utils/threejs/measure-angle.js +0 -258
- package/packages/components/model/utils/threejs/measure-area.js +0 -281
- package/packages/components/model/utils/threejs/measure-distance.js +0 -209
- package/packages/components/model/utils/threejs/measure-volume.js +0 -97
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="header-button">
|
|
3
|
-
<el-tooltip class="item" effect="dark" content="返回" placement="top-start">
|
|
4
|
-
<el-button class="back" size="small" @click="$router.go(-1)" icon="el-icon-back"></el-button>
|
|
5
|
-
</el-tooltip>
|
|
6
|
-
<div class="left">
|
|
7
|
-
<el-tooltip class="item" effect="dark" content="PBS树" placement="top-start">
|
|
8
|
-
<div
|
|
9
|
-
:class="[
|
|
10
|
-
'btn-item',
|
|
11
|
-
'pbstree',
|
|
12
|
-
btnActived['pbsTree'] ? 'el-button-actived' : '',
|
|
13
|
-
proofingModel ? '' : 'icon-disabeld',
|
|
14
|
-
]"
|
|
15
|
-
@click="rightOperation('pbsTree')"
|
|
16
|
-
></div>
|
|
17
|
-
</el-tooltip>
|
|
18
|
-
<div class="split-line"></div>
|
|
19
|
-
<el-tooltip class="item" effect="dark" content="属性" placement="top-start">
|
|
20
|
-
<div
|
|
21
|
-
:class="[
|
|
22
|
-
'btn-item',
|
|
23
|
-
'property',
|
|
24
|
-
btnActived['property'] ? 'el-button-actived' : '',
|
|
25
|
-
proofingModel ? '' : 'icon-disabeld',
|
|
26
|
-
]"
|
|
27
|
-
@click="rightOperation('property')"
|
|
28
|
-
style="margin-right: 0px"
|
|
29
|
-
></div>
|
|
30
|
-
</el-tooltip>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="left">
|
|
33
|
-
<el-tooltip class="item" effect="dark" content="校审" placement="top-start">
|
|
34
|
-
<div
|
|
35
|
-
:class="[
|
|
36
|
-
'btn-item',
|
|
37
|
-
'proof',
|
|
38
|
-
btnActived['proof'] ? 'el-button-actived' : '',
|
|
39
|
-
proofingModel ? '' : 'icon-disabeld',
|
|
40
|
-
]"
|
|
41
|
-
@click="rightOperation('proof')"
|
|
42
|
-
></div>
|
|
43
|
-
</el-tooltip>
|
|
44
|
-
<el-tooltip class="item" effect="dark" content="碰撞检查" placement="top-start">
|
|
45
|
-
<div
|
|
46
|
-
:class="[
|
|
47
|
-
'btn-item',
|
|
48
|
-
'detect',
|
|
49
|
-
btnActived['detect'] ? 'el-button-actived' : '',
|
|
50
|
-
proofingModel ? '' : 'icon-disabeld',
|
|
51
|
-
]"
|
|
52
|
-
@click="rightOperation('detect')"
|
|
53
|
-
></div>
|
|
54
|
-
</el-tooltip>
|
|
55
|
-
</div>
|
|
56
|
-
<div class="left">
|
|
57
|
-
<el-tooltip
|
|
58
|
-
class="item"
|
|
59
|
-
effect="dark"
|
|
60
|
-
content="剖切"
|
|
61
|
-
placement="top-start"
|
|
62
|
-
:disabled="openClipping"
|
|
63
|
-
>
|
|
64
|
-
<div
|
|
65
|
-
:class="[
|
|
66
|
-
'btn-item',
|
|
67
|
-
'clip',
|
|
68
|
-
'popover-layout',
|
|
69
|
-
btnActived['clip'] ? 'el-button-actived' : '',
|
|
70
|
-
proofingModel ? '' : 'icon-disabeld',
|
|
71
|
-
]"
|
|
72
|
-
@click="clickClip('clipping')"
|
|
73
|
-
>
|
|
74
|
-
<div class="popover-container" v-if="openClipping">
|
|
75
|
-
<el-tooltip class="item" effect="dark" content="全局剖切" placement="top-start">
|
|
76
|
-
<div
|
|
77
|
-
:class="[
|
|
78
|
-
'btn-item',
|
|
79
|
-
'clipping-all',
|
|
80
|
-
btnActived['clippingAll'] ? 'el-button-actived' : '',
|
|
81
|
-
]"
|
|
82
|
-
@click.stop="rightOperation('clipping-all')"
|
|
83
|
-
></div
|
|
84
|
-
></el-tooltip>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</el-tooltip>
|
|
88
|
-
<el-tooltip
|
|
89
|
-
class="item"
|
|
90
|
-
effect="dark"
|
|
91
|
-
content="测量"
|
|
92
|
-
placement="top-start"
|
|
93
|
-
:disabled="openMeasure"
|
|
94
|
-
>
|
|
95
|
-
<div
|
|
96
|
-
:class="[
|
|
97
|
-
'btn-item',
|
|
98
|
-
'measure',
|
|
99
|
-
'popover-layout',
|
|
100
|
-
btnActived['measure'] ? 'el-button-actived' : '',
|
|
101
|
-
proofingModel ? '' : 'icon-disabeld',
|
|
102
|
-
]"
|
|
103
|
-
@click="clickMeasure('measure')"
|
|
104
|
-
>
|
|
105
|
-
<div class="popover-container" v-if="openMeasure">
|
|
106
|
-
<el-tooltip class="item" effect="dark" content="长度" placement="top-start">
|
|
107
|
-
<div
|
|
108
|
-
:class="['btn-item', 'distance', btnActived['distance'] ? 'el-button-actived' : '']"
|
|
109
|
-
@click.stop="rightOperation('distance')"
|
|
110
|
-
></div
|
|
111
|
-
></el-tooltip>
|
|
112
|
-
<el-tooltip class="item" effect="dark" content="面积" placement="top-start">
|
|
113
|
-
<div
|
|
114
|
-
:class="['btn-item', 'area', btnActived['area'] ? 'el-button-actived' : '']"
|
|
115
|
-
@click.stop="rightOperation('area')"
|
|
116
|
-
></div
|
|
117
|
-
></el-tooltip>
|
|
118
|
-
<el-tooltip class="item" effect="dark" content="角度" placement="top-start">
|
|
119
|
-
<div
|
|
120
|
-
:class="['btn-item', 'angle', btnActived['angle'] ? 'el-button-actived' : '']"
|
|
121
|
-
@click.stop="rightOperation('angle')"
|
|
122
|
-
></div
|
|
123
|
-
></el-tooltip>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
</el-tooltip>
|
|
127
|
-
<el-tooltip class="item" effect="dark" content="批注" placement="top-start">
|
|
128
|
-
<div
|
|
129
|
-
:class="['btn-item', 'annotate', btnActived['annotate'] ? 'el-button-actived' : '']"
|
|
130
|
-
@click="rightOperation('annotate')"
|
|
131
|
-
></div>
|
|
132
|
-
</el-tooltip>
|
|
133
|
-
<el-tooltip class="item" effect="dark" content="第一视角" placement="top-start">
|
|
134
|
-
<div
|
|
135
|
-
:class="[
|
|
136
|
-
'btn-item',
|
|
137
|
-
'first-person',
|
|
138
|
-
btnActived['firstPerson'] ? 'el-button-actived' : '',
|
|
139
|
-
proofingModel ? '' : 'icon-disabeld',
|
|
140
|
-
]"
|
|
141
|
-
@click="rightOperation('first-person')"
|
|
142
|
-
></div>
|
|
143
|
-
</el-tooltip>
|
|
144
|
-
</div>
|
|
145
|
-
</div>
|
|
146
|
-
</template>
|
|
147
|
-
<script>
|
|
148
|
-
export default {
|
|
149
|
-
name: 'HeaderButton',
|
|
150
|
-
components: {
|
|
151
|
-
// Item: () => import('@/layout/components/Sidebar/Item.vue')
|
|
152
|
-
},
|
|
153
|
-
props: {
|
|
154
|
-
currentRoute: {
|
|
155
|
-
type: String,
|
|
156
|
-
default: '',
|
|
157
|
-
},
|
|
158
|
-
drawName: {
|
|
159
|
-
type: String,
|
|
160
|
-
default: '',
|
|
161
|
-
},
|
|
162
|
-
btnVisiable: {
|
|
163
|
-
type: Object,
|
|
164
|
-
default() {
|
|
165
|
-
return {
|
|
166
|
-
obj: true,
|
|
167
|
-
menu: true,
|
|
168
|
-
mainView: true,
|
|
169
|
-
light: true,
|
|
170
|
-
mark: true,
|
|
171
|
-
search: true,
|
|
172
|
-
inspection: true,
|
|
173
|
-
continue: true,
|
|
174
|
-
property: true,
|
|
175
|
-
visiable: true,
|
|
176
|
-
layer: true,
|
|
177
|
-
};
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
closeRightOperationType: {
|
|
181
|
-
type: Object,
|
|
182
|
-
default() {
|
|
183
|
-
return {
|
|
184
|
-
type: '',
|
|
185
|
-
close: false,
|
|
186
|
-
};
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
proofingModel: {
|
|
190
|
-
type: Boolean,
|
|
191
|
-
default: false,
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
data() {
|
|
195
|
-
return {
|
|
196
|
-
rightType: '',
|
|
197
|
-
type: '',
|
|
198
|
-
openMeasure: false,
|
|
199
|
-
lightType: 'bright',
|
|
200
|
-
visiableType: '',
|
|
201
|
-
openClipping: false,
|
|
202
|
-
btnActived: {
|
|
203
|
-
proof: false,
|
|
204
|
-
detect: false,
|
|
205
|
-
mark: false,
|
|
206
|
-
property: false,
|
|
207
|
-
clip: false,
|
|
208
|
-
clippingAll: false,
|
|
209
|
-
annotate: false,
|
|
210
|
-
firstPerson: false,
|
|
211
|
-
angle: false,
|
|
212
|
-
area: false,
|
|
213
|
-
distance: false,
|
|
214
|
-
measure: false,
|
|
215
|
-
pbsTree: true,
|
|
216
|
-
},
|
|
217
|
-
};
|
|
218
|
-
},
|
|
219
|
-
watch: {
|
|
220
|
-
closeRightOperationType(param) {
|
|
221
|
-
console.log('closeRightOperationType', param);
|
|
222
|
-
|
|
223
|
-
this.btnActived[param.type] = !param.close;
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
created() {},
|
|
227
|
-
methods: {
|
|
228
|
-
mainView() {
|
|
229
|
-
this.$parent.mainView();
|
|
230
|
-
},
|
|
231
|
-
resetType() {
|
|
232
|
-
this.rightType = '';
|
|
233
|
-
},
|
|
234
|
-
rightOperation(name) {
|
|
235
|
-
if (!this.proofingModel) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
// this.rightType = this.rightType === name ? '': name
|
|
239
|
-
this.btnActived[name] = !this.btnActived[name];
|
|
240
|
-
this.$emit('rightOperation', name);
|
|
241
|
-
// this.$parent.rightOperation(name)
|
|
242
|
-
},
|
|
243
|
-
leftInformation(reveal, conceal, type) {
|
|
244
|
-
type === this.type ? (this.type = '') : (this.type = type);
|
|
245
|
-
this.$parent.leftInformation(reveal, conceal);
|
|
246
|
-
},
|
|
247
|
-
clickClip(type) {
|
|
248
|
-
if (!this.proofingModel) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
type === this.type ? (this.type = '') : (this.type = type);
|
|
253
|
-
this.openClipping = !this.openClipping;
|
|
254
|
-
if (this.openMeasure) {
|
|
255
|
-
this.openMeasure = false;
|
|
256
|
-
}
|
|
257
|
-
this.rightOperation(type);
|
|
258
|
-
},
|
|
259
|
-
clickMeasure(type) {
|
|
260
|
-
if (!this.proofingModel) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
type === this.type ? (this.type = '') : (this.type = type);
|
|
265
|
-
this.openMeasure = !this.openMeasure;
|
|
266
|
-
if (this.openClipping) {
|
|
267
|
-
this.openClipping = false;
|
|
268
|
-
}
|
|
269
|
-
this.rightOperation(type);
|
|
270
|
-
},
|
|
271
|
-
setColorOpen(type) {
|
|
272
|
-
if (type === this.lightType) return;
|
|
273
|
-
this.lightType = type;
|
|
274
|
-
this.$parent.setColorOpen(type);
|
|
275
|
-
},
|
|
276
|
-
clickVisiable(type) {
|
|
277
|
-
type === this.type ? (this.type = '') : (this.type = type);
|
|
278
|
-
this.openHandleVisiable = !this.openHandleVisiable;
|
|
279
|
-
if (!this.openHandleVisiable) {
|
|
280
|
-
this.visiableType = '';
|
|
281
|
-
this.$emit('setHandleVisiable', '');
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
setHandleVisiable(type) {
|
|
285
|
-
if (type === this.visiableType) return;
|
|
286
|
-
this.visiableType = type;
|
|
287
|
-
this.$emit('setHandleVisiable', type);
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
};
|
|
291
|
-
</script>
|
|
292
|
-
<style lang="scss" scoped>
|
|
293
|
-
.header-name {
|
|
294
|
-
color: #2e3136;
|
|
295
|
-
font-size: 12px;
|
|
296
|
-
font-weight: bold;
|
|
297
|
-
margin-left: 4px;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// 大部分页面顶部按钮
|
|
301
|
-
.header-button {
|
|
302
|
-
width: 100%;
|
|
303
|
-
height: 58px;
|
|
304
|
-
display: flex;
|
|
305
|
-
align-items: center;
|
|
306
|
-
box-sizing: border-box;
|
|
307
|
-
padding: 0 16px;
|
|
308
|
-
// justify-content: space-between;
|
|
309
|
-
border-bottom: 1px solid #ddd;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.split-line {
|
|
313
|
-
width: 1px;
|
|
314
|
-
height: 17px;
|
|
315
|
-
background: #ddd;
|
|
316
|
-
margin: 0 10px;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.right-left {
|
|
320
|
-
margin-right: 16px;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.right {
|
|
324
|
-
display: flex;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.left,
|
|
328
|
-
.right-left,
|
|
329
|
-
.right-right {
|
|
330
|
-
border-radius: 8px;
|
|
331
|
-
border: 1px solid #ddd;
|
|
332
|
-
display: flex;
|
|
333
|
-
align-items: center;
|
|
334
|
-
padding: 4px 10px;
|
|
335
|
-
margin-right: 60px;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.btn-item {
|
|
339
|
-
width: 32px;
|
|
340
|
-
height: 32px;
|
|
341
|
-
display: inline-block;
|
|
342
|
-
border-radius: 4px;
|
|
343
|
-
background-position: center;
|
|
344
|
-
background-size: 26px;
|
|
345
|
-
background-repeat: no-repeat;
|
|
346
|
-
cursor: pointer;
|
|
347
|
-
|
|
348
|
-
&:hover {
|
|
349
|
-
border: 1px solid #c5deee;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.popover-container {
|
|
354
|
-
position: absolute;
|
|
355
|
-
left: 0;
|
|
356
|
-
top: 42px;
|
|
357
|
-
background-color: #fff;
|
|
358
|
-
display: flex;
|
|
359
|
-
border-radius: 8px;
|
|
360
|
-
padding: 2px 8px;
|
|
361
|
-
box-shadow: 0px 2px 10px -2px #2e3136;
|
|
362
|
-
z-index: 10;
|
|
363
|
-
|
|
364
|
-
.btn-item:hover {
|
|
365
|
-
border: none;
|
|
366
|
-
background-color: rgba(241, 241, 241, 1);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
.popover-layout {
|
|
371
|
-
position: relative;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// .main-view{
|
|
375
|
-
// margin-right: 10px;
|
|
376
|
-
// }
|
|
377
|
-
.right-right .btn-item {
|
|
378
|
-
margin-right: 10px;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// .btn-item:hover{
|
|
382
|
-
// border: 1px solid #C5DEEE;
|
|
383
|
-
// }
|
|
384
|
-
.el-button-actived {
|
|
385
|
-
background-color: rgba(241, 241, 241, 1);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
.proof {
|
|
389
|
-
background-image: url('../../../assets/proof/proof@2x.png');
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
.detect {
|
|
393
|
-
background-image: url('../../../assets/proof/detect@2x.png');
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
.property {
|
|
397
|
-
background-image: url('../../../assets/proof/property@2x.png');
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
.annotate {
|
|
401
|
-
background-image: url('../../../assets/proof/annotate@2x.png');
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.clip {
|
|
405
|
-
background-image: url('../../../assets/proof/clip@2x.png');
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
.first-person {
|
|
409
|
-
background-image: url('../../../assets/proof/first-person@2x.png');
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.measure {
|
|
413
|
-
background-image: url('../../../assets/proof/measure@2x.png');
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
.clipping-all {
|
|
417
|
-
background-image: url('../../../assets/proof/clipping-all@2x.png');
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.clipping {
|
|
421
|
-
background-image: url('../../../assets/proof/clipping@2x.png');
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
.distance {
|
|
425
|
-
background-image: url('../../../assets/proof/distance@2x.png');
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.area {
|
|
429
|
-
background-image: url('../../../assets/proof/area@2x.png');
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.angle {
|
|
433
|
-
background-image: url('../../../assets/proof/angle@2x.png');
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
.pbstree {
|
|
437
|
-
background-image: url('../../../assets/proof/pbstree@2x.png');
|
|
438
|
-
}
|
|
439
|
-
.icon-disabeld {
|
|
440
|
-
cursor: not-allowed;
|
|
441
|
-
}
|
|
442
|
-
.back {
|
|
443
|
-
margin: 0 25px 0 10px;
|
|
444
|
-
padding: 12px;
|
|
445
|
-
border: 1px solid #ddd;
|
|
446
|
-
}
|
|
447
|
-
// .save{
|
|
448
|
-
// background-image: url('../images/header-button/tool_save@2x.png');
|
|
449
|
-
// margin-right: 10px;
|
|
450
|
-
// }
|
|
451
|
-
// .menu{
|
|
452
|
-
// background-image: url('../images/header-button/tool_list@2x.png');
|
|
453
|
-
// }
|
|
454
|
-
// .mergdraw{
|
|
455
|
-
// background-image: url('../images/header-button/tool_mergdraw@2x.png');
|
|
456
|
-
// }
|
|
457
|
-
// .visiableOrShow{
|
|
458
|
-
// position: relative;
|
|
459
|
-
// background-image: url('../images/header-button/tool_visiable@2x.png');
|
|
460
|
-
// background-size: 22px;
|
|
461
|
-
// }
|
|
462
|
-
// .obj-hide{
|
|
463
|
-
// background-image: url('../images/header-button/tool_hide@2x.png');
|
|
464
|
-
// background-size: 18px;
|
|
465
|
-
// }
|
|
466
|
-
// .obj-show{
|
|
467
|
-
// background-image: url('../images/header-button/tool_show@2x.png');
|
|
468
|
-
// background-size: 18px;
|
|
469
|
-
// }
|
|
470
|
-
</style>
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: yangling
|
|
3
|
-
* @Date: 2024-08-27 19:02:05
|
|
4
|
-
* @LastEditors: yangling
|
|
5
|
-
* @LastEditTime: 2024-08-27 19:02:14
|
|
6
|
-
* @FilePath: \DocumentCollaboration\src\components\imageViewr\index.vue
|
|
7
|
-
* @Description: 图片放大缩小 拖动
|
|
8
|
-
-->
|
|
9
|
-
<template>
|
|
10
|
-
<div
|
|
11
|
-
class="imageView"
|
|
12
|
-
@mousedown="onMouseDown"
|
|
13
|
-
@mousemove="onMouseMove"
|
|
14
|
-
@mouseleave="onMouseUp"
|
|
15
|
-
@mouseup="onMouseUp"
|
|
16
|
-
>
|
|
17
|
-
<div v-if="isErrorImage" class="error-image">
|
|
18
|
-
<div class="image-slot">
|
|
19
|
-
<i class="image-icon el-icon-picture-outline"></i>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
<img v-else :src="imageUrl" ref="image" @wheel="onWheel" />
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
export default {
|
|
28
|
-
props: {
|
|
29
|
-
imageUrl: {
|
|
30
|
-
type: String,
|
|
31
|
-
require: true,
|
|
32
|
-
},
|
|
33
|
-
isErrorImage: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: false,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
data() {
|
|
39
|
-
return {
|
|
40
|
-
currentScale: 1, // 当前缩放比例
|
|
41
|
-
isDragging: false, // 是否正在拖拽图片
|
|
42
|
-
startX: 0, // 拖拽起始点x坐标
|
|
43
|
-
startY: 0, // 拖拽起始点y坐标
|
|
44
|
-
translateX: 0, // 图片平移x方向距离
|
|
45
|
-
translateY: 0, // 图片平移y方向距离
|
|
46
|
-
dragSpeed: 0.3, // 拖拽速度
|
|
47
|
-
zoomSpeed: 0.1, //控制缩放速度
|
|
48
|
-
maxScale: 5, //最大缩放值
|
|
49
|
-
minScale: 0.1, //最小缩放值
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
methods: {
|
|
53
|
-
// 鼠标按下事件处理函数
|
|
54
|
-
onMouseDown(e) {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
this.isDragging = true;
|
|
57
|
-
this.startX = e.clientX;
|
|
58
|
-
this.startY = e.clientY;
|
|
59
|
-
this.$refs.image.style.cursor = 'grabbing';
|
|
60
|
-
},
|
|
61
|
-
// 鼠标移动事件处理函数
|
|
62
|
-
onMouseMove(e) {
|
|
63
|
-
if (!this.isDragging) return;
|
|
64
|
-
const deltaX = (e.clientX - this.startX) * this.dragSpeed;
|
|
65
|
-
const deltaY = (e.clientY - this.startY) * this.dragSpeed;
|
|
66
|
-
this.translateX += deltaX;
|
|
67
|
-
this.translateY += deltaY;
|
|
68
|
-
this.$refs.image.style.transform = `scale(${this.currentScale}) translate(${this.translateX}px, ${this.translateY}px)`;
|
|
69
|
-
this.startX = e.clientX;
|
|
70
|
-
this.startY = e.clientY;
|
|
71
|
-
},
|
|
72
|
-
// 鼠标松开事件处理函数
|
|
73
|
-
onMouseUp() {
|
|
74
|
-
this.isDragging = false;
|
|
75
|
-
this.$refs.image.style.cursor = 'grab';
|
|
76
|
-
},
|
|
77
|
-
// 鼠标滚轮事件处理函数
|
|
78
|
-
onWheel(e) {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
const delta = e.deltaY > 0 ? -1 : 1;
|
|
81
|
-
this.currentScale = Math.min(
|
|
82
|
-
this.maxScale,
|
|
83
|
-
Math.max(this.minScale, this.currentScale + delta * this.zoomSpeed),
|
|
84
|
-
);
|
|
85
|
-
this.$refs.image.style.transform = `scale(${this.currentScale}) translate(${this.translateX}px, ${this.translateY}px)`;
|
|
86
|
-
},
|
|
87
|
-
// 重置图片缩放和移动
|
|
88
|
-
resetImage() {
|
|
89
|
-
this.currentScale = 1;
|
|
90
|
-
this.translateX = 0;
|
|
91
|
-
this.translateY = 0;
|
|
92
|
-
this.$refs.image.style.transform = 'scale(1) translate(0, 0)';
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
</script>
|
|
97
|
-
|
|
98
|
-
<style lang="scss" scoped>
|
|
99
|
-
.imageView {
|
|
100
|
-
width: 100%;
|
|
101
|
-
height: 100%;
|
|
102
|
-
overflow: hidden;
|
|
103
|
-
display: flex;
|
|
104
|
-
justify-content: center;
|
|
105
|
-
align-items: center;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.imageView .elImageclass {
|
|
109
|
-
width: 100%;
|
|
110
|
-
height: 100%;
|
|
111
|
-
touch-action: none;
|
|
112
|
-
user-drag: none;
|
|
113
|
-
-webkit-user-drag: none;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
img {
|
|
117
|
-
width: 100%;
|
|
118
|
-
height: 100%;
|
|
119
|
-
cursor: grab;
|
|
120
|
-
object-fit: contain !important;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.image-icon {
|
|
124
|
-
font-size: 50px;
|
|
125
|
-
}
|
|
126
|
-
</style>
|