Merge master

This commit is contained in:
pietervdvn 2021-03-29 17:37:58 +02:00
commit 8c0cae7a8c
3 changed files with 17 additions and 6 deletions

View file

@ -213,6 +213,7 @@ export class InitUiElements {
userLayoutParam.setData(layoutToUse.id); userLayoutParam.setData(layoutToUse.id);
return layoutToUse; return layoutToUse;
} catch (e) { } catch (e) {
new FixedUiElement("Error: could not parse the custom layout:<br/> " + e).AttachTo("centermessage"); new FixedUiElement("Error: could not parse the custom layout:<br/> " + e).AttachTo("centermessage");
throw e; throw e;
} }
@ -350,8 +351,8 @@ export class InitUiElements {
const lonDiff = bounds[0][1] - bounds[1][1] const lonDiff = bounds[0][1] - bounds[1][1]
console.warn("Locking the bounds to ", bounds) console.warn("Locking the bounds to ", bounds)
bm.map.setMaxBounds( bm.map.setMaxBounds(
[[ layout.startLat - latDiff, layout.startLon - lonDiff ], [[layout.startLat - latDiff, layout.startLon - lonDiff],
[ layout.startLat + latDiff, layout.startLon + lonDiff ], [layout.startLat + latDiff, layout.startLon + lonDiff],
] ]
); );
bm.map.setMinZoom(layout.startZoom) bm.map.setMinZoom(layout.startZoom)

View file

@ -1,5 +1,8 @@
import {UIEventSource} from "../UIEventSource"; import {UIEventSource} from "../UIEventSource";
/**
* UIEventsource-wrapper around localStorage
*/
export class LocalStorageSource { export class LocalStorageSource {
static Get(key: string, defaultValue: string = undefined): UIEventSource<string> { static Get(key: string, defaultValue: string = undefined): UIEventSource<string> {
@ -8,7 +11,14 @@ export class LocalStorageSource {
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:"+key); const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:"+key);
source.addCallback((data) => { source.addCallback((data) => {
try{
localStorage.setItem(key, data); localStorage.setItem(key, data);
}catch(e){
// Probably exceeded the quota with this item!
// Lets nuke everything
localStorage.clear()
}
}); });
return source; return source;
} catch (e) { } catch (e) {

View file

@ -47,7 +47,7 @@
id="layer1" id="layer1"
inkscape:label="bg" inkscape:label="bg"
style="display:inline"><circle style="display:inline"><circle
style="fill:#f2ffff;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path815" id="path815"
cx="200" cx="200"
cy="199.4688" cy="199.4688"

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB