Browse Source

Fix update tooltip polygon

pull/2765/head
Vladyslav_Prykhodko 6 years ago
parent
commit
2f622a2e72
  1. 16
      ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts
  2. 4
      ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts

16
ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts

@ -20,12 +20,12 @@ import 'leaflet-providers';
import 'leaflet.markercluster/dist/leaflet.markercluster'; import 'leaflet.markercluster/dist/leaflet.markercluster';
import { import {
FormattedData, FormattedData,
MapSettings, MapSettings,
MarkerSettings, MarkerSettings,
PolygonSettings, PolygonSettings,
PolylineSettings, PolylineSettings,
UnitedMapSettings UnitedMapSettings
} from './map-models'; } from './map-models';
import { Marker } from './markers'; import { Marker } from './markers';
import { BehaviorSubject, Observable } from 'rxjs'; import { BehaviorSubject, Observable } from 'rxjs';
@ -405,8 +405,8 @@ export default abstract class LeafletMap {
updatePolygon(polyData: FormattedData, dataSources: FormattedData[], settings: PolygonSettings) { updatePolygon(polyData: FormattedData, dataSources: FormattedData[], settings: PolygonSettings) {
this.ready$.subscribe(() => { this.ready$.subscribe(() => {
const poly = this.polygons.get(polyData.datasource.entityName); const poly = this.polygons.get(polyData.$datasource.entityName);
poly.updatePolygon(polyData.data, dataSources, settings); poly.updatePolygon(polyData, dataSources, settings);
}); });
} }
} }

4
ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import L, { LatLngExpression, LatLngTuple, LeafletMouseEvent } from 'leaflet'; import L, { LatLngExpression, LeafletMouseEvent } from 'leaflet';
import { createTooltip, parseWithTranslation, safeExecute } from './maps-utils'; import { createTooltip, parseWithTranslation, safeExecute } from './maps-utils';
import { FormattedData, PolygonSettings } from './map-models'; import { FormattedData, PolygonSettings } from './map-models';
@ -61,7 +61,7 @@ export class Polygon {
this.tooltip.setContent(parseWithTranslation.parseTemplate(pattern, data, true)); this.tooltip.setContent(parseWithTranslation.parseTemplate(pattern, data, true));
} }
updatePolygon(data: LatLngTuple[], dataSources: FormattedData[], settings: PolygonSettings) { updatePolygon(data: FormattedData, dataSources: FormattedData[], settings: PolygonSettings) {
this.data = data; this.data = data;
this.dataSources = dataSources; this.dataSources = dataSources;
this.leafletPoly.setLatLngs(data[this.settings.polygonKeyName]); this.leafletPoly.setLatLngs(data[this.settings.polygonKeyName]);

Loading…
Cancel
Save