Skip to content

Commit

Permalink
Set max zoom to 19 and log related errors as DEBUG instead of WARN
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Oct 25, 2024
1 parent 045c59a commit 920dbfd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
7 changes: 5 additions & 2 deletions crates/viewer/re_component_ui/src/zoom_level.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use re_types::datatypes;
use re_viewer_context::MaybeMutRef;

//TODO(#7876): move this to `re_space_view_map` when the crate is no longer behind a Cargo feature.
const MAX_ZOOM_LEVEL: f32 = 22.0;
// TODO(#7876): move this to `re_space_view_map` when the crate is no longer behind a Cargo feature.
// TODO(ab): currently set at 19 because that's what walkers has as hard-coded limit. In the future,
// walkers will need to be more flexible (e.g. depend on the actually max zoom level for the map
// provider). At that point, we will have to set some kind of "max ever" value here.
const MAX_ZOOM_LEVEL: f32 = 19.0;

/// Editor for a [`re_types::blueprint::components::ZoomLevel`].
pub fn edit_zoom_level(
Expand Down
13 changes: 6 additions & 7 deletions crates/viewer/re_space_view_map/src/map_space_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ Displays geospatial primitives on a map.
}

fn new_state(&self) -> Box<dyn SpaceViewState> {
Box::<MapSpaceViewState>::new(MapSpaceViewState {
tiles: None,
map_memory: MapMemory::default(),
selected_provider: MapProvider::default(),
})
Box::<MapSpaceViewState>::new(MapSpaceViewState::default())
}

fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option<f32> {
Expand Down Expand Up @@ -201,8 +197,11 @@ Displays geospatial primitives on a map.
let zoom_level = blueprint_zoom_level.or(default_zoom_level).unwrap_or(16.0);

if state.map_memory.set_zoom(zoom_level).is_err() {
re_log::warn_once!(
"Failed to set zoom level for map. Zoom level should be between zero and 22"
//TODO(ab): we need a better handling of this, but requires upstream work (including
//accepting higher zoom level and using lower-resolution tiles.
re_log::debug!(
"Zoom level {zoom_level} rejected by walkers (probably means that it is not \
supported by the configured map provider)"
);
};

Expand Down

0 comments on commit 920dbfd

Please sign in to comment.