From b2d824b412e6bbf9b4867ed13f49a433af7c26c7 Mon Sep 17 00:00:00 2001 From: zaultavangar Date: Sun, 17 Dec 2023 22:33:08 -0500 Subject: fixing some bugs with MapBox and MapAnchorMenu --- src/client/views/nodes/MapBox/MapBox.tsx | 183 ++++++++----------------------- 1 file changed, 44 insertions(+), 139 deletions(-) (limited to 'src/client/views/nodes/MapBox/MapBox.tsx') diff --git a/src/client/views/nodes/MapBox/MapBox.tsx b/src/client/views/nodes/MapBox/MapBox.tsx index 44afb8e7b..562cb63d1 100644 --- a/src/client/views/nodes/MapBox/MapBox.tsx +++ b/src/client/views/nodes/MapBox/MapBox.tsx @@ -650,6 +650,7 @@ export class MapBox extends ViewBoxAnnotatableComponent { + console.log('deleting') if (this.selectedPinOrRoute) { // Removes filter Doc.setDocFilter(this.Document, 'latitude', this.selectedPinOrRoute.latitude, 'remove'); @@ -672,9 +673,19 @@ export class MapBox extends ViewBoxAnnotatableComponent { + this.temporaryRouteSource = { + type: 'FeatureCollection', + features: [], + } + }) + + document.removeEventListener('pointerdown', this.tryHideMapAnchorMenu, true); }; + + @action centerOnSelectedPin = () => { if (this.selectedPinOrRoute) { @@ -869,6 +880,11 @@ export class MapBox extends ViewBoxAnnotatableComponent { this.featuresFromGeocodeResults = []; + this.settingsOpen = false; if (this._mapRef.current) { const features = this._mapRef.current.queryRenderedFeatures(e.point, { layers: ['map-routes-layer'], @@ -953,13 +970,14 @@ export class MapBox extends ViewBoxAnnotatableComponent !anno.layout_unrendered)); MapAnchorMenu.Instance.DisplayRoute = this.displayRoute; - MapAnchorMenu.Instance.HideRoute = this.hideRoute; MapAnchorMenu.Instance.AddNewRouteToMap = this.createMapRoute; MapAnchorMenu.Instance.CreatePin = this.addMarkerForFeature; MapAnchorMenu.Instance.OpenAnimationPanel = this.openAnimationPanel; @@ -976,6 +994,8 @@ export class MapBox extends ViewBoxAnnotatableComponent !anno.layout_unrendered)); MapAnchorMenu.Instance.DisplayRoute = this.displayRoute; - MapAnchorMenu.Instance.HideRoute = this.hideRoute; MapAnchorMenu.Instance.AddNewRouteToMap = this.createMapRoute; MapAnchorMenu.Instance.CreatePin = this.addMarkerForFeature; @@ -1367,8 +1388,6 @@ export class MapBox extends ViewBoxAnnotatableComponent {}; getRouteAnimationOptions = (): JSX.Element => { return ( @@ -1406,7 +1425,6 @@ export class MapBox extends ViewBoxAnnotatableComponent| } @@ -1414,8 +1432,11 @@ export class MapBox extends ViewBoxAnnotatableComponent|
|
-
Select Line Color:
- this.setAnimationLineColor(color)} /> +
+
Select Line Color:
+ this.setAnimationLineColor(color)} /> +
+ @@ -1449,7 +1470,7 @@ export class MapBox extends ViewBoxAnnotatableComponent) => { - this.dataDoc.map_style = `mapbox://styles/mapbox/${e.target.value}`; + this.dataDoc.map_style = e.target.value; // this.mapStyle = `mapbox://styles/mapbox/${e.target.value}` }; @@ -1457,6 +1478,7 @@ export class MapBox extends ViewBoxAnnotatableComponent) => { const bearing = parseInt(e.target.value); if (!isNaN(bearing) && this._mapRef.current) { + console.log('bearing change') const fixedBearing = Math.max(0, Math.min(360, bearing)); this._mapRef.current.setBearing(fixedBearing); this.dataDoc.map_bearing = fixedBearing; @@ -1467,6 +1489,7 @@ export class MapBox extends ViewBoxAnnotatableComponent) => { const pitch = parseInt(e.target.value); if (!isNaN(pitch) && this._mapRef.current) { + console.log('pitch change') const fixedPitch = Math.max(0, Math.min(85, pitch)); this._mapRef.current.setPitch(fixedPitch); this.dataDoc.map_pitch = fixedPitch; @@ -1564,29 +1587,29 @@ export class MapBox extends ViewBoxAnnotatableComponent
Map Style:
- + + + + + + + +
Bearing:
- +
Pitch:
- +
Zoom:
- +
Show terrain:
@@ -1620,26 +1643,11 @@ export class MapBox extends ViewBoxAnnotatableComponent
)} - {/*
- this.onStepZoomChange(true)} - icon={} - size={Size.SMALL} - color={SettingsManager.userColor} - /> - this.onStepZoomChange(false)} - icon={} - size={Size.SMALL} - color={SettingsManager.userColor} - /> -
*/} - - {/* */} - {/*
- {!this._mapReady - ? null - : this.allAnnotations - .filter(anno => !anno.layout_unrendered) - .map((pushpin, i) => ( - - ))} -
*/} - {/* */} - {/* */}
this.handleSearchChange(searchText)} - onChange={(e, selectedOption) => { - this.handleSearchChange(""); // clear input - this.addMarkerForFeature(selectedOption); - }} - options={this.featuresFromGeocodeResults - .filter(feature => feature.place_name) - .map(feature => feature)} - getOptionLabel={(feature) => feature.place_name} - renderInput={(params) => ( - - )} - /> */ -} -{ - /* typeof newText === 'string' && this.handleSearchChange(newText)} - // onEnter={e => this.bingSearch()} - onEnter={e => {}} - height={32} - // placeholder={this.bingSearchBarContents || 'Enter a location'} - placeholder='Enter a location' - textAlign="center" - /> */ -} -{ - /*