Page MenuHome

Change cursor while mouse hovering text-buttons or dragging panels
AbandonedPublic

Authored by Campbell Barton (campbellbarton) on Aug 6 2014, 5:38 PM.

Details

Summary

Change cursor while mouse hovering text-buttons or dragging panels

Motivation

Most programs change the mouse cursor to a text-cursor if the mouse hovers a text field to give proper feedback. Blender didn't do this, so far. The same applies to drag & drop events. The cursor should turn to a hand-cursor in this case.
This patch changes the cursor to a text-cursor if the mouse hovers a text button and to a hand cursor if a panel is being dragged.

GIFs

(click to watch)

p.s.: Feature request from @venomgfx. Greetings to him ;)

Diff Detail

Event Timeline

Julian Eisel (Severin) retitled this revision from to Change cursor while mouse hovering text-buttons or dragging panels.Aug 6 2014, 5:38 PM
Julian Eisel (Severin) updated this object.
Julian Eisel (Severin) set the repository for this revision to rB Blender.
Julian Eisel (Severin) updated this object.
Julian Eisel (Severin) updated this revision to Diff 2350.

Nice, LGTM. You can also check how it feels to have the cursor change to a hand before you start to drag, on drag-area hover.

@Julian Eisel (Severin) nice improvement. Just one issue so far as I see. Based on the text cursor behavior I feel the same behavior should be used for the drag widgets. In other words, the cursor should change on both hover and click+drag. Right now it only shows the hand on click+drag.

Beyond providing more context to the user this will also make the behavior more consistent.

Dont think text cursor over buttons is great.

Typically when you have an editable text area, clicking and dragging will select the text, where as this allows dragging too at the moment, the text cursor is set once you click on it, so think its OK as-is.

Using grab hand is fine for panels though.

Campbell Barton (campbellbarton) requested changes to this revision.

Note, Blender's cursor handling is rather weak, at least its not so simple to reliably control

eg, if you change space-types while the mouse is over a button, the cursor remains a text cursor.

This revision now requires changes to proceed.Aug 6 2014, 6:05 PM

Typically when you have an editable text area, clicking and dragging will select the text, where as this allows dragging too at the moment, the text cursor is set once you click on it, so think its OK as-is.

Yeah, that makes sense. Blender's number inputs are a bit more upgraded than in other software. But we can have the text cursor over text field, like the object's name.

Julian Eisel (Severin) edited edge metadata.
Julian Eisel (Severin) set the repository for this revision to rB Blender.
Julian Eisel (Severin) updated this revision to Diff 2383.

Update to follow the given suggestions.

  • the hand-cursor now also appears when the mouse hovers the panel's drag area
  • restrict the text-cursor to text-buttons only (num-buttons don't change the cursor anymore)
  • dragging panels by holding the enter keys (a bit off-topic, but increases consistency)

Updating the hand-cursor to already show up when hovering the drag area required some corrections in the old panel handler code (honestly, this code is a mess! How can it even work that well?? :D ). I made sure that everything works exactly as previously, plus I added the ability to drag panels via enter.

Look at the updated GIFs in the description to see it in action.

Looks good. Where is this hand cursor from? Was it already used for something in Blender?

Hehe, the cursor was already included in Blender, it just wasn't used afaik. It might be useful to add an open-hand-cursor which could be used for hovering. The closed-hand-cursor could be used while dragging. We might also add a hand-with-raised-index-finger-cursor, which could be shown while hovering operator buttons, menus, checkboxes, etc.

Nice!

I don't think Blender has such a thing as open-hand/closed-hand? At least looking at the code doesn't seem to.

EnumPropertyItem window_cursor_items[] = {
	{CURSOR_STD, "DEFAULT", 0, "Default", ""},
	{CURSOR_NONE, "NONE", 0, "None", ""},
	{CURSOR_WAIT, "WAIT", 0, "Wait", ""},
	{CURSOR_EDIT, "CROSSHAIR", 0, "Crosshair", ""},
	{CURSOR_X_MOVE, "MOVE_X", 0, "Move-X", ""},
	{CURSOR_Y_MOVE, "MOVE_Y", 0, "Move-Y", ""},

	{BC_KNIFECURSOR, "KNIFE", 0, "Knife", ""},
	{BC_TEXTEDITCURSOR, "TEXT", 0, "Text", ""},
	{BC_PAINTBRUSHCURSOR, "PAINT_BRUSH", 0, "Paint Brush", ""},
	{BC_HANDCURSOR, "HAND", 0, "Hand", ""},
	{BC_EW_SCROLLCURSOR, "SCROLL_X", 0, "Scroll-X", ""},
	{BC_NS_SCROLLCURSOR, "SCROLL_Y", 0, "Scroll-Y", ""},
	{BC_NSEW_SCROLLCURSOR, "SCROLL_XY", 0, "Scroll-XY", ""},
	{BC_EYEDROPPER_CURSOR, "EYEDROPPER", 0, "Eyedropper", ""},
	{0, NULL, 0, NULL, NULL}
};

I agree with only having Text cursor for mouse hover on text fields. Even though it doesn't behave exactly like in other apps where you can directly select text, is a welcome hint (unless the Text field is not editable, like for linked datablocks).

Besides that, looks fine to me!

No it doesn't have an open-hand/index-finger-hand, but looking at the code, they should be easy to add (we even have a make_cursor_gui in the developer tools :P ). So, if you agree, I'll include them and play a bit with them?!
I forgot to add the not editable case. But I'll add that soon. Thx for the reminder :)

Julian Eisel (Severin) updated this revision to Diff 2385.

Disabled or non-editable text-buttons do not change the cursor anymore

Great!

How would you go about adding them? I guess you can just point to the local system ones. Don't need to actually design them, right?

The easiest way would be to take and modify the current closed hand cursor, i guess.

Popups are another case where we need the hand/grab cursor (since they can now be moved around).

Examples include the "Save Over?", or the F6 popup:

Cheers!

Hey, here are the hand cursors that @Julian Eisel (Severin) asked for. They are 16x16 - If they pass initial review, I will also provide 32x32.

Campbell Barton (campbellbarton) commandeered this revision.

Rejecting this patch, rationale.

  • When you move your mouse over a button, you cant place the carret as with other applications. (changing the cursor gives the impression this might be possible).
  • When you move your mouse over a button, it is highlighted.

There is a real issue with number buttons, when you cant see if clicking will hit an arrow, or edit the text, In this case I rather highlight the arrows when the mouse is over them - as has been propoced already T38070