forked from MapComplete/MapComplete
Add extraLink button which replaced the iframePopout button, fix #654
This commit is contained in:
parent
e04e7ddf6a
commit
c941f567cf
16 changed files with 457 additions and 113 deletions
|
@ -8,9 +8,7 @@ import Svg from "../Svg";
|
|||
import Toggle from "./Input/Toggle";
|
||||
import UserBadge from "./BigComponents/UserBadge";
|
||||
import SearchAndGo from "./BigComponents/SearchAndGo";
|
||||
import Link from "./Base/Link";
|
||||
import BaseUIElement from "./BaseUIElement";
|
||||
import {VariableUiElement} from "./Base/VariableUIElement";
|
||||
import LeftControls from "./BigComponents/LeftControls";
|
||||
import RightControls from "./BigComponents/RightControls";
|
||||
import CenterMessageBox from "./CenterMessageBox";
|
||||
|
@ -19,7 +17,6 @@ import ScrollableFullScreen from "./Base/ScrollableFullScreen";
|
|||
import Translations from "./i18n/Translations";
|
||||
import SimpleAddUI from "./BigComponents/SimpleAddUI";
|
||||
import StrayClickHandler from "../Logic/Actors/StrayClickHandler";
|
||||
import Lazy from "./Base/Lazy";
|
||||
import {DefaultGuiState} from "./DefaultGuiState";
|
||||
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
|
||||
import * as home_location_json from "../assets/layers/home_location/home_location.json";
|
||||
|
@ -27,6 +24,7 @@ import NewNoteUi from "./Popup/NewNoteUi";
|
|||
import Combine from "./Base/Combine";
|
||||
import AddNewMarker from "./BigComponents/AddNewMarker";
|
||||
import FilteredLayer from "../Models/FilteredLayer";
|
||||
import ExtraLinkButton from "./BigComponents/ExtraLinkButton";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -169,23 +167,17 @@ export default class DefaultGUI {
|
|||
() => new SearchAndGo(state))
|
||||
.AttachTo("searchbox");
|
||||
|
||||
|
||||
let iframePopout: () => BaseUIElement = undefined;
|
||||
|
||||
if (window !== window.top) {
|
||||
// MapComplete is running in an iframe
|
||||
iframePopout = () => new VariableUiElement(state.locationControl.map(loc => {
|
||||
const url = `${window.location.origin}${window.location.pathname}?z=${loc.zoom ?? 0}&lat=${loc.lat ?? 0}&lon=${loc.lon ?? 0}`;
|
||||
const link = new Link(Svg.pop_out_img, url, true).SetClass("block w-full h-full p-1.5")
|
||||
return new MapControlButton(link)
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
new Toggle(new Lazy(() => self.InitWelcomeMessage()),
|
||||
Toggle.If(state.featureSwitchIframePopoutEnabled, iframePopout),
|
||||
state.featureSwitchWelcomeMessage
|
||||
).AttachTo("messagesbox");
|
||||
new Combine([
|
||||
Toggle.If(state.featureSwitchExtraLinkEnabled,
|
||||
() => new ExtraLinkButton(state, state.layoutToUse.extraLink).SetClass("pointer-events-auto")
|
||||
)
|
||||
,
|
||||
Toggle.If(
|
||||
state.featureSwitchWelcomeMessage,
|
||||
() => self.InitWelcomeMessage()
|
||||
)])
|
||||
.SetClass("flex flex-col")
|
||||
.AttachTo("messagesbox");
|
||||
|
||||
|
||||
new LeftControls(state, guiState).AttachTo("bottom-left");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue