On Mouse Up not the droids I was looking for?


#1

Hey gang,

I am trying to make a draggable UI element that snaps back to it’s origin when released.

I thought this would be pretty straight-forward:
• An animation to move it
• The element has a Drag Action, and then On Mouse Up, I’ve set “Go to Time in Timeline” and set it back to 0 on the same timeline.

Alas, it sits around like an unwelcome President :frowning2. Any suggestions? Thank you in advance!

Snap_back.hype.zip (20.4 KB)


(Mark Hunte) #2

It is probably better to do it with the Hype eventsGesture API.

A drag event it appears will cancel the mouse up event

Snap_back_MHv1.hype.zip (21.5 KB)


#3

Sweeeeeeet, yup, that works perfectly. Thank you Mark.

Ah, is it a bug then for Mouse Up, or is it Just How It Is?


(Mark Hunte) #4

If you google this seems to be a problem with the normal DOM events and nothing really with Hype.


(Greg) #5

Here’s another way…

snapBack 3.hype.zip (12.1 KB)


#6

@gasspence re: "snapback 3"
I noticed if I eliminate the “getCoords” function everything still works… and there is a “Mouse Down” event that has a JavaScript “None” attached - was this “getCoords” former home?


(Greg) #7

Thanks for pointing that out Jim, I should have taken those items out (they were from another function that I have since removed)


#8

Hi Greg,

This is also a nice solution, with the nice animation going back. I appreciate you putting the time in for this. Each solution helps me out immensely.