imgui-knobs icon indicating copy to clipboard operation
imgui-knobs copied to clipboard

Is it possible to allow for Vertical and Horizontal drag to be treated as the same thing?

Open elanhickler opened this issue 2 years ago • 1 comments

Is it possible to allow for Vertical and Horizontal drag to be treated as the same thing? This is standard practice and makes knobs and sliders easier and more intuitive to use. In other words, dragging up/diagonally/right all produce the same outcome. The math is straightforward, just requiring a check to see if vertical or horizontal mouse positions are greater and just use the greater value.

elanhickler avatar Aug 29 '23 09:08 elanhickler

Sure that would be possible. I don't have a lot of time at the moment, but will look into it at some point. Happy to accept a PR too :)

altschuler avatar Sep 02 '23 14:09 altschuler

@elanhickler @altschuler I'm happy submit a PR for this but need some info.

  • Should there still be support for horizontal and vertical modes?
  • Should this greater-value behavior be the default?

RobertAlbus avatar Aug 29 '24 17:08 RobertAlbus

@elanhickler @altschuler I'm happy submit a PR for this but need some info.

* Should there still be support for horizontal and vertical modes?

* Should this greater-value behavior be the default?

I haven't tried it out, but if this behavior is arguably better and more intuitive I think it should be default, yes. In that case we can keep the ImGuiKnobFlags_DragHorizontal flag and add a ImGuiKnobFlags_DragVertical one for the current behavior. Otherwise, if it's a matter of preference which is better, then adding a ImGuiKnobFlags_DragDistance or similarily named flag for the new behavior might be better suited.

altschuler avatar Aug 29 '24 19:08 altschuler

That's in line with the assumptions I had, thanks for confirming. I'll try to take a look at it this weekend.

RobertAlbus avatar Aug 29 '24 19:08 RobertAlbus

@RobertAlbus I tested this out and found that it's arguably better using bi-directional dragging, so I made that default.

altschuler avatar Sep 03 '24 06:09 altschuler