"Grab" and "Grabbing" cursor styles on hover / on click possible?


#1

I’m trying to figure out if there’s anyway in RP9 to trigger a “grab” (open hand) and “grabbing” (closed fist) cursor.

I found the following file in a different thread that has a lot of cursor styles - but it doesn’t have grab or grabbing and if I try to tweak the code accordingly it doesn’t work.

Any suggestions?

custom_cursors.rp (67.3 KB)


#2

Hi!

Taking a look at the relevant portion of the javascript:

$('[data-label="cursor_grabbing"]').css('cursor', 'grabbing');

This part: $('[data-label="cursor_grabbing"]') is a jQuery selector: it gives you a reference to every widget on the page whose name is “cursor_grabbing”. So you need to make sure to update the string in the selector to reflect the name of the widget(s) you are targeting. My guess is this is where the problem lies.

This part: .css('cursor', 'grabbing') assigns the specified cursor via CSS to the widgets returned by the selector…

I updated the file. custom_cursors (1).rp (61.5 KB)


#3

Edit - I think I got it with the dynamic panel. Took a little playing around. Thanks for all your help - much appreciated!

custom_cursors (2).rp (63.1 KB)


Awesome - getting closer - is there a way to chain these together so it can show a grab icon on hover and a grabbing icon on mouse click/long press?

It doesn’t seem like you can do it based on a single object unless there was some way to change the name of the object dynamically. I tried and failed when trying to apply a long press state to change to a dynamic panel…


#4

Hi!

You can kind of get it working by changing the cursor on drag start and drag end (if dragging is what you had in mind). But if you drag too fast the mouse will outrace the object you are dragging and trigger its mouse exit event.

grab and drag.rp (56.3 KB)


#5

Hi,
This file is perfect for me also.
Is there a way to have the java script files locally on my computer?

Thanks!
Iris