mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zakru/fix/1193' into 'master'
Avoid saving settings if maps are not updating Closes #1193 See merge request veloren/veloren!2456
This commit is contained in:
commit
1ed6a04a34
@ -327,7 +327,9 @@ impl<'a> Widget for Map<'a> {
|
||||
.sum();
|
||||
// Drag represents offset of view from the player_pos in chunk coords
|
||||
let drag_new = drag + dragged / map_size / zoom * max_zoom;
|
||||
events.push(Event::SettingsChange(MapDrag(drag_new)));
|
||||
if drag_new != drag {
|
||||
events.push(Event::SettingsChange(MapDrag(drag_new)));
|
||||
}
|
||||
|
||||
let rect_src = position::Rect::from_xy_dim(
|
||||
[
|
||||
@ -392,10 +394,12 @@ impl<'a> Widget for Map<'a> {
|
||||
.scrolls()
|
||||
.map(|scroll| scroll.y)
|
||||
.sum();
|
||||
let new_zoom_lvl = (self.global_state.settings.interface.map_zoom
|
||||
* (scrolled * 0.05 * -1.0).exp2())
|
||||
.clamped(1.25, max_zoom / 64.0);
|
||||
events.push(Event::SettingsChange(MapZoom(new_zoom_lvl as f64)));
|
||||
if scrolled != 0.0 {
|
||||
let new_zoom_lvl = (self.global_state.settings.interface.map_zoom
|
||||
* (scrolled * 0.05 * -1.0).exp2())
|
||||
.clamped(1.25, max_zoom / 64.0);
|
||||
events.push(Event::SettingsChange(MapZoom(new_zoom_lvl as f64)));
|
||||
}
|
||||
// Icon settings
|
||||
// Alignment
|
||||
Rectangle::fill_with([150.0, 200.0], color::TRANSPARENT)
|
||||
|
@ -514,6 +514,7 @@ impl<'a> Widget for MiniMap<'a> {
|
||||
// Set the image dimensions here, rather than recomputing each time.
|
||||
zoom = min_zoom.max(zoom / ZOOM_FACTOR);
|
||||
// set_image_dims(zoom);
|
||||
events.push(Event::SettingsChange(MinimapZoom(zoom)));
|
||||
}
|
||||
if Button::image(self.imgs.mmap_plus)
|
||||
.w_h(18.0 * SCALE, 18.0 * SCALE)
|
||||
@ -528,6 +529,7 @@ impl<'a> Widget for MiniMap<'a> {
|
||||
{
|
||||
zoom = min_zoom.max(zoom * ZOOM_FACTOR);
|
||||
// set_image_dims(zoom);
|
||||
events.push(Event::SettingsChange(MinimapZoom(zoom)));
|
||||
}
|
||||
|
||||
// Always northfacing button
|
||||
@ -555,8 +557,6 @@ impl<'a> Widget for MiniMap<'a> {
|
||||
events.push(Event::SettingsChange(MinimapFaceNorth(!is_facing_north)));
|
||||
}
|
||||
|
||||
events.push(Event::SettingsChange(MinimapZoom(zoom)));
|
||||
|
||||
// Coordinates
|
||||
let player_pos = self
|
||||
.client
|
||||
|
@ -3394,10 +3394,12 @@ impl Hud {
|
||||
.clamped(1.25, max_zoom / 64.0);
|
||||
|
||||
global_state.settings.interface.map_zoom = new_zoom_lvl;
|
||||
global_state.settings.save_to_file_warn();
|
||||
} else if global_state.settings.interface.minimap_show {
|
||||
let new_zoom_lvl = global_state.settings.interface.minimap_zoom * factor;
|
||||
|
||||
global_state.settings.interface.minimap_zoom = new_zoom_lvl;
|
||||
global_state.settings.save_to_file_warn();
|
||||
}
|
||||
|
||||
show.map && global_state.settings.interface.minimap_show
|
||||
|
Loading…
Reference in New Issue
Block a user