Freeze/seal marker related objects in Pl3xmap provider

This commit is contained in:
James Lyne 2021-09-10 15:31:05 +01:00
parent 8bf0fe04a7
commit 83bc0ec86d

View File

@ -205,10 +205,10 @@ export default class Pl3xmapMapProvider extends MapProvider {
const id = set.id; const id = set.id;
const markers: Map<string, LiveAtlasMarker> = new Map(), const markers: Map<string, LiveAtlasMarker> = Object.freeze(new Map()),
circles: Map<string, LiveAtlasCircle> = new Map(), circles: Map<string, LiveAtlasCircle> = Object.freeze(new Map()),
areas: Map<string, LiveAtlasArea> = new Map(), areas: Map<string, LiveAtlasArea> = Object.freeze(new Map()),
lines: Map<string, LiveAtlasLine> = new Map(); lines: Map<string, LiveAtlasLine> = Object.freeze(new Map());
(set.markers || []).forEach((marker: any) => { (set.markers || []).forEach((marker: any) => {
switch(marker.type) { switch(marker.type) {
@ -258,7 +258,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
} }
private static buildMarker(marker: any): LiveAtlasMarker { private static buildMarker(marker: any): LiveAtlasMarker {
return { return Object.seal({
location: { location: {
x: marker.point?.x || 0, x: marker.point?.x || 0,
y: 0, y: 0,
@ -269,7 +269,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
label: (marker.tooltip || '').trim(), label: (marker.tooltip || '').trim(),
isLabelHTML: true isLabelHTML: true
}; });
} }
private static buildRectangle(area: any): LiveAtlasArea { private static buildRectangle(area: any): LiveAtlasArea {