Fixes to Sharescreen: correct display of background layer

This commit is contained in:
Pieter Vander Vennet 2020-09-27 00:32:31 +02:00
parent 478b82b1e1
commit f86e1f87eb

View file

@ -64,7 +64,9 @@ export class ShareScreen extends UIElement {
if (State.state !== undefined) { if (State.state !== undefined) {
const currentLayer: UIEventSource<{ id: string, name: string, layer: any }> = (State.state.bm as Basemap).CurrentLayer; const currentLayer: UIEventSource<{ id: string, name: string, layer: any }> = (State.state.bm as Basemap).CurrentLayer;
const currentBackground = tr.fsIncludeCurrentBackgroundMap.Subs({name: layout.id}); const currentBackground = new VariableUiElement(currentLayer.map(layer => {
return tr.fsIncludeCurrentBackgroundMap.Subs({name: layer?.id ?? ""}).Render();
}));
const includeCurrentBackground = new CheckBox( const includeCurrentBackground = new CheckBox(
new Combine([Img.checkmark, currentBackground]), new Combine([Img.checkmark, currentBackground]),
new Combine([Img.no_checkmark, currentBackground]), new Combine([Img.no_checkmark, currentBackground]),
@ -143,9 +145,13 @@ export class ShareScreen extends UIElement {
let hash = ""; let hash = "";
if (layoutDefinition !== undefined) { if (layoutDefinition !== undefined) {
hash = ("#" + layoutDefinition)
literalText = "https://pietervdvn.github.io/MapComplete/index.html" literalText = "https://pietervdvn.github.io/MapComplete/index.html"
parts.push("userlayout=true"); if (layout.id.startsWith("wiki:")) {
parts.push("userlayout=" + encodeURIComponent(layout.id))
} else {
hash = ("#" + layoutDefinition)
parts.push("userlayout=true");
}
} }