fl-web-component 1.2.19 → 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 +7 -1
- package/dist/fl-web-component.common.js +110 -69
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/package.json +5 -5
- package/packages/components/com-flcanvas/index.vue +1 -1
- package/packages/components/com-graphics/index.vue +8 -4
- package/src/main.js +14 -18
- package/src/static/question.svg +1 -0
- package/src/utils/flgltf-parser.js +21 -1
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fl-web-component",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"tip1": "仅调试本组件不涉及业务组件,请执行dev",
|
|
6
6
|
"dev": "vue-cli-service serve",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"build": "npm run lint && vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js",
|
|
13
13
|
"build:test": "vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js",
|
|
14
14
|
"registry:npm": "npm config set registry https://registry.npmjs.org/",
|
|
15
|
-
"publish:base": "npm run build && npm publish",
|
|
15
|
+
"publish:base": "npm run build && npm run registry:npm && npm publish",
|
|
16
16
|
"==": "=============================================================",
|
|
17
17
|
"tip3": "发版注意: 【修改bug执行publish:fix】【新增功能执行publish:feat】【新特性执行publish:perf】",
|
|
18
|
-
"publish:fix": "npm
|
|
19
|
-
"publish:feat": "npm
|
|
20
|
-
"publish:perf": "npm
|
|
18
|
+
"publish:fix": "npm version patch && npm run publish:base",
|
|
19
|
+
"publish:feat": "npm version minor && npm run publish:base",
|
|
20
|
+
"publish:perf": "npm version major && npm run publish:base"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
@@ -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;
|
|
@@ -157,8 +157,9 @@
|
|
|
157
157
|
powerPreference: 'high-performance',
|
|
158
158
|
preserveDrawingBuffer: true, //保留图形缓冲区 TODO 临时截图使用
|
|
159
159
|
});
|
|
160
|
-
renderer.setPixelRatio(window.devicePixelRatio
|
|
161
|
-
|
|
160
|
+
renderer.setPixelRatio(window.devicePixelRatio);
|
|
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
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1581238842264" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1409" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M512 0C229.233778 0 0 229.233778 0 512s229.233778 512 512 512 512-229.233778 512-512A512 512 0 0 0 512 0z m0 938.666667C276.366222 938.666667 85.333333 747.633778 85.333333 512 85.333333 276.366222 276.366222 85.333333 512 85.333333c235.633778 0 426.666667 191.032889 426.666667 426.666667a426.666667 426.666667 0 0 1-426.666667 426.666667z m0-717.653334a170.666667 170.666667 0 0 0-170.666667 170.666667 42.666667 42.666667 0 0 0 85.333334 0 85.333333 85.333333 0 1 1 85.333333 85.333333 42.666667 42.666667 0 0 0-42.666667 42.666667v111.36a42.666667 42.666667 0 0 0 85.333334 0v-74.24A170.666667 170.666667 0 0 0 512 221.013333z m-42.666667 542.293334a42.666667 42.666667 0 1 0 85.333334 0 42.666667 42.666667 0 0 0-85.333334 0z" p-id="1410"></path></svg>
|
|
@@ -99,7 +99,8 @@ function parseData(input) {
|
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
const formatInstances = [];
|
|
102
|
-
const
|
|
102
|
+
const preNode = input.node ? input.node : generateNode(input.mesh);
|
|
103
|
+
const rootInstances = parseNode(preNode);
|
|
103
104
|
flattenAndComputeWorldMatrices(rootInstances, formatInstances);
|
|
104
105
|
|
|
105
106
|
const map = {
|
|
@@ -166,5 +167,24 @@ function parseNode(node) {
|
|
|
166
167
|
|
|
167
168
|
return rootInstances;
|
|
168
169
|
}
|
|
170
|
+
// 生成默认node节点
|
|
171
|
+
function generateNode(mesh) {
|
|
172
|
+
let nodes = [];
|
|
173
|
+
mesh.forEach(item => {
|
|
174
|
+
if (item.primitives.length) {
|
|
175
|
+
let tempNode = {
|
|
176
|
+
id: item.id,
|
|
177
|
+
_batchId: item.id,
|
|
178
|
+
name: item.id,
|
|
179
|
+
mesh: item.id,
|
|
180
|
+
matrix: {},
|
|
181
|
+
nodeType: 3,
|
|
182
|
+
};
|
|
183
|
+
nodes.push(tempNode);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
return nodes;
|
|
188
|
+
}
|
|
169
189
|
|
|
170
190
|
export { parseData, parseNode };
|
|
@@ -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) {
|