@2gis/mapgl-gltf
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -21,2 +21,3 @@ import type { Map as MapGL } from '@2gis/mapgl/types'; | ||
private realtyScene?; | ||
private modelOptions; | ||
/** | ||
@@ -23,0 +24,0 @@ * The main class of the plugin |
@@ -15,3 +15,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { PoiGroups } from './poiGroups'; | ||
import { RealtyScene } from './realtyScene'; | ||
import { RealtyScene } from './realtyScene/realtyScene'; | ||
import { defaultOptions } from './defaultOptions'; | ||
@@ -52,2 +52,3 @@ export class GltfPlugin extends Evented { | ||
this.waitForPluginInit = new Promise((resolve) => (this.onPluginInit = resolve)); | ||
this.modelOptions = new Map(); | ||
this.map = map; | ||
@@ -83,2 +84,3 @@ this.options = Object.assign(Object.assign({}, this.options), pluginOptions); | ||
for (let options of modelOptions) { | ||
this.modelOptions.set(String(options.modelId), options); | ||
if (options.linkedIds) { | ||
@@ -115,2 +117,3 @@ this.map.setHiddenObjects(options.linkedIds); | ||
for (let options of modelOptions) { | ||
this.modelOptions.set(String(options.modelId), options); | ||
if (options.linkedIds) { | ||
@@ -138,2 +141,3 @@ this.map.setHiddenObjects(options.linkedIds); | ||
return this.loader.loadModel(modelOptions).then(() => { | ||
this.modelOptions.set(String(modelOptions.modelId), modelOptions); | ||
if (modelOptions.linkedIds) { | ||
@@ -161,2 +165,6 @@ this.map.setHiddenObjects(modelOptions.linkedIds); | ||
if (!preserveCache) { | ||
const options = this.modelOptions.get(String(id)); | ||
if (options !== undefined && options.linkedIds !== undefined) { | ||
this.map.unsetHiddenObjects(options.linkedIds); | ||
} | ||
this.models.delete(String(id)); | ||
@@ -213,2 +221,5 @@ this.disposeObject(model); | ||
}); | ||
window.addEventListener('resize', () => { | ||
this.invalidateViewport(); | ||
}); | ||
this.eventSource = new EventSource(this.map, this.viewport, this.camera, this.scene); | ||
@@ -215,0 +226,0 @@ for (let eventName of this.eventSource.getEvents()) { |
@@ -53,2 +53,19 @@ import type { Id, PoiGroupOptions, ModelOptions } from './plugin'; | ||
/** | ||
* Options of popup that appears on hover of buildings | ||
*/ | ||
export interface PopupOptions { | ||
/** | ||
* Popup's coordinates | ||
*/ | ||
coordinates: number[]; | ||
/** | ||
* Popup's title | ||
*/ | ||
title: string; | ||
/** | ||
* Popup's description | ||
*/ | ||
description?: string; | ||
} | ||
/** | ||
* Options for a building on the realty scene | ||
@@ -65,2 +82,6 @@ */ | ||
floors?: BuildingFloorOptions[]; | ||
/** | ||
* Popup options | ||
*/ | ||
popupOptions?: PopupOptions; | ||
} |
@@ -21,2 +21,3 @@ import type { Map as MapGL } from '@2gis/mapgl/types'; | ||
private realtyScene?; | ||
private modelOptions; | ||
/** | ||
@@ -23,0 +24,0 @@ * The main class of the plugin |
@@ -53,2 +53,19 @@ import type { Id, PoiGroupOptions, ModelOptions } from './plugin'; | ||
/** | ||
* Options of popup that appears on hover of buildings | ||
*/ | ||
export interface PopupOptions { | ||
/** | ||
* Popup's coordinates | ||
*/ | ||
coordinates: number[]; | ||
/** | ||
* Popup's title | ||
*/ | ||
title: string; | ||
/** | ||
* Popup's description | ||
*/ | ||
description?: string; | ||
} | ||
/** | ||
* Options for a building on the realty scene | ||
@@ -65,2 +82,6 @@ */ | ||
floors?: BuildingFloorOptions[]; | ||
/** | ||
* Popup options | ||
*/ | ||
popupOptions?: PopupOptions; | ||
} |
{ | ||
"name": "@2gis/mapgl-gltf", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Plugin for the rendering glTF models with MapGL", | ||
@@ -39,3 +39,3 @@ "main": "dist/bundle.js", | ||
"devDependencies": { | ||
"@2gis/mapgl": "1.36.0", | ||
"@2gis/mapgl": "1.37.2", | ||
"@documentalist/compiler": "^2.8.1", | ||
@@ -42,0 +42,0 @@ "@types/jest": "^27.4.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4136304
3209
19