Skip to content

Commit

Permalink
Some fixes (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxart authored Apr 27, 2024
1 parent e234579 commit cec00bf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@2gis/mapgl-gltf",
"version": "2.0.0",
"version": "2.0.1",
"description": "Plugin for the rendering glTF models with MapGL",
"main": "dist/bundle.js",
"typings": "dist/types/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/labelGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const DEFAULT_IMAGE: LabelImage = {
padding: [5, 10, 5, 10],
};

/**
* @hidden
* @internal
*/
export class LabelGroups {
private labelsByGroupId: Map<string, Label[]> = new Map();

Expand Down
31 changes: 22 additions & 9 deletions src/realtyScene/realtyScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,23 @@ export class RealtyScene {
const prevModelOptions = prevState.buildingVisibility.get(buildingId);
const newModelOptions = newState.buildingVisibility.get(buildingId);

// если опции не изменились, то ничего не делаем
// если опции не изменились, то выставляем только опции карты, если модель активна
if (
prevModelOptions?.modelId === newModelOptions?.modelId &&
prevState.status === newState.status
) {
buildingVisibility.set(buildingId, prevModelOptions);

if (prevModelOptions && prevModelOptions.modelId === newState.activeModelId) {
const options =
this.buildings.get(prevModelOptions.modelId) ??
this.floors.get(prevModelOptions.modelId);

if (options) {
this.setMapOptions(options.mapOptions);
}
}

return;
}

Expand Down Expand Up @@ -230,14 +241,16 @@ export class RealtyScene {
this.control.show({
buildingModelId: buildingOptions.modelId,
activeModelId: newState.activeModelId,
floorLevels: [
{
modelId: buildingOptions.modelId,
icon: 'building',
text: '',
},
...buildingOptions.floors,
],
floorLevels: buildingOptions.floors.length
? [
{
modelId: buildingOptions.modelId,
icon: 'building',
text: '',
},
...buildingOptions.floors,
]
: [],
});
}
}
Expand Down

0 comments on commit cec00bf

Please sign in to comment.