Commit cb6a21fed66551e5f2fc61638f3fbe2d82091d77

Authored by Vladyslav_Prykhodko
1 parent ed841e0c

Fix: draggable marker setting on the input maps did not work

... ... @@ -16,7 +16,8 @@
16 16
17 17 import {
18 18 DEFAULT_MAP_PAGE_SIZE,
19   - defaultSettings, FormattedData,
  19 + defaultSettings,
  20 + FormattedData,
20 21 hereProviders,
21 22 MapProviders,
22 23 providerSets,
... ... @@ -34,7 +35,7 @@ import {
34 35 import { MapWidgetInterface, MapWidgetStaticInterface } from './map-widget.interface';
35 36 import { addCondition, addGroupInfo, addToSchema, initSchema, mergeSchemes } from '@core/schema-utils';
36 37 import { WidgetContext } from '@app/modules/home/models/widget-component.models';
37   -import { getDefCenterPosition, parseArray, parseData, parseFunction, parseWithTranslation } from './maps-utils';
  38 +import { getDefCenterPosition, parseData, parseFunction, parseWithTranslation } from './maps-utils';
38 39 import { Datasource, DatasourceData, JsonSettingsSchema, WidgetActionDescriptor } from '@shared/models/widget.models';
39 40 import { EntityId } from '@shared/models/id/entity-id';
40 41 import { AttributeScope, DataKeyType, LatestTelemetry } from '@shared/models/telemetry/telemetry.models';
... ... @@ -65,10 +66,7 @@ export class MapWidgetController implements MapWidgetInterface {
65 66 if (!$element) {
66 67 $element = ctx.$container[0];
67 68 }
68   - this.settings = this.initSettings(ctx.settings);
69   - if (isEdit) {
70   - this.settings.draggableMarker = true;
71   - }
  69 + this.settings = this.initSettings(ctx.settings, isEdit);
72 70 this.settings.tooltipAction = this.getDescriptors('tooltipAction');
73 71 this.settings.markerClick = this.getDescriptors('markerClick');
74 72 this.settings.polygonClick = this.getDescriptors('polygonClick');
... ... @@ -241,7 +239,7 @@ export class MapWidgetController implements MapWidgetInterface {
241 239 }
242 240 }
243 241
244   - initSettings(settings: UnitedMapSettings): UnitedMapSettings {
  242 + initSettings(settings: UnitedMapSettings, isEditMap?: boolean): UnitedMapSettings {
245 243 const functionParams = ['data', 'dsData', 'dsIndex'];
246 244 this.provider = settings.provider || this.mapProvider;
247 245 if (this.provider === MapProviders.here && !settings.mapProviderHere) {
... ... @@ -269,6 +267,9 @@ export class MapWidgetController implements MapWidgetInterface {
269 267 size: settings.markerImageSize || 34
270 268 } : null
271 269 }
  270 + if (isEditMap && !settings.hasOwnProperty('draggableMarker')) {
  271 + settings.draggableMarker = true;
  272 + }
272 273 return { ...defaultSettings, ...settings, ...customOptions, }
273 274 }
274 275
... ...