aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/MapBox/MapBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/MapBox/MapBox.tsx')
-rw-r--r--src/client/views/nodes/MapBox/MapBox.tsx34
1 files changed, 21 insertions, 13 deletions
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<ViewBoxAnnotatableProps
* @returns
*/
sidebarRemoveDocument = (doc: Doc | Doc[], sidebarKey?: string) => {
- 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<ViewBoxAnnotatableProps
@observable
selectedPin:Doc | undefined;
- /*
- * Pushpin onclick
- */
@action
- pushpinClicked = (pinDoc: Doc) => {
+ 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<ViewBoxAnnotatableProps
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;
+
+ // 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<ViewBoxAnnotatableProps
document.addEventListener('pointerdown', this.tryHideMapAnchorMenu, true)
this.MicrosoftMaps.Events.addHandler(this._bingMap.current, 'click', this.mapOnClick);
+
+ // Filter sidebar:
+ // if sidebar is open, filter.
+ if (this.layoutDoc._layout_showSidebar){
+
+ }
+
};
/**
@@ -567,14 +582,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
@action
mapOnClick = (e: { location: { latitude: any; longitude: any } }) => {
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);
}
};