Skip to content

Commit

Permalink
removed previoslyOnInteractiveMap as unnessesary
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Mar 29, 2024
1 parent 9e5c4b3 commit 127099c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
24 changes: 8 additions & 16 deletions webclient/components/DetailsInteractiveMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const initialLoaded = ref(false);
type DetailsResponse = components["schemas"]["DetailsResponse"];
function loadInteractiveMap(fromUi = false, previoslyOnInteractiveMap = false) {
function loadInteractiveMap(fromUi = false) {
if (!webglSupport) return;
const doMapUpdate = function () {
Expand All @@ -37,8 +37,7 @@ function loadInteractiveMap(fromUi = false, previoslyOnInteractiveMap = false) {
}
marker.value = new Marker({ element: createMarker() });
const coords = props.data.coords;
if (coords !== undefined && map.value !== undefined)
marker.value.setLngLat([coords.lon, coords.lat]).addTo(map.value as Map);
if (map.value !== undefined) marker.value.setLngLat([coords.lon, coords.lat]).addTo(map.value as Map);
const overlays = props.data.maps?.overlays;
if (overlays) floorControl.value.updateFloors(overlays);
Expand All @@ -49,19 +48,12 @@ function loadInteractiveMap(fromUi = false, previoslyOnInteractiveMap = false) {
room: 18,
};
if (coords !== undefined) {
if (previoslyOnInteractiveMap) {
map.value?.flyTo({
center: [coords.lon, coords.lat],
zoom: defaultZooms[props.data.type || "undefined"] || 16,
speed: 1,
maxDuration: 2000,
});
} else {
map.value?.setZoom(16);
map.value?.setCenter([coords.lon, coords.lat]);
}
}
map.value?.flyTo({
center: [coords.lon, coords.lat],
zoom: defaultZooms[props.data.type || "undefined"] || 16,
speed: 1,
maxDuration: 2000,
});
};
// The map element should be visible when initializing
Expand Down
3 changes: 1 addition & 2 deletions webclient/pages/view/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ function tryToLoadMap() {
* @return {boolean} Whether the loading was successful
*/
if (document.getElementById("interactive-map") !== null) {
const previoslyOnInteractiveMap = false
if ( === "interactive") interactiveMap.value?.loadInteractiveMap(false,previoslyOnInteractiveMap);
if (selectedMap.value === "interactive") interactiveMap.value?.loadInteractiveMap(false);
// scrolling to the top after navigation
window.scrollTo({ top: 0, behavior: "auto" });
return true;
Expand Down

0 comments on commit 127099c

Please sign in to comment.