@ohuoy/easymap 1.1.11 → 1.1.13
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/index.js
CHANGED
|
@@ -127,7 +127,7 @@ export class EasyMap {
|
|
|
127
127
|
})
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
mapStyleTimer = null
|
|
131
131
|
setMapStyle(style){
|
|
132
132
|
let map = this.map;
|
|
133
133
|
const layerIds = map.style.order
|
|
@@ -143,38 +143,60 @@ export class EasyMap {
|
|
|
143
143
|
layers.push(layer)
|
|
144
144
|
map.removeLayer(id)
|
|
145
145
|
});
|
|
146
|
-
const handleStyleLoad = () => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
else if(layerIds.indexOf("yingxiang") >= 0){
|
|
168
|
-
map.theme.value ="dark"
|
|
169
|
-
}else{
|
|
170
|
-
map.theme.value = map.style.stylesheet.theme
|
|
171
|
-
}
|
|
146
|
+
// const handleStyleLoad = () => {
|
|
147
|
+
// console.log(222)
|
|
148
|
+
// sources.forEach(source=>{
|
|
149
|
+
// if (!map.getSource(source.id)) {
|
|
150
|
+
// map.addSource(source.id,source._options);
|
|
151
|
+
// }
|
|
152
|
+
// })
|
|
153
|
+
// layers.forEach(layer=>{
|
|
154
|
+
// if (!map.getLayer(layer.id)) {
|
|
155
|
+
// map.addLayer(layer);
|
|
156
|
+
// }
|
|
157
|
+
// })
|
|
158
|
+
|
|
159
|
+
// if(layerIds.indexOf("tiandi") >= 0){
|
|
160
|
+
// map.theme.value ="light"
|
|
161
|
+
// }
|
|
162
|
+
// else if(layerIds.indexOf("yingxiang") >= 0){
|
|
163
|
+
// map.theme.value ="dark"
|
|
164
|
+
// }else{
|
|
165
|
+
// map.theme.value = map.style.stylesheet.theme
|
|
166
|
+
// }
|
|
172
167
|
|
|
173
|
-
|
|
174
|
-
};
|
|
168
|
+
// map.off('style.load', handleStyleLoad);
|
|
169
|
+
// };
|
|
175
170
|
|
|
176
|
-
map.on('style.load', handleStyleLoad);
|
|
177
|
-
map.
|
|
171
|
+
// this.map.on('style.load', handleStyleLoad);
|
|
172
|
+
this.map.on('styledata', ()=>{
|
|
173
|
+
if(this.mapStyleTimer){
|
|
174
|
+
clearTimeout(this.mapStyleTimer)
|
|
175
|
+
}
|
|
176
|
+
this.mapStyleTimer = setTimeout(() => {
|
|
177
|
+
sources.forEach(source=>{
|
|
178
|
+
if (!map.getSource(source.id)) {
|
|
179
|
+
map.addSource(source.id,source._options);
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
layers.forEach(layer=>{
|
|
183
|
+
if (!map.getLayer(layer.id)) {
|
|
184
|
+
map.addLayer(layer);
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
if(layerIds.indexOf("tiandi") >= 0){
|
|
189
|
+
map.theme.value ="light"
|
|
190
|
+
}
|
|
191
|
+
else if(layerIds.indexOf("yingxiang") >= 0){
|
|
192
|
+
map.theme.value ="dark"
|
|
193
|
+
}else{
|
|
194
|
+
map.theme.value = map.style.stylesheet.theme
|
|
195
|
+
}
|
|
196
|
+
this.mapStyleTimer = null
|
|
197
|
+
}, 1000);
|
|
198
|
+
});
|
|
199
|
+
this.map.setStyle(style);
|
|
178
200
|
}
|
|
179
201
|
|
|
180
202
|
async setStyle(url){
|
package/package.json
CHANGED
|
@@ -129,8 +129,11 @@ export default class ThreeScanLayer{
|
|
|
129
129
|
await sleep(500)
|
|
130
130
|
}
|
|
131
131
|
let elList = this.map._container.getElementsByClassName('esm-font-time')
|
|
132
|
-
this.map.theme = this.map.theme ? this.map.theme :this.map.style.stylesheet.theme
|
|
133
|
-
|
|
132
|
+
// this.map.theme = this.map.theme ? this.map.theme :this.map.style.stylesheet.theme
|
|
133
|
+
if(!this.map.theme){
|
|
134
|
+
this.map.theme = this.map.theme ? this.map.theme :this.map.style.stylesheet.theme
|
|
135
|
+
}
|
|
136
|
+
// console.log('theme:'+this.map.theme.value)
|
|
134
137
|
let color = this.map.theme.value == "dark"?"#fff" : "#000"
|
|
135
138
|
if(elList.length == 0){
|
|
136
139
|
await sleep(200)
|
|
@@ -233,7 +233,7 @@ export default class ThreeWallLayer{
|
|
|
233
233
|
// normals.push(_n.x,_n.y,_n.z)
|
|
234
234
|
// let arrowHelper = new THREE.ArrowHelper( new THREE.Vector3(_n.x, _n.y, _n.z), new THREE.Vector3( 0, 0, 0 ), 100, 0xffff00 );
|
|
235
235
|
// this.scene.add(arrowHelper)
|
|
236
|
-
console.log(_n)
|
|
236
|
+
// console.log(_n)
|
|
237
237
|
|
|
238
238
|
for(let j in item.data){
|
|
239
239
|
let h = (j * 1 -1 +noDataLenth) * this.scale
|