Skip to content

Commit

Permalink
small slider cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf authored and GregoryLundberg committed Nov 30, 2017
1 parent 1b1e232 commit f7eae6b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
8 changes: 2 additions & 6 deletions src/gui/widgets/slider_base.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 0 additions & 11 deletions src/gui/widgets/slider_base.hpp
Expand Up @@ -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);

Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit f7eae6b

Please sign in to comment.