style: lint style

This commit is contained in:
shihui 2021-10-25 20:29:14 +08:00
parent d0c8f6ae59
commit 6bbc9dc5b2
3 changed files with 13 additions and 13 deletions

View File

@ -29,7 +29,7 @@ scene.on('loaded', () => {
const center = scene.getCenter(); const center = scene.getCenter();
const cubeGeometry = new THREE.BoxBufferGeometry(10000, 10000, 10000); const cubeGeometry = new THREE.BoxBufferGeometry(10000, 10000, 10000);
const cubeMaterial = new THREE.MeshNormalMaterial({side: THREE.DoubleSide}); const cubeMaterial = new THREE.MeshNormalMaterial({ side: THREE.DoubleSide });
const cube = new THREE.Mesh(cubeGeometry, cubeMaterial); const cube = new THREE.Mesh(cubeGeometry, cubeMaterial);
layer.setObjectLngLat(cube, [ center.lng + 0.05, center.lat ], 0); layer.setObjectLngLat(cube, [ center.lng + 0.05, center.lat ], 0);
threeScene.add(cube); threeScene.add(cube);
@ -42,7 +42,7 @@ scene.on('loaded', () => {
// 根据 GeoJSON 数据放置模型 // 根据 GeoJSON 数据放置模型
layer.getSource().data.dataArray.forEach(({ coordinates }) => { layer.getSource().data.dataArray.forEach(({ coordinates }) => {
const gltfScene = gltf.scene; const gltfScene = gltf.scene;
setDouble(gltfScene) setDouble(gltfScene);
layer.adjustMeshToMap(gltfScene); layer.adjustMeshToMap(gltfScene);
// gltfScene.scale.set(1000, 1000, 1000) // gltfScene.scale.set(1000, 1000, 1000)
layer.setMeshScale(gltfScene, 1000, 1000, 1000); layer.setMeshScale(gltfScene, 1000, 1000, 1000);
@ -102,9 +102,9 @@ scene.on('loaded', () => {
}); });
function setDouble(object) { function setDouble(object) {
if(object.children && object.children.length && object.children.length > 0) { if (object.children && object.children.length && object.children.length > 0) {
object.children.map(child => setDouble(child)) object.children.map(child => setDouble(child));
} else if(object.material){ } else if (object.material) {
object.material.side = THREE.DoubleSide; object.material.side = THREE.DoubleSide;
} }
} }

View File

@ -162,7 +162,7 @@ scene.on('loaded', () => {
gltf => { gltf => {
// 根据 GeoJSON 数据放置模型 // 根据 GeoJSON 数据放置模型
const gltfScene = gltf.scene.clone(); const gltfScene = gltf.scene.clone();
setDouble(gltfScene) setDouble(gltfScene);
layer.getSource().data.dataArray.forEach(() => { layer.getSource().data.dataArray.forEach(() => {
layer.adjustMeshToMap(gltfScene); layer.adjustMeshToMap(gltfScene);
gltfScene.scale.set(500000, 500000, 500000); gltfScene.scale.set(500000, 500000, 500000);
@ -218,9 +218,9 @@ scene.on('loaded', () => {
}); });
function setDouble(object) { function setDouble(object) {
if(object.children && object.children.length && object.children.length > 0) { if (object.children && object.children.length && object.children.length > 0) {
object.children.map(child => setDouble(child)) object.children.map(child => setDouble(child));
} else if(object.material){ } else if (object.material) {
object.material.side = THREE.DoubleSide; object.material.side = THREE.DoubleSide;
} }
} }

View File

@ -157,7 +157,7 @@ scene.on('loaded', () => {
'https://gw.alipayobjects.com/os/bmw-prod/3ca0a546-92d8-4ba0-a89c-017c218d5bea.gltf', 'https://gw.alipayobjects.com/os/bmw-prod/3ca0a546-92d8-4ba0-a89c-017c218d5bea.gltf',
gltf => { gltf => {
const antModel = gltf.scene; const antModel = gltf.scene;
setDouble(antModel) setDouble(antModel);
// antModel.children[0].material.side = THREE.DoubleSide // antModel.children[0].material.side = THREE.DoubleSide
layer.adjustMeshToMap(antModel); layer.adjustMeshToMap(antModel);
layer.setMeshScale(antModel, 20, 20, 20); layer.setMeshScale(antModel, 20, 20, 20);
@ -428,9 +428,9 @@ scene.on('loaded', () => {
}); });
function setDouble(object) { function setDouble(object) {
if(object.children && object.children.length && object.children.length > 0) { if (object.children && object.children.length && object.children.length > 0) {
object.children.map(child => setDouble(child)) object.children.map(child => setDouble(child));
} else if(object.material){ } else if (object.material) {
object.material.side = THREE.DoubleSide; object.material.side = THREE.DoubleSide;
} }
} }