fix unequal zoom in distance and zoom out distance

This commit is contained in:
Niko Thees 2020-08-23 23:24:24 +00:00 committed by Imbris
parent 877eaee151
commit 5d11adfd4c
2 changed files with 15 additions and 4 deletions

View File

@ -14,7 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added leaf and chimney particles
### Changed
- Fixed a bug where leaving the Settings menu by pressing "N" in single player kept the game paused
- Fixed a bug where leaving the Settings menu by pressing "N" in single player kept the game paused.
- The world map has been refactored to support arbitrary sizes and compute horizon maps.
- Veloren's lighting has been completely overhauled.
- The graphics options were made much more flexible and configurable.
@ -23,7 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Animation and terrain math were switched to use SIMD where possible, improving performance.
- The way we cache glyphs was refactored, fixed, and optimized.
- Colors for models and figures were adjusted to account for the saturation hack.
- Fixed a bug where the closest item would be picked up instead of a selected item
- Fixed a bug where the closest item would be picked up instead of a selected item.
- Fixed a bug where camera zoom in and zoom out distance didn't match.
### Removed

View File

@ -344,8 +344,17 @@ impl Scene {
},
// Zoom the camera when a zoom event occurs
Event::Zoom(delta) => {
// when zooming in the distance the camera travelles should be based on the
// final distance. This is to make sure the camera travelles the
// same distance when zooming in and out
if delta < 0.0 {
self.camera.zoom_switch(
delta * (0.05 + self.camera.get_distance() * 0.01) / (1.0 - delta * 0.01),
); // Thank you Imbris for doing the math
} else {
self.camera
.zoom_switch(delta * (0.05 + self.camera.get_distance() * 0.01));
}
true
},
Event::AnalogGameInput(input) => match input {