fl-web-component 1.3.0 → 1.3.1
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 +3 -0
- package/dist/fl-web-component.common.js +89 -67
- 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 +1 -1
- package/packages/components/com-graphics/index.vue +7 -3
- package/src/main.js +14 -18
- package/src/utils/threejs/measure-angle.js +9 -4
- package/src/utils/threejs/measure-area.js +8 -3
- package/src/utils/threejs/measure-distance.js +8 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";#fl-model[data-v-
|
|
1
|
+
@charset "UTF-8";#fl-model[data-v-070832d8]{width:100%;height:100%;cursor:pointer}[data-v-070832d8] .tips-label{width:50px;color:#000;font:12px Helvetica;padding:5px;text-align:center;vertical-align:middle;background-color:khaki}[data-v-070832d8] .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-070832d8] .circle-tag{width:10px;height:10px;margin-top:5px;border-radius:50%;background-color:#ff5000}[data-v-070832d8] .measure-label-font{word-break:break-all}[data-v-070832d8] .mark-label-img{padding-top:5px;width:20px;height:20px}#konva-container[data-v-59765f1d]{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
|
@@ -161,7 +161,7 @@ var preTarget = [];
|
|
|
161
161
|
let entities = formatEntity(dxf.entities);
|
|
162
162
|
let layers = dxf.tables.layer.layers;
|
|
163
163
|
|
|
164
|
-
for (let key in
|
|
164
|
+
for (let key in entities) {
|
|
165
165
|
if (entities[key]) {
|
|
166
166
|
let group = [];
|
|
167
167
|
let l = entities[key].length;
|
|
@@ -158,7 +158,8 @@
|
|
|
158
158
|
preserveDrawingBuffer: true, //保留图形缓冲区 TODO 临时截图使用
|
|
159
159
|
});
|
|
160
160
|
renderer.setPixelRatio(window.devicePixelRatio);
|
|
161
|
-
|
|
161
|
+
const rect = instructions.getBoundingClientRect();
|
|
162
|
+
renderer.setSize(rect.width, rect.height);
|
|
162
163
|
renderer.domElement.id = 'three-model';
|
|
163
164
|
renderer.shadowMap.enabled = true;
|
|
164
165
|
// 暂时注释这句 还有worker里面的 这跟渲染出的模型浅或暗有关系
|
|
@@ -205,9 +206,11 @@
|
|
|
205
206
|
// 初始化文字画布
|
|
206
207
|
initLabelRender() {
|
|
207
208
|
labelRenderer = new CSS2DRenderer();
|
|
208
|
-
|
|
209
|
+
const rect = instructions.getBoundingClientRect();
|
|
210
|
+
labelRenderer.setSize(rect.width, rect.height);
|
|
209
211
|
labelRenderer.domElement.style.position = 'absolute';
|
|
210
|
-
|
|
212
|
+
|
|
213
|
+
labelRenderer.domElement.style.top = `${rect.top}px`;
|
|
211
214
|
labelRenderer.domElement.style.pointerEvents = 'none';
|
|
212
215
|
instructions.appendChild(labelRenderer.domElement);
|
|
213
216
|
},
|
|
@@ -1564,6 +1567,7 @@
|
|
|
1564
1567
|
::v-deep .circle-tag {
|
|
1565
1568
|
width: 10px;
|
|
1566
1569
|
height: 10px;
|
|
1570
|
+
margin-top: 5px;
|
|
1567
1571
|
border-radius: 50%;
|
|
1568
1572
|
background-color: #ff5000;
|
|
1569
1573
|
}
|
package/src/main.js
CHANGED
|
@@ -3,30 +3,26 @@ import Fl2dcanvas from '../packages/components/com-flcanvas/index.vue';
|
|
|
3
3
|
import FLPerControl from '../packages/components/com-graphics/per-control.vue';
|
|
4
4
|
import FlSvg from '../packages/components/com-graphics/pid.vue';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
|
+
import pkg from '../package.json';
|
|
6
7
|
|
|
7
|
-
const components = [
|
|
8
|
-
FlModel,
|
|
9
|
-
Fl2dcanvas,
|
|
10
|
-
FLPerControl,
|
|
11
|
-
FlSvg
|
|
12
|
-
];
|
|
8
|
+
const components = [FlModel, Fl2dcanvas, FLPerControl, FlSvg];
|
|
13
9
|
|
|
14
|
-
const install =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const install = Vue => {
|
|
11
|
+
Vue.prototype.THREE = THREE;
|
|
12
|
+
components.forEach(component => {
|
|
13
|
+
Vue.component(component.name, component);
|
|
14
|
+
});
|
|
19
15
|
};
|
|
20
16
|
|
|
21
17
|
// 支持浏览器环境直接引入
|
|
22
|
-
if (typeof window !== 'undefined'
|
|
23
|
-
|
|
18
|
+
if (typeof window !== 'undefined') {
|
|
19
|
+
window.FLVersion = pkg.version;
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
export default {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
install,
|
|
24
|
+
FlModel,
|
|
25
|
+
FlSvg,
|
|
26
|
+
Fl2dcanvas,
|
|
27
|
+
FLPerControl,
|
|
32
28
|
};
|
|
@@ -42,9 +42,14 @@ MeasureAngle.prototype = {
|
|
|
42
42
|
this.height = height
|
|
43
43
|
},
|
|
44
44
|
getPosition(e) {
|
|
45
|
-
const mouse = new THREE.Vector2()
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const mouse = new THREE.Vector2();
|
|
46
|
+
const elRect = this.renderer.domElement.getBoundingClientRect();
|
|
47
|
+
const canvasX = e.clientX - elRect.left;
|
|
48
|
+
const canvasY = e.clientY - elRect.top;
|
|
49
|
+
|
|
50
|
+
mouse.x = (canvasX / elRect.width) * 2.0 - 1.0;
|
|
51
|
+
mouse.y = -(canvasY / elRect.height) * 2.0 + 1.0;
|
|
52
|
+
|
|
48
53
|
_this.raycaster.setFromCamera(mouse, this.camera)
|
|
49
54
|
let intersects = _this.raycaster.intersectObjects(_this.scene.children, true)
|
|
50
55
|
if(intersects.length > 0) {
|
|
@@ -139,7 +144,7 @@ MeasureAngle.prototype = {
|
|
|
139
144
|
},
|
|
140
145
|
click(e) {
|
|
141
146
|
let lastTime = new Date().getTime();
|
|
142
|
-
if (lastTime
|
|
147
|
+
if (lastTime - this.firstTime < 300) {
|
|
143
148
|
if (_this.isCompleted) {
|
|
144
149
|
_this.renderer.domElement.addEventListener('mousemove', _this.mousemove)
|
|
145
150
|
}
|
|
@@ -40,9 +40,14 @@ MeasureArea.prototype = {
|
|
|
40
40
|
this.height = height
|
|
41
41
|
},
|
|
42
42
|
getPosition(e) {
|
|
43
|
-
const mouse = new THREE.Vector2()
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const mouse = new THREE.Vector2();
|
|
44
|
+
const elRect = this.renderer.domElement.getBoundingClientRect();
|
|
45
|
+
const canvasX = e.clientX - elRect.left;
|
|
46
|
+
const canvasY = e.clientY - elRect.top;
|
|
47
|
+
|
|
48
|
+
mouse.x = (canvasX / elRect.width) * 2.0 - 1.0;
|
|
49
|
+
mouse.y = -(canvasY / elRect.height) * 2.0 + 1.0;
|
|
50
|
+
|
|
46
51
|
_this.raycaster.setFromCamera(mouse, _this.camera)
|
|
47
52
|
let intersects =_this.raycaster.intersectObjects(_this.scene.children, true)
|
|
48
53
|
if(intersects.length > 0) {
|
|
@@ -38,9 +38,14 @@ MeasureDistance.prototype = {
|
|
|
38
38
|
this.height = height
|
|
39
39
|
},
|
|
40
40
|
getPosition(e) {
|
|
41
|
-
const mouse = new THREE.Vector2()
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const mouse = new THREE.Vector2();
|
|
42
|
+
const elRect = this.renderer.domElement.getBoundingClientRect();
|
|
43
|
+
const canvasX = e.clientX - elRect.left;
|
|
44
|
+
const canvasY = e.clientY - elRect.top;
|
|
45
|
+
|
|
46
|
+
mouse.x = (canvasX / elRect.width) * 2.0 - 1.0;
|
|
47
|
+
mouse.y = -(canvasY / elRect.height) * 2.0 + 1.0;
|
|
48
|
+
|
|
44
49
|
_this.raycaster.setFromCamera(mouse, this.camera)
|
|
45
50
|
let intersects = _this.raycaster.intersectObjects(_this.scene.children, true)
|
|
46
51
|
if(intersects.length > 0) {
|