From 1bb554c64e235c89db47b7ca5bb86a5edfb13ec8 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 23 Aug 2023 13:44:31 -0400 Subject: Stuck --- src/client/views/nodes/MapBox/MapBox.tsx | 34 ++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/MapBox/MapBox.tsx b/src/client/views/nodes/MapBox/MapBox.tsx index 14ecc910e..7269a38f0 100644 --- a/src/client/views/nodes/MapBox/MapBox.tsx +++ b/src/client/views/nodes/MapBox/MapBox.tsx @@ -278,7 +278,7 @@ export class MapBox extends ViewBoxAnnotatableComponent { - if (this.layoutDoc._layout_showSidebar) this.toggleSidebar(); + // if (this.layoutDoc._layout_showSidebar) this.toggleSidebar(); const docs = doc instanceof Doc ? [doc] : doc; return this.removeDocument(doc, sidebarKey); }; @@ -516,11 +516,8 @@ export class MapBox extends ViewBoxAnnotatableComponent { + deselectPin=()=>{ if (this.selectedPin) { const temp = this.selectedPin; this._bingMap.current.entities.remove(this.map_docToPinMap.get(temp)); @@ -528,9 +525,20 @@ export class MapBox extends ViewBoxAnnotatableComponent this.pushpinClicked(temp as Doc)); this._bingMap.current.entities.push(newpin); this.map_docToPinMap.set(temp, newpin); + this.selectedPin=undefined; + + // setTimeout(() => this._sidebarRef.current?.makeDocUnfiltered(this._sidebarRef.current.)); } + } + /* + * Pushpin onclick + */ + @action + pushpinClicked = (pinDoc: Doc) => { + this.deselectPin(); this.selectedPin = pinDoc; + this._bingMap.current.entities.remove(this.map_docToPinMap.get(this.selectedPin)); const newpin = new this.MicrosoftMaps.Pushpin(new this.MicrosoftMaps.Location(this.selectedPin.latitude,this.selectedPin.longitude), { @@ -552,6 +560,13 @@ export class MapBox extends ViewBoxAnnotatableComponent { if (this.selectedPin) { - const temp = this.selectedPin; - this._bingMap.current.entities.remove(this.map_docToPinMap.get(temp)); - const newpin = new this.MicrosoftMaps.Pushpin(new this.MicrosoftMaps.Location(temp.latitude,temp.longitude)); - this.MicrosoftMaps.Events.addHandler(newpin, 'click', (e: any) => this.pushpinClicked(temp as Doc)); - this._bingMap.current.entities.push(newpin); - this.map_docToPinMap.set(temp, newpin); - - this.selectedPin=undefined; + this.deselectPin(); this.MicrosoftMaps.Events.removeEventListener(this._bingMap.current, 'click', this.mapOnClick); } }; -- cgit v1.2.3-70-g09d2