maplibre-rs icon indicating copy to clipboard operation
maplibre-rs copied to clipboard

Limit the maximum and minimum zoom level

Open hanchao opened this issue 2 years ago • 3 comments

Keep zooming in or zooming out, demo will crash.

🤔 Expected Behavior

Need to limit maximum and minimum zoom level

😯 Current Behavior

Keep zooming in until crashed

[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 30.42
[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 30.52
[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 30.71
[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 30.96
[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 31.21
[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 31.36
[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 31.53
[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 31.85
[2022-07-18T12:36:49Z INFO  maplibre::context] zoom: 32.16
thread 'main' panicked at 'attempt to add with overflow', maplibre/src/coords.rs:584:42
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2022-07-18T12:36:49Z INFO  wgpu_core::hub] Dropping Global
[2022-07-18T12:36:49Z INFO  wgpu_core::device] Destroying 12 command encoders

Keep zooming out until crashed

[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -30.15
[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -30.41
[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -30.66
[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -30.9
[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -31.13
[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -31.35
[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -31.56
[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -31.76
[2022-07-18T12:35:05Z INFO  maplibre::context] zoom: -31.95
thread 'main' panicked at 'attempt to add with overflow', maplibre/src/coords.rs:584:42
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2022-07-18T12:35:05Z INFO  wgpu_core::hub] Dropping Global
[2022-07-18T12:35:05Z INFO  wgpu_core::device] Destroying 5 command encoders

🌍 Your Environment

  • Desktop
    • Operating System: macOS 12.2.1

hanchao avatar Jul 18 '22 12:07 hanchao

Oops, I started with this and commented in the wrong Issue #73

DerKarlos avatar Oct 02 '22 04:10 DerKarlos

Alright no worries!

maxammann avatar Oct 02 '22 10:10 maxammann

We should also directly address the overflows. E.g. returning errors/options when we would hit the overflows.

maxammann avatar Dec 15 '22 15:12 maxammann