fl-web-component 1.3.11 → 1.3.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/README.md +4 -1
- package/dist/fl-web-component.common.js +75 -29
- 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-graphics/index.vue +17 -0
- package/src/utils/index.js +0 -18
- package/src/utils/threejs/measure-angle.js +9 -0
- package/src/utils/threejs/measure-area.js +10 -0
- package/src/utils/threejs/measure-distance.js +11 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";#fl-model[data-v-
|
|
1
|
+
@charset "UTF-8";#fl-model[data-v-785e8966]{width:100%;height:100%;cursor:pointer}[data-v-785e8966] .tips-label{width:60px;color:#000;font:12px Helvetica;margin-top:-3em;padding:5px;text-align:center;vertical-align:middle;background-color:khaki}[data-v-785e8966] .measure-label{max-width:100px;margin-top:-1em;border:10px;border-radius:5px;padding:3px 10px;cursor:pointer;color:#009bea;background-color:#f4f4f4;box-shadow:0 1px 3px 1px rgba(0,0,0,.25)}[data-v-785e8966] .circle-tag{width:10px;height:10px;margin-top:5px;border-radius:50%;background-color:#ff5000}[data-v-785e8966] .measure-label-font{word-break:break-all}[data-v-785e8966] .mark-label-img{padding-top:5px;width:20px;height:20px}#konva-container[data-v-2fa9e609]{z-index:3;width:100%;height:100%;cursor:pointer;overflow:hidden}span[data-v-f547d5c6]{font-weight:bolder}.text[data-v-f547d5c6]{margin-top:20px}.line[data-v-f547d5c6]{border-bottom:1px solid #dcdfe6;margin:20px 0}.center[data-v-f547d5c6]{display:flex;flex-direction:column;align-items:center}.center .cen span[data-v-f547d5c6],.center .top span[data-v-f547d5c6]{color:"#53a8ff";display:inline-block;width:30px;height:30px;text-align:center;line-height:30px;border:1px solid;padding:5px;margin-bottom:10px;background-color:#e9f3ff}.center .cen span[data-v-f547d5c6]{margin:10px}.button[data-v-f547d5c6]{display:flex;justify-content:end;margin-top:20px}@font-face{font-family:iconfont;src:url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.woff2?t=1646635700216) format("woff2"),url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.woff?t=1646635700216) format("woff"),url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.ttf?t=1646635700216) format("truetype")}.iconfont[data-v-f547d5c6]{font-family:iconfont!important;font-size:50px;font-style:normal;color:"#53a8ff";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-shubiao[data-v-f547d5c6]:before{content:""}#svg-tigger[data-v-0ec35ee4]{cursor:pointer;height:100%;width:100%}
|
package/package.json
CHANGED
|
@@ -1288,6 +1288,8 @@
|
|
|
1288
1288
|
threeMeasure.start();
|
|
1289
1289
|
break;
|
|
1290
1290
|
}
|
|
1291
|
+
// 添加键盘事件监听器
|
|
1292
|
+
document.addEventListener('keydown', this.handleMeasureKeyDown, false);
|
|
1291
1293
|
},
|
|
1292
1294
|
// 关闭测量
|
|
1293
1295
|
closeMeasure() {
|
|
@@ -1297,6 +1299,21 @@
|
|
|
1297
1299
|
threeMeasure = null;
|
|
1298
1300
|
// this.timeRender()
|
|
1299
1301
|
}
|
|
1302
|
+
// 移除键盘事件监听器
|
|
1303
|
+
document.removeEventListener('keydown', this.handleMeasureKeyDown, false);
|
|
1304
|
+
},
|
|
1305
|
+
handleMeasureKeyDown(event) {
|
|
1306
|
+
// 检查是否按下了ESC键
|
|
1307
|
+
const keyParam = {
|
|
1308
|
+
desc: event.key,
|
|
1309
|
+
keyCode: event.keyCode,
|
|
1310
|
+
event,
|
|
1311
|
+
};
|
|
1312
|
+
if (event.keyCode === 27) {
|
|
1313
|
+
// ESC键的键码是27
|
|
1314
|
+
this.closeMeasure();
|
|
1315
|
+
}
|
|
1316
|
+
this.$emit('keyDown', keyParam);
|
|
1300
1317
|
},
|
|
1301
1318
|
// 开启平移
|
|
1302
1319
|
/*
|
package/src/utils/index.js
CHANGED
|
@@ -374,24 +374,6 @@ function miniDevtool() {
|
|
|
374
374
|
if (document.readyState === 'loading') {
|
|
375
375
|
document.addEventListener('DOMContentLoaded', createPanel);
|
|
376
376
|
} else createPanel();
|
|
377
|
-
|
|
378
|
-
// 是否支持 WebGL
|
|
379
|
-
function hasWebGL() {
|
|
380
|
-
console.log('flversion', window.FLVersion)
|
|
381
|
-
console.log('userAgent:', navigator.userAgent);
|
|
382
|
-
console.log('has WebGLRenderingContext:', !!window.WebGLRenderingContext);
|
|
383
|
-
const c = document.createElement('canvas');
|
|
384
|
-
|
|
385
|
-
try {
|
|
386
|
-
const g1 = c.getContext('webgl');
|
|
387
|
-
const g2 = c.getContext('experimental-webgl');
|
|
388
|
-
const g3 = c.getContext('webgl2');
|
|
389
|
-
console.log('webgl contexts:', { g1: !!g1, g2: !!g2, g3: !!g3 });
|
|
390
|
-
} catch (e) {
|
|
391
|
-
console.error('getContext error', e);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
console.log('===========hasWebGL=======', hasWebGL());
|
|
395
377
|
}
|
|
396
378
|
|
|
397
379
|
export { screenshot, miniDevtool };
|
|
@@ -21,6 +21,9 @@ var MeasureAngle = function (renderer, scene, camera, width, height) {
|
|
|
21
21
|
this.width = width;
|
|
22
22
|
this.height = height;
|
|
23
23
|
this.firstTime = 0;
|
|
24
|
+
// 创建一个辅助平面来捕获鼠标事件
|
|
25
|
+
this.plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
|
|
26
|
+
|
|
24
27
|
// this.POINT_MATERIAL = new THREE.PointsMaterial({ color: 0xff5000, size: 1, opacity: 0.6, transparent: true, depthWrite: false, depthTest: false })
|
|
25
28
|
// this.LINE_MATERIAL = new THREE.LineBasicMaterial({ color: 0xff0000, linewidth: 3, opacity: 0.8, transparent: true, side: THREE.DoubleSide, depthWrite: false, depthTest: false })
|
|
26
29
|
};
|
|
@@ -55,6 +58,12 @@ MeasureAngle.prototype = {
|
|
|
55
58
|
if (intersects.length > 0) {
|
|
56
59
|
return intersects[0].point;
|
|
57
60
|
}
|
|
61
|
+
// 如果没有交点,则创建一个在相机视图平面上的点
|
|
62
|
+
const ray = new THREE.Ray();
|
|
63
|
+
_this.raycaster.ray.intersectPlane(_this.plane, ray.origin);
|
|
64
|
+
if (ray.origin) {
|
|
65
|
+
return ray.origin;
|
|
66
|
+
}
|
|
58
67
|
return null;
|
|
59
68
|
},
|
|
60
69
|
createPoints(pos, config = { color: 0x009bea, size: 0.3 }) {
|
|
@@ -21,6 +21,9 @@ var MeasureArea = function (renderer, scene, camera, width, height) {
|
|
|
21
21
|
this.width = width;
|
|
22
22
|
this.height = height;
|
|
23
23
|
this.firstTime = 0;
|
|
24
|
+
|
|
25
|
+
// 创建一个辅助平面来捕获鼠标事件
|
|
26
|
+
this.plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
MeasureArea.prototype = {
|
|
@@ -53,6 +56,13 @@ MeasureArea.prototype = {
|
|
|
53
56
|
if (intersects.length > 0) {
|
|
54
57
|
return intersects[0].point;
|
|
55
58
|
}
|
|
59
|
+
|
|
60
|
+
// 如果没有交点,则创建一个在相机视图平面上的点
|
|
61
|
+
const ray = new THREE.Ray();
|
|
62
|
+
_this.raycaster.ray.intersectPlane(_this.plane, ray.origin);
|
|
63
|
+
if (ray.origin) {
|
|
64
|
+
return ray.origin;
|
|
65
|
+
}
|
|
56
66
|
return null;
|
|
57
67
|
},
|
|
58
68
|
createLine(p1, p2, config = { color: 0xff0000 }) {
|
|
@@ -19,6 +19,9 @@ var MeasureDistance = function (renderer, scene, camera, width, height) {
|
|
|
19
19
|
this.width = width;
|
|
20
20
|
this.height = height;
|
|
21
21
|
this.firstTime = 0;
|
|
22
|
+
|
|
23
|
+
// 创建一个辅助平面来捕获鼠标事件
|
|
24
|
+
this.plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
MeasureDistance.prototype = {
|
|
@@ -51,6 +54,14 @@ MeasureDistance.prototype = {
|
|
|
51
54
|
if (intersects.length > 0) {
|
|
52
55
|
return intersects[0].point;
|
|
53
56
|
}
|
|
57
|
+
|
|
58
|
+
// 如果没有交点,则创建一个在相机视图平面上的点
|
|
59
|
+
const ray = new THREE.Ray();
|
|
60
|
+
_this.raycaster.ray.intersectPlane(_this.plane, ray.origin);
|
|
61
|
+
if (ray.origin) {
|
|
62
|
+
return ray.origin;
|
|
63
|
+
}
|
|
64
|
+
|
|
54
65
|
return null;
|
|
55
66
|
},
|
|
56
67
|
createLine(p1, p2, config = { color: 0xff0000 }) {
|