diff --git a/Logic/Osm/OsmConnection.ts b/Logic/Osm/OsmConnection.ts index fe2aa2e83..85bd602df 100644 --- a/Logic/Osm/OsmConnection.ts +++ b/Logic/Osm/OsmConnection.ts @@ -122,7 +122,10 @@ export class OsmConnection { this.updateAuthObject() - this.preferencesHandler = new OsmPreferences(this.auth, this) + this.preferencesHandler = new OsmPreferences( + this.auth, + this + ) if (options.oauth_token?.data !== undefined) { console.log(options.oauth_token.data) @@ -146,7 +149,13 @@ export class OsmConnection { } public CreateChangesetHandler(allElements: ElementStorage, changes: Changes) { - return new ChangesetHandler(this._dryRun, this, allElements, changes, this.auth) + return new ChangesetHandler( + this._dryRun, + /*casting is needed to make the tests work*/ this, + allElements, + changes, + this.auth + ) } public GetPreference( diff --git a/UI/Base/ScrollableFullScreen.ts b/UI/Base/ScrollableFullScreen.ts index 3c20d89ef..9dd6a83c8 100644 --- a/UI/Base/ScrollableFullScreen.ts +++ b/UI/Base/ScrollableFullScreen.ts @@ -24,6 +24,7 @@ export default class ScrollableFullScreen { private hashToShow: string private _fullscreencomponent: BaseUIElement private _resetScrollSignal: UIEventSource = new UIEventSource(undefined) + private _setHash: boolean constructor( title: (options: { mode: string }) => BaseUIElement, @@ -32,12 +33,16 @@ export default class ScrollableFullScreen { resetScrollSignal: UIEventSource }) => BaseUIElement, hashToShow: string, - isShown: UIEventSource = new UIEventSource(false) + isShown: UIEventSource = new UIEventSource(false), + options?: { + setHash?: boolean + } ) { this.hashToShow = hashToShow this.isShown = isShown + this._setHash = options?.setHash ?? true - if (hashToShow === undefined || hashToShow === "") { + if ((hashToShow === undefined || hashToShow === "") && this._setHash) { throw "HashToShow should be defined as it is vital for the 'back' key functionality" } @@ -52,17 +57,18 @@ export default class ScrollableFullScreen { ) const self = this - Hash.hash.addCallback((h) => { - if (h === undefined) { - isShown.setData(false) - } - }) + if (this._setHash) { + Hash.hash.addCallback((h) => { + if (h === undefined) { + isShown.setData(false) + } + }) + } isShown.addCallbackD((isShown) => { if (isShown) { // We first must set the hash, then activate the panel // If the order is wrong, this will cause the panel to disactivate again - Hash.hash.setData(hashToShow) ScrollableFullScreen._currentlyOpen = self self.Activate() } else { @@ -74,7 +80,6 @@ export default class ScrollableFullScreen { } }) if (isShown.data) { - Hash.hash.setData(hashToShow) ScrollableFullScreen._currentlyOpen = self this.Activate() } @@ -111,10 +116,10 @@ export default class ScrollableFullScreen { * @constructor */ public Activate(): void { - this.isShown.setData(true) - if (this.hashToShow && this.hashToShow !== "") { + if (this.hashToShow && this.hashToShow !== "" && this._setHash) { Hash.hash.setData(this.hashToShow) } + this.isShown.setData(true) this._fullscreencomponent.AttachTo("fullscreen") const fs = document.getElementById("fullscreen") ScrollableFullScreen._currentlyOpen = this