New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middle Mouse Drag to Edit Values #1362
Conversation
Thank you! It should really help people with smaller screens. One
suggestion to add to it- mid click drag + shift could change the value at
smaller increments .. similar to how it is in blender
…On 1 Aug 2017 09:10, "Jeremy Bullock" ***@***.***> wrote:
This is for #595 <#595>
This enables the user to middle mouse + drag on a numeric value to adjust
the value.
The original request was to be able to click on the label to adjust it,
but the time that would take to link each label to a value field is
unfeasible at the moment.
Currently this is implemented on measured fields (fields designated by
inches, mm, pixels etc.). I still need to add non- measured fields, which
should be a simpler task.
------------------------------
You can view, comment on, or merge this pull request online at:
#1362
Commit Summary
- Basic Mouse Drag on Values Working
File Changes
- *M* toonz/sources/common/tunit/tunit.cpp
<https://github.com/opentoonz/opentoonz/pull/1362/files#diff-0> (7)
- *M* toonz/sources/include/tools/tooloptions.h
<https://github.com/opentoonz/opentoonz/pull/1362/files#diff-1> (4)
- *M* toonz/sources/include/toonzqt/doublefield.h
<https://github.com/opentoonz/opentoonz/pull/1362/files#diff-2> (4)
- *M* toonz/sources/include/tunit.h
<https://github.com/opentoonz/opentoonz/pull/1362/files#diff-3> (1)
- *M* toonz/sources/tnztools/tooloptions.cpp
<https://github.com/opentoonz/opentoonz/pull/1362/files#diff-4> (16)
- *M* toonz/sources/tnztools/tooloptionscontrols.cpp
<https://github.com/opentoonz/opentoonz/pull/1362/files#diff-5> (206)
- *M* toonz/sources/tnztools/tooloptionscontrols.h
<https://github.com/opentoonz/opentoonz/pull/1362/files#diff-6> (34)
- *M* toonz/sources/toonzqt/doublefield.cpp
<https://github.com/opentoonz/opentoonz/pull/1362/files#diff-7> (35)
Patch Links:
- https://github.com/opentoonz/opentoonz/pull/1362.patch
- https://github.com/opentoonz/opentoonz/pull/1362.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1362>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGMbVa8KXmmWOKXeY-sU5dFBDtr6YLiDks5sTt1ugaJpZM4OpXx9>
.
|
I'm really excited to have this functionality. I do wish it was left-click and drag like Blender and Krita. I almost always just use a touchpad and am not sure it is possible to middle click and drag on a touchpad. |
We could use left click as well, it will work better with tablets too..
An alternative way to do it that would be neat for pc users is also mouse
scrolling :)
…On 1 Aug 2017 12:18, "artisteacher" ***@***.***> wrote:
I'm really excited to have this functionality. I do wish it was left-click
and drag like Blender and Krita. I almost always just use a touchpad and am
not sure it is possible to middle click and drag on a touchpad.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1362 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGMbVTptTXgWqag60_gP6b7PozLJEAPQks5sTwlqgaJpZM4OpXx9>
.
|
If left-click and drag isn't possible, scrolling would be a great solution. The addition of shift for more precision is a good idea. |
@turtleTooth it doesnt have to use labels. Click dragging on input boxes actually makes a lot sense imo scrolling will be even better, as it is not constrained to the dimensions of the screen/tablet |
Question about the function editor- I currently have it so you can ctrl+click and drag on a value in the function editor spreadsheet to change the value. (This can be used to also set keyframes on unkeyed cells as long as the column has a key.) I also set alt+click to remove keys. So far this makes editing values much faster than double clicking and typing the value. The question is "What should the keys be that go with the mouse move?" There needs to be some modifier because click on its own needs to be available for selecting cells, and middle mouse is used to pan the spreadsheet. |
I am also working on getting label click and drag working for only the edit tool and selection tool. It's doable, but tedious. But since I also use tablets alot, it would be a nice option to have. Most other tool values have a slider. Plastic tool seems to be the only other one that doesn't - I'll look at that too. All values will be able to do the middle mouse button as well. |
First of all, thank you for your work, I don't understand everything, I don't know if it is related or not but i wanted to know 2 things
|
Almost done- first post edited to include current functionality. Todo:
|
attempt to make labels clickable Function Editor Basics Working All functionality working Updated comments
Done - man that was a lot more involved than I thought it would be. |
@turtleTooth you are on fire! Thank you. It's perfect :D |
i think ctrl would be a good default modifier, but ideally it should be configurable. |
These are great time savers. Added: This will be another PR but (unless I'm missing something) there needs to be a way to get a field to return to the default value (or the last value before the field was activated. |
Don't forget to try clicking the labels of the edit tool with left click, or ctrl + left click and drag on the function viewer. Lots of fun. |
@turtleTooth said: I think I'm following all of that. Aside: And... I never realized we could scale the Table itself. Very interesting. |
Jenkins |
|
||
void MeasuredDoubleLineEdit::mouseMoveEvent(QMouseEvent *e) { | ||
if ((e->buttons() == Qt::MiddleButton) || m_labelClicked) { | ||
m_value->modifyValue((e->x() - m_xMouse) / 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some Fx there are parameters with small value range. For instance, the Opacity
parameter of the Over Ino Fx
has 0.0-1.0 value range. In such case middle-dragging of the field cannot get the values other than 0 and 1 for now.
How about modifying this line, adding the precision
argument like as follows ?:
int precision = (m_maxValue > 100) ? 0 : ((m_maxValue > 10) ? 1 : 2);
m_value->modifyValue((e->x() - m_xMouse) / 2, precision);
I once thought of referring MeasuredDoubleLineEdit::m_decimals
variable but using the maximum value of the field seems to perform better.
if ((e->buttons() == Qt::NoButton && m_mouseDragEditing) || m_labelClicked) { | ||
m_xMouse = -1; | ||
m_modified = true; | ||
onEditingFinished(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about inserting clearFocus();
just below this line?
Related to this feature, I found a crash problem when dragging the frame field in the console and modified in #1574 . |
Thanks for the review @shun-iwasawa - I made the requested changes. |
Jenkins |
@@ -33,6 +33,7 @@ class DVAPI LineEdit : public QLineEdit { | |||
|
|||
bool m_isReturnPressed; | |||
bool m_forbiddenSpecialChars; | |||
bool m_mouseDragEditing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@turtleTooth Sorry for the late notice, but it seems that bool m_mouseDragEditing
should be initialized to false
here or in ctor.
Done. Thanks @shun-iwasawa |
Jenkins again |
LGTM Thank you @turtleTooth for addition ! |
I love this! It could also be helpful for text size. Just a thought, but replacing the sliders in the tool option bar with the click + drag on the label could save a lot of room in the tool option bar. |
This is for #595
This does a number of changes:
I was torn on using middle mouse for everything except the function editor. I wanted the commands to be the same everywhere. The benefit of middle mouse is that it doesn't require two hands and a tablet pen button can often be set to middle mouse - making it useful for tablet users. However, middle mouse can't be used on the function editor, since it will pan the spreadsheet and that is useful functionality.
Because of this I opted for different commands for the function editor and all other value fields- trying to do what is most convenient for users. ( I realize that remembering two commands isn't convenient, but regularly using two hands for a command isn't also.)
I personally am most excited about the function editor commands as they seem to make adjusting key values and setting/clearing keys a breeze.