Hello everyone! Is there a way to create a droppable element in hype 3 without using jQueryUI?
You could set an element to Drag in "Action" inspector and select "Control Element Position". When you let the mouse up it would be similar to a drop.
drop.hype.zip (10.4 KB)
you can drop it, but you cannot i.e. let it count how often without using javascript.
also it can be moved then again.
You could also use Hype’s “hypeGesturePhase” to do a drag and drop…
Drag_Drop-hypeGesturePhase.hype.zip (12.7 KB)
Hi Greg,
It works on desktop browser but through Hype Reflect, it shows that action is triggered even if black box is dropped anywhere on screen (and not specifically on red square)
Yes, you would have to add some coordinate bounds (X,Y) to the javascript to limit when the timeline action runs. I just wanted to show that Hype does have some drag & drop capability built in.
I get it.
Do you think it could be possible to trigger the timeline by checking wether the black box overlaps the red circle ?
Yes, be aware that different screen sizes will need to be considered. My screen size is 1600X900 px. I'm using "getBoundingClientRect" in the javascript, but it may work better if you use "offsetLeft or offsetTop".
here's a sample...
Drag_Drop-hypeGesturePhase1.hype.zip (12.9 KB)
Actually, it doesn’t work on ipad neither on my macbook
It’s interesting. Thanks!
Try adjusting the number in the script —" if (squareRect.left >= 987) "— the 987 is the amount of pixels from the left side of my screen in Safari, but your screen size will be different. It can be done, but it is not a very dependable method because of screen sizes are always going to be different.
Thanks Greg,
It works when I make adjustments but you’re right, it’s a very useless method
I wouldn't go as far as to say it's useless, it could work very well if you need to measure from the top of a screen.
Here's a demo using 'offset' in the javascript. It gets the distance from the left side of the Hype window not the Browser window (in this demo the Hype window is 600px wide by 400px height).
offset_action.hype.zip (12.4 KB)
That’s really interesting !!!
There’s a way in javascript to make another element a droppable one.
You would need these:
if(event['hypeGesturePhase'] == hypeDocument.kHypeGesturePhaseStart) {}
if(event['hypeGesturePhase'] == hypeDocument.kHypeGesturePhaseEnd) {}
I build demo from a page from an interactive picturebook app. It’s in the Tumult Hype Gallery and called Noa’s Stars. You can download the document overhere
Take a look at the ‘fDragDrop’ function.
Thanks Rene, nice job on the Noa's Star project.
Thanks René, I get it now !!
You’re welcome guys! I’m working on another interactive picturebook right now. Also with a drag&drop page. I’ll upload it here when it’s finished.
And here’s another page to play with drag&drop!
Kokeshi
Grab the Hype document overhere
kokeshi.hype.zip (6.9 MB)
really nice !
Hans-Gerd Claßen