HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... Nick James - cont... Restricting Drag & Drop
Nick James - cont... Restricting Drag & Drop
  View type:
Hi Nick, firstly thank for your help, on the face of it, it sounds very easy however I'm not sure where the 'if' statement belongs. is it an action on the object being dragged? and if so is this the correct syntax

if 'dragobject_1.x < 0
move-start ......

Regards Raj [:confused:]
 
I must admit I've not tried this as I'm a bit tied up with a few other things at the moment.
But yes the object which is being dragged needs to be polled for its location once it is released, remember that it will be the position of top left hand corner of this object which will be returned so the boundary limits (edge of the display window)of the top and left window borders will be x0 to xnnn, y0 and x0, y0 to ynnn depending on the page size. The bottom and right margins will depend on wether you want to have all of the object held within the boundary limits. you will need to add the width or height of the object to the appropriate value.

You will probably need something like

ONDROP
**using the dropped position will be easiest to set up
IF (drag object position)LESS THAN (left border value) AND IF (drag object position) LESS THAN (top border value) THEN (move drag object back to start)
**Thats for the top and left borders, the less than for the top borders because outside of either returns a negative value ***
IF (drag object position) MORE THAN (top border value MINUS drag object)AND IF (drag object position) MORE THAN (right border value MINUS drag object) THEN (move drag object back to start)
**As values outside of the display margin return increasing values.
*** Replace with the courselab statements and < or > as required.
It might be easier to set up the tests as a sequence testing individually for each border and not joining them with an AND..

This should ignore every position within the page bounds where all of the drag object is within those bounds.

OR you could set up some 'landing zones' and use an ONDROP CHECKHIT to see of it's been put in the correct space. If not then move it back to it's start position.

Either method is equally valid and which you use will depend on what you are trying to achieve.

Nick
Subject:
Message options
No additional options