fl-web-component 1.0.8 → 1.0.9
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 +172 -110
- package/dist/fl-web-component.css +1 -1
- package/dist/fl-web-component.umd.js +172 -110
- package/dist/fl-web-component.umd.min.js +3 -3
- package/package.json +3 -2
- package/packages/components/com-graphics/index.vue +2 -1
- package/src/assets/arrow-right.png +0 -0
- package/src/utils/instance-parser.js +50 -58
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fl-web-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vue-cli-service serve",
|
|
6
6
|
"lint": "eslint \"{src,packages}/**/*.{vue,js}\" --fix",
|
|
7
7
|
"prettier": "prettier --write \"packages/**/*.{js,css,less,scss,vue,html}\"",
|
|
8
8
|
"watch": "npm run lint && vue-cli-service build --watch --mode production --target lib --name fl-web-component ./src/main.js",
|
|
9
|
-
"build": "npm run lint && vue-cli-service build --target lib --name fl-web-component ./src/main.js"
|
|
9
|
+
"build": "npm run lint && vue-cli-service build --target lib --name fl-web-component ./src/main.js",
|
|
10
|
+
"publish": "npm run build && npm publish"
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
12
13
|
"dist",
|
|
@@ -79,6 +79,7 @@ var roamConfig = {
|
|
|
79
79
|
},
|
|
80
80
|
data() {
|
|
81
81
|
return {
|
|
82
|
+
arrowImg: require('@/assets/arrow-right.png'),
|
|
82
83
|
};
|
|
83
84
|
},
|
|
84
85
|
created() {
|
|
@@ -584,7 +585,7 @@ var roamConfig = {
|
|
|
584
585
|
curve = new this.THREE.CatmullRomCurve3(route, false, 'catmullrom', 0);
|
|
585
586
|
const geometry = new this.THREE.TubeGeometry(curve, 5000, 0.5, 4);
|
|
586
587
|
//加载纹理
|
|
587
|
-
lineTexture = new this.THREE.TextureLoader().load(
|
|
588
|
+
lineTexture = new this.THREE.TextureLoader().load(this.arrowImg);
|
|
588
589
|
lineTexture.wrapS = this.THREE.RepeatWrapping;
|
|
589
590
|
lineTexture.wrapT = this.THREE.RepeatWrapping;
|
|
590
591
|
lineTexture.repeat.set(20, 1); //水平重复20次
|
|
Binary file
|
|
@@ -31,72 +31,64 @@ function handleInstancedMeshModel(instances, drawObjs, type, scene, customColor,
|
|
|
31
31
|
for (let i = 0; i < instances.length; i++) {
|
|
32
32
|
formatInstancedMap(instances[i], drawObjs);
|
|
33
33
|
}
|
|
34
|
-
console.log('drawObjMapInstance', drawObjMapInstance)
|
|
35
34
|
// 第二阶段:遍历所有实例进行处理
|
|
36
35
|
for (let i = 0; i < instances.length; i++) {
|
|
37
36
|
let targetGroup, instancedMeshIndex, drawObjectName;
|
|
38
|
-
// for (let drawObjectId in drawObjMapInstance) {
|
|
39
|
-
// const drawObj = drawObjMapInstance[drawObjectId];
|
|
40
|
-
// drawObj.MapInstance.forEach((instance, index) => {
|
|
41
|
-
// if (instance.instanceId == instances[i].instanceId) {
|
|
42
|
-
// instancedMeshIndex = index;
|
|
43
|
-
// drawObjectName = drawObjectId;
|
|
44
|
-
// }
|
|
45
|
-
// });
|
|
46
|
-
// }
|
|
47
|
-
|
|
48
37
|
const drawObjInstance = drawObjMapInstance[instances[i].drawObject];
|
|
49
|
-
drawObjInstance.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
if (drawObjectName) {
|
|
56
|
-
targetGroup = scene.getObjectByName(drawObjectName);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (!targetGroup) {
|
|
60
|
-
const drawObj = drawObjMapInstance[instances[i].drawObject];
|
|
61
|
-
const group = new THREE.Group();
|
|
62
|
-
group.name = instances[i].drawObject;
|
|
63
|
-
group.userData.isInstancedMeshGroup = true;
|
|
64
|
-
|
|
65
|
-
const instanceCount = drawObj.MapInstance.length;
|
|
66
|
-
drawObj.MapMesh?.forEach(mesh => {
|
|
67
|
-
const model = drawModel(mesh, group.name, instanceCount, customColor);
|
|
68
|
-
if (!model) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
let meshName = ''
|
|
72
|
-
for (const key in meshNameConfig) {
|
|
73
|
-
model.userData[key] = meshNameConfig[key]
|
|
74
|
-
meshName += ':' + meshNameConfig[key]
|
|
38
|
+
if (drawObjInstance.MapMesh.length > 0) {
|
|
39
|
+
drawObjInstance.MapInstance.forEach((instance, index) => {
|
|
40
|
+
if (instance.instanceId == instances[i].instanceId) {
|
|
41
|
+
instancedMeshIndex = index;
|
|
42
|
+
drawObjectName = instances[i].drawObject;
|
|
75
43
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
model.setColorAt(index, meshColor);
|
|
44
|
+
});
|
|
45
|
+
if (drawObjectName) {
|
|
46
|
+
targetGroup = scene.getObjectByName(drawObjectName);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!targetGroup) {
|
|
50
|
+
const drawObj = drawObjMapInstance[instances[i].drawObject];
|
|
51
|
+
const group = new THREE.Group();
|
|
52
|
+
group.name = instances[i].drawObject;
|
|
53
|
+
group.userData.isInstancedMeshGroup = true;
|
|
54
|
+
|
|
55
|
+
const instanceCount = drawObj.MapInstance.length;
|
|
56
|
+
drawObj.MapMesh?.forEach(mesh => {
|
|
57
|
+
const model = drawModel(mesh, group.name, instanceCount, customColor);
|
|
58
|
+
if (!model) {
|
|
59
|
+
return;
|
|
93
60
|
}
|
|
61
|
+
let meshName = ''
|
|
62
|
+
for (const key in meshNameConfig) {
|
|
63
|
+
model.userData[key] = meshNameConfig[key]
|
|
64
|
+
meshName += ':' + meshNameConfig[key]
|
|
65
|
+
}
|
|
66
|
+
drawObj.MapInstance.forEach((instance, index) => {
|
|
67
|
+
if (instance.instanceId == instances[i].instanceId) {
|
|
68
|
+
model.userData.instanceIndex = index;
|
|
69
|
+
model.name = meshName !== '' ? (instances[i].instanceId + meshName) : instances[i].instanceId;
|
|
70
|
+
const matrixVal = instance.matrix?.val;
|
|
71
|
+
if (matrixVal) {
|
|
72
|
+
const m4 = new THREE.Matrix4();
|
|
73
|
+
// m4.setPosition(new THREE.Vector3(9999999, 9999999, 9999999)); // TODO 临时隐藏方案
|
|
74
|
+
m4.elements = instance.matrix.val;
|
|
75
|
+
model.setMatrixAt(index, m4);
|
|
76
|
+
}
|
|
77
|
+
// 需要先设置全部实例颜色,否则后续设置颜色无效
|
|
78
|
+
const { color } = mesh.prop;
|
|
79
|
+
const meshColor = customColor
|
|
80
|
+
? new THREE.Color(customColor)
|
|
81
|
+
: new THREE.Color(`rgb(${color[0]}, ${color[1]}, ${color[2]})`);
|
|
82
|
+
model.setColorAt(index, meshColor);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
// model.instanceColor.needsUpdate = true;
|
|
86
|
+
group.add(model);
|
|
94
87
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
98
|
-
modelGroup.add(group);
|
|
88
|
+
modelGroup.add(group);
|
|
89
|
+
}
|
|
99
90
|
}
|
|
91
|
+
|
|
100
92
|
}
|
|
101
93
|
console.log('modelGroup', modelGroup)
|
|
102
94
|
return modelGroup;
|