diff --git a/package-lock.json b/package-lock.json index 937e51c..968550b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@2gis/mapgl-gltf", - "version": "1.2.0", + "version": "1.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@2gis/mapgl-gltf", - "version": "1.2.0", + "version": "1.2.1", "license": "BSD-2-Clause", "devDependencies": { "@2gis/mapgl": "1.37.2", diff --git a/package.json b/package.json index 83870da..3037b50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@2gis/mapgl-gltf", - "version": "1.2.0", + "version": "1.2.1", "description": "Plugin for the rendering glTF models with MapGL", "main": "dist/bundle.js", "typings": "dist/types/index.d.ts", diff --git a/src/plugin.ts b/src/plugin.ts index 4a5935b..20a9d37 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -126,7 +126,7 @@ export class GltfPlugin extends Evented { public async addModelsPartially(modelOptions: ModelOptions[], ids: Id[]) { await this.waitForPluginInit; - const loadedModels = this.startModelLoading(modelOptions); + const loadedModels = this.startModelLoading(modelOptions, ids); return Promise.all(loadedModels).then(() => { if (this.options.modelsLoadStrategy === 'waitAll') { @@ -314,15 +314,17 @@ export class GltfPlugin extends Evented { }); } - private startModelLoading(modelOptions: ModelOptions[]) { + private startModelLoading(modelOptions: ModelOptions[], ids?: Id[]) { return modelOptions.map((options) => { return this.loader.loadModel(options).then(() => { if (this.options.modelsLoadStrategy === 'dontWaitAll') { - if (options.linkedIds) { - this.map.setHiddenObjects(options.linkedIds); + if (ids === undefined || ids.includes(options.modelId)) { + if (options.linkedIds) { + this.map.setHiddenObjects(options.linkedIds); + } + this.addModelFromCache(options.modelId); + this.map.triggerRerender(); } - this.addModelFromCache(options.modelId); - this.map.triggerRerender(); } }); });