forked from MapComplete/MapComplete
Add share button (supported browsers only), refactoring of fullscreenmessage, fancier scrolling
This commit is contained in:
parent
2d25393962
commit
4700e71d2e
13 changed files with 117 additions and 118 deletions
|
@ -16,26 +16,15 @@ export class FullScreenMessageBox extends UIElement {
|
|||
this.HideOnEmpty(true);
|
||||
|
||||
this.returnToTheMap =
|
||||
new Combine([Translations.t.general.returnToTheMap.Clone().SetStyle("font-size:xx-large")])
|
||||
.SetStyle("background:var(--catch-detail-color);" +
|
||||
"position: fixed;" +
|
||||
"z-index: 10000;" +
|
||||
"bottom: 0;" +
|
||||
"left: 0;" +
|
||||
`height: var(--return-to-the-map-height);` +
|
||||
"width: 100vw;" +
|
||||
"color: var(--catch-detail-color-contrast);" +
|
||||
"font-weight: bold;" +
|
||||
"pointer-events: all;" +
|
||||
"cursor: pointer;" +
|
||||
"padding-top: 1.2em;" +
|
||||
"text-align: center;" +
|
||||
"padding-bottom: 1.2em;" +
|
||||
"box-sizing:border-box")
|
||||
.onClick(() => {
|
||||
State.state.fullScreenMessage.setData(undefined);
|
||||
onClear();
|
||||
});
|
||||
new Combine([
|
||||
// Wrapped another time to prevent the value of 'em' to fluctuate
|
||||
Translations.t.general.returnToTheMap.Clone()
|
||||
])
|
||||
.onClick(() => {
|
||||
State.state.fullScreenMessage.setData(undefined);
|
||||
onClear();
|
||||
})
|
||||
.SetClass("to-the-map")
|
||||
|
||||
}
|
||||
|
||||
|
@ -45,25 +34,18 @@ export class FullScreenMessageBox extends UIElement {
|
|||
return "";
|
||||
}
|
||||
this._content = State.state.fullScreenMessage.data;
|
||||
const innerWrap = new Combine([this._content]).SetStyle(
|
||||
"display: block;" +
|
||||
"padding: 1em;" +
|
||||
"padding-bottom: 6em; "
|
||||
);
|
||||
const uielement = new Combine([innerWrap]).SetStyle(
|
||||
"display:block;" +
|
||||
`margin-bottom: var(--return-to-the-map-height);` +
|
||||
"box-sizing:border-box;" +
|
||||
`height:calc(100vh - var(--return-to-the-map-height));` +
|
||||
"overflow-y: auto;" +
|
||||
"max-width:100vw;" +
|
||||
"overflow-x:hidden;" +
|
||||
"background:var(--background-color);" +
|
||||
"color: var(--foreground-color);"
|
||||
);
|
||||
return new Combine([uielement, this.returnToTheMap])
|
||||
const innerWrap = new Combine([this._content]).SetClass("fullscreenmessage-content")
|
||||
|
||||
return new Combine([innerWrap, this.returnToTheMap])
|
||||
.SetStyle("display:block; height: 100%;")
|
||||
.Render();
|
||||
}
|
||||
|
||||
protected InnerUpdate(htmlElement: HTMLElement) {
|
||||
super.InnerUpdate(htmlElement);
|
||||
const height = htmlElement.getElementsByClassName("featureinfobox-titlebar")[0]?.clientHeight ?? 0;
|
||||
htmlElement.style.setProperty("--variable-title-height", height+"px")
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -53,4 +53,5 @@ export class FeatureInfoBox extends UIElement {
|
|||
.Render();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -193,8 +193,7 @@ export default class SpecialVisualizations {
|
|||
args: [
|
||||
{
|
||||
name: "url",
|
||||
doc: "The url to share",
|
||||
defaultValue: "{current_url()}"
|
||||
doc: "The url to share (defualt: current URL)",
|
||||
}
|
||||
],
|
||||
constr: (tagSource: UIEventSource<any>, args) => {
|
||||
|
@ -202,7 +201,7 @@ export default class SpecialVisualizations {
|
|||
const title = State.state.layoutToUse.data.title.txt;
|
||||
let name = tagSource.data.name;
|
||||
if(name){
|
||||
name += `${name} (${title})`
|
||||
name = `${name} (${title})`
|
||||
}else{
|
||||
name = title;
|
||||
}
|
||||
|
@ -212,7 +211,7 @@ export default class SpecialVisualizations {
|
|||
text: State.state.layoutToUse.data.shortDescription.txt
|
||||
})
|
||||
} else {
|
||||
return new Combine(["<button type='button' class='share-button' style='background:red;'>", Svg.share_svg() ,"</button>"])
|
||||
return new FixedUiElement("")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue