From 5f32e2293eb05423fb01655fef354f9d84ef5ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Mej=C3=ADa?= Date: Thu, 16 May 2024 12:13:26 -0400 Subject: [PATCH] Issue 382: Retrieve fix retrieval of current viewState params --- inst/htmlwidgets/mapdeck_location.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/inst/htmlwidgets/mapdeck_location.js b/inst/htmlwidgets/mapdeck_location.js index e8d511dd..4bc2abd5 100644 --- a/inst/htmlwidgets/mapdeck_location.js +++ b/inst/htmlwidgets/mapdeck_location.js @@ -26,15 +26,15 @@ function md_change_location( map_id, map_type, location, zoom, pitch, bearing, d currentMaxPitch = window[ map_id + 'map'].viewState["default-view"].maxPitch; currentMinPitch = window[ map_id + 'map'].viewState["default-view"].minPitch; } else { - currentLon = (location === null || location.length == 0) ? window[ map_id + 'map'].viewState.longitude : location[0]; - currentLat = (location === null || location.length == 0) ? window[ map_id + 'map'].viewState.latitude : location[1]; - currentPitch = pitch === null ? window[ map_id + 'map'].viewState.pitch : pitch; - currentBearing = bearing === null ? window[ map_id + 'map' ].viewState.bearing : bearing; - currentZoom = zoom === null ? window[ map_id + 'map'].viewState.zoom : zoom; - currentMaxZoom = window[ map_id + 'map'].viewState.maxZoom; - currentMinZoom = window[ map_id + 'map'].viewState.minZoom; - currentMaxPitch = window[ map_id + 'map'].viewState.maxPitch; - currentMinPitch = window[ map_id + 'map'].viewState.minPitch; + currentLon = (location === null || location.length == 0) ? window[ map_id + 'map'].viewState.map.longitude : location[0]; + currentLat = (location === null || location.length == 0) ? window[ map_id + 'map'].viewState.map.latitude : location[1]; + currentPitch = pitch === null ? window[ map_id + 'map'].viewState.map.pitch : pitch; + currentBearing = bearing === null ? window[ map_id + 'map' ].viewState.map.bearing : bearing; + currentZoom = zoom === null ? window[ map_id + 'map'].viewState.map.zoom : zoom; + currentMaxZoom = window[ map_id + 'map'].viewState.map.maxZoom; + currentMinZoom = window[ map_id + 'map'].viewState.map.minZoom; + currentMaxPitch = window[ map_id + 'map'].viewState.map.maxPitch; + currentMinPitch = window[ map_id + 'map'].viewState.map.minPitch; } console.log( currentLon );