aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric <ericmabr@gmail.com>2023-08-21 16:50:02 -0400
committerEric <ericmabr@gmail.com>2023-08-21 16:50:02 -0400
commitbdb78d5f0bd0e9e2ee9f46119b9b42735e9dc8a7 (patch)
treef7d0ddf7ef1772626dd00cc193dea8d89c700d53
parent67da701d844b2b2f086b635d6383debeab78c2bf (diff)
Pre-anchor menu work
-rw-r--r--src/client/views/nodes/MapBox/MapBox.tsx17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/client/views/nodes/MapBox/MapBox.tsx b/src/client/views/nodes/MapBox/MapBox.tsx
index 329de5792..be2defa9b 100644
--- a/src/client/views/nodes/MapBox/MapBox.tsx
+++ b/src/client/views/nodes/MapBox/MapBox.tsx
@@ -351,7 +351,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
this.layoutDoc._width = this.layoutDoc._layout_showSidebar ? NumCast(this.layoutDoc._width) * 1.2 : Math.max(20, NumCast(this.layoutDoc._width) - prevWidth);
};
- OnClick = () => {
+ createNoteAnnotation = () => {
!this.layoutDoc.layout_showSidebar && this.toggleSidebar();
setTimeout(() => this._sidebarRef.current?.anchorMenuClick(this.getAnchor(false))); // give time for sidebarRef to be created
};
@@ -510,6 +510,10 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
if (pinDoc) this.removePushpin(pinDoc, pin);
else this._bingMap.current.entities.remove(pin);
};
+
+ // The pin that is selected
+ selectedPin:Doc | undefined;
+
/*
* Pushpin onclick
*/
@@ -520,12 +524,13 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
// creates button onclick removes the doc from annotations
// pan to pushpin location
- this.dataDoc.latitude = pinDoc.latitude;
- this.dataDoc.longitude = pinDoc.longitude;
+ // this.dataDoc.latitude = pinDoc.latitude;
+ // this.dataDoc.longitude = pinDoc.longitude;
+ this.selectedPin = pinDoc
/// this should SELECT, not center
- this.OnClick();
+ this.createNoteAnnotation();
};
/**
@@ -619,8 +624,8 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
/// this should use SELECTED pushpin for lat/long if there is a selection, otherwise CENTER
const anchor = Docs.Create.MapanchorDocument({
title: 'MapAnchor:' + this.rootDoc.title,
- config_latitude: NumCast(this.dataDoc.latitude),
- config_longitude: NumCast(this.dataDoc.longitude),
+ config_latitude: NumCast(this.selectedPin ? this.selectedPin.latitude : this.dataDoc.latitude),
+ config_longitude: NumCast(this.selectedPin ? this.selectedPin.longitude : this.dataDoc.longitude),
config_mapZoom: NumCast(this.dataDoc.mapZoom),
config_mapType: StrCast(this.dataDoc.mapType),
// preslocationToLookAt:this.dataDoc.locationToLookAt,