Prevent element from dragging after dropping

Hi all,
searched the forum, but didn´t find an appropriate answer...: Is there a way, to prevent an element (on Drag -> Control Element Position) from being dragged again, after dropping (on (event.hypeGesturePhase == "end")) ...

Thanks in advance,

you can place an element above after drop or try to add pointerevents: none after drop :slight_smile:

That´s exactly what I´m doing right now. I thought, there would be a more elegant way to achieve this... :wink: Tried pointerevents, but didn´t work...

you can add a data-attribute when dropped.

on dragstart check for the attribute. get startposition. apply the startposition continiously while drag happens ...

Hmm, not sure about the second part... tried this

if (event.hypeGesturePhase == "move" && element.dataset.moveable == true ){
	hypeDocument.setElementProperty(element, 'left', event['hypeGestureXPosition']);
	hypeDocument.setElementProperty(element, 'top', event['hypeGestureYPosition']);
if (event.hypeGesturePhase == "end" ){
	element.dataset.moveable = 0;

Prevent from dragging works, only event['hypeGestureXPosition']/event['hypeGestureYPosition'] does not seem to represent the mousePosition... (12.5 KB)

Like this? (15,2 KB)

1 Like

I swear, I tried it - and it didn´t work... :grinning_face_with_smiling_eyes: And now I know why - = 'none'; doesn´t seem to work with symbols... why is that? (14.1 KB)

1 Like

Pointer events only ever apply to the element. So, we have to use a CSS class that disables pointer events for the entire DOM subtree to prevent event bubbling!


	.disabled, .disabled * {
		pointer-events: none !important;

In Drag Controller Function

	if (event.hypeGesturePhase == hypeDocument.kHypeGesturePhaseEnd ){
	} (18,3 KB)

Hint: To restore dragging, removing the class should work!


By the way, to restore all disabled elements, you can run this (on scene load):

var sceneElm = document.getElementById(hypeDocument.currentSceneId());
1 Like

Exactly the solution I was looking for :blush: And again - havo to brush up my CSS skills... :wink:Thanks a lot, Max!! :+1:

1 Like