diff --git a/src/gui/widgets/slider_base.cpp b/src/gui/widgets/slider_base.cpp index e3f5e60d7b2ed..54bcd686d0a36 100644 --- a/src/gui/widgets/slider_base.cpp +++ b/src/gui/widgets/slider_base.cpp @@ -45,7 +45,6 @@ slider_base::slider_base(const implementation::builder_styled_widget& builder, c , item_last_(0) , item_position_(0) , drag_initial_mouse_(0, 0) - , drag_initial_position_(0) , drag_initial_offset_(0) , positioner_offset_(0) , positioner_length_(0) @@ -230,10 +229,9 @@ void slider_base::signal_handler_mouse_motion( break; - case PRESSED: { + case PRESSED: move_positioner(get_length_difference(drag_initial_mouse_, mouse) + drag_initial_offset_); - - } break; + break; case FOCUSED: if(!on_positioner(mouse)) { @@ -278,7 +276,6 @@ void slider_base::signal_handler_left_button_down(const event::ui_event event, b assert(get_window()); drag_initial_mouse_ = mouse; - drag_initial_position_ = item_position_; drag_initial_offset_ = positioner_offset_ - offset_before(); get_window()->mouse_capture(); @@ -320,7 +317,6 @@ void slider_base::signal_handler_left_button_up(const event::ui_event event, boo } drag_initial_mouse_ = {0, 0}; - drag_initial_position_ = 0; drag_initial_offset_ = 0; handled = true; diff --git a/src/gui/widgets/slider_base.hpp b/src/gui/widgets/slider_base.hpp index b2fd3d9f6790d..0e90e38e3ef1b 100644 --- a/src/gui/widgets/slider_base.hpp +++ b/src/gui/widgets/slider_base.hpp @@ -38,9 +38,6 @@ namespace gui2 */ class slider_base : public styled_widget { - /** @todo Abstract the code so this friend is no longer needed. */ - friend class slider; - public: slider_base(const implementation::builder_styled_widget& builder, const std::string& control_type); @@ -208,20 +205,12 @@ class slider_base : public styled_widget * This is used during dragging the positioner. */ point drag_initial_mouse_; - /** - * The position the slider was when draggin the slider was started. - * - * This is used during dragging the positioner. - */ - int drag_initial_position_; /** * The offset in pixels the slider was when dragging the positioner was started. */ int drag_initial_offset_; - point mouse2_; - /** * The start offset of the positioner. *