Make map definitions non-reactive to improve projection performance

This commit is contained in:
James Lyne 2021-07-27 04:31:43 +01:00
parent 42f8cbd74b
commit c69aeb8f5f
2 changed files with 4 additions and 4 deletions

View File

@ -73,11 +73,11 @@ export default class LiveAtlasMapDefinition {
this.scale = (1 / Math.pow(2, this.nativeZoomLevels)); this.scale = (1 / Math.pow(2, this.nativeZoomLevels));
if(options.mapToWorld || options.worldToMap) { if(options.mapToWorld || options.worldToMap) {
this.projection = Object.freeze(new LiveAtlasProjection({ this.projection = new LiveAtlasProjection({
mapToWorld: options.mapToWorld || [0, 0, 0, 0, 0, 0, 0, 0, 0], mapToWorld: options.mapToWorld || [0, 0, 0, 0, 0, 0, 0, 0, 0],
worldToMap: options.worldToMap || [0, 0, 0, 0, 0, 0, 0, 0, 0], worldToMap: options.worldToMap || [0, 0, 0, 0, 0, 0, 0, 0, 0],
nativeZoomLevels: this.nativeZoomLevels, nativeZoomLevels: this.nativeZoomLevels,
})); });
} }
} }

View File

@ -119,7 +119,7 @@ export default class DynmapMapProvider extends MapProvider {
return; return;
} }
w.maps.set(map.name, new LiveAtlasMapDefinition({ w.maps.set(map.name, Object.freeze(new LiveAtlasMapDefinition({
world: w, //Ignore append_to_world here otherwise things break world: w, //Ignore append_to_world here otherwise things break
background: map.background || '#000000', background: map.background || '#000000',
backgroundDay: map.backgroundday || '#000000', backgroundDay: map.backgroundday || '#000000',
@ -135,7 +135,7 @@ export default class DynmapMapProvider extends MapProvider {
worldToMap: map.worldtomap || undefined, worldToMap: map.worldtomap || undefined,
nativeZoomLevels: map.mapzoomout || 1, nativeZoomLevels: map.mapzoomout || 1,
extraZoomLevels: map.mapzoomin || 0 extraZoomLevels: map.mapzoomin || 0
})); })));
}); });
}); });