Commit cb6a21fed66551e5f2fc61638f3fbe2d82091d77
1 parent
ed841e0c
Fix: draggable marker setting on the input maps did not work
Showing
1 changed file
with
8 additions
and
7 deletions
@@ -16,7 +16,8 @@ | @@ -16,7 +16,8 @@ | ||
16 | 16 | ||
17 | import { | 17 | import { |
18 | DEFAULT_MAP_PAGE_SIZE, | 18 | DEFAULT_MAP_PAGE_SIZE, |
19 | - defaultSettings, FormattedData, | 19 | + defaultSettings, |
20 | + FormattedData, | ||
20 | hereProviders, | 21 | hereProviders, |
21 | MapProviders, | 22 | MapProviders, |
22 | providerSets, | 23 | providerSets, |
@@ -34,7 +35,7 @@ import { | @@ -34,7 +35,7 @@ import { | ||
34 | import { MapWidgetInterface, MapWidgetStaticInterface } from './map-widget.interface'; | 35 | import { MapWidgetInterface, MapWidgetStaticInterface } from './map-widget.interface'; |
35 | import { addCondition, addGroupInfo, addToSchema, initSchema, mergeSchemes } from '@core/schema-utils'; | 36 | import { addCondition, addGroupInfo, addToSchema, initSchema, mergeSchemes } from '@core/schema-utils'; |
36 | import { WidgetContext } from '@app/modules/home/models/widget-component.models'; | 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 | import { Datasource, DatasourceData, JsonSettingsSchema, WidgetActionDescriptor } from '@shared/models/widget.models'; | 39 | import { Datasource, DatasourceData, JsonSettingsSchema, WidgetActionDescriptor } from '@shared/models/widget.models'; |
39 | import { EntityId } from '@shared/models/id/entity-id'; | 40 | import { EntityId } from '@shared/models/id/entity-id'; |
40 | import { AttributeScope, DataKeyType, LatestTelemetry } from '@shared/models/telemetry/telemetry.models'; | 41 | import { AttributeScope, DataKeyType, LatestTelemetry } from '@shared/models/telemetry/telemetry.models'; |
@@ -65,10 +66,7 @@ export class MapWidgetController implements MapWidgetInterface { | @@ -65,10 +66,7 @@ export class MapWidgetController implements MapWidgetInterface { | ||
65 | if (!$element) { | 66 | if (!$element) { |
66 | $element = ctx.$container[0]; | 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 | this.settings.tooltipAction = this.getDescriptors('tooltipAction'); | 70 | this.settings.tooltipAction = this.getDescriptors('tooltipAction'); |
73 | this.settings.markerClick = this.getDescriptors('markerClick'); | 71 | this.settings.markerClick = this.getDescriptors('markerClick'); |
74 | this.settings.polygonClick = this.getDescriptors('polygonClick'); | 72 | this.settings.polygonClick = this.getDescriptors('polygonClick'); |
@@ -241,7 +239,7 @@ export class MapWidgetController implements MapWidgetInterface { | @@ -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 | const functionParams = ['data', 'dsData', 'dsIndex']; | 243 | const functionParams = ['data', 'dsData', 'dsIndex']; |
246 | this.provider = settings.provider || this.mapProvider; | 244 | this.provider = settings.provider || this.mapProvider; |
247 | if (this.provider === MapProviders.here && !settings.mapProviderHere) { | 245 | if (this.provider === MapProviders.here && !settings.mapProviderHere) { |
@@ -269,6 +267,9 @@ export class MapWidgetController implements MapWidgetInterface { | @@ -269,6 +267,9 @@ export class MapWidgetController implements MapWidgetInterface { | ||
269 | size: settings.markerImageSize || 34 | 267 | size: settings.markerImageSize || 34 |
270 | } : null | 268 | } : null |
271 | } | 269 | } |
270 | + if (isEditMap && !settings.hasOwnProperty('draggableMarker')) { | ||
271 | + settings.draggableMarker = true; | ||
272 | + } | ||
272 | return { ...defaultSettings, ...settings, ...customOptions, } | 273 | return { ...defaultSettings, ...settings, ...customOptions, } |
273 | } | 274 | } |
274 | 275 |