Only update button states if zoom level changed.

This commit is contained in:
fendrin 2013-06-21 14:51:15 +02:00
parent e7ca9d81be
commit 80b7d40bc2
3 changed files with 10 additions and 6 deletions

View file

@ -1978,7 +1978,7 @@ bool display::zoom_at_min() const
return zoom_ == MinZoom;
}
void display::set_zoom(int amount, bool absolute)
bool display::set_zoom(int amount, bool absolute)
{
int new_zoom = zoom_ + amount;
if (absolute)
@ -2012,6 +2012,9 @@ void display::set_zoom(int amount, bool absolute)
// Forces a redraw after zooming.
// This prevents some graphic glitches from occurring.
draw();
return true;
} else {
return false;
}
}

View file

@ -501,7 +501,7 @@ public:
* otherwise the images might start to look odd
* (hex_width() gets rounding errors).
*/
void set_zoom(int amount, bool absolute = false);
bool set_zoom(int amount, bool absolute = false);
bool zoom_at_max() const;
bool zoom_at_min() const;

View file

@ -1125,10 +1125,11 @@ void editor_controller::left_mouse_up(int x, int y, const bool /*browse*/)
toolkit_->set_mouseover_overlay();
gui::slider* s = gui_->find_slider("map-zoom-slider");
if (s && s->value_change()) {
gui_->set_zoom(s->value(), true);
context_manager_->get_map_context().get_labels().recalculate_labels();
toolkit_->get_mouse_action()->set_mouse_overlay(*gui_);
set_button_state(*gui_);
if (gui_->set_zoom(s->value(), true)) {
context_manager_->get_map_context().get_labels().recalculate_labels();
toolkit_->get_mouse_action()->set_mouse_overlay(*gui_);
set_button_state(*gui_);
}
}
context_manager_->refresh_after_action();
}