Drag and drop behavior


Name spacerialto.widgetBehavior
FILEmulti-files in rialtoEngine\javascript\core\coreBehaviors\DD_*.js
NAMEDrag and drop behavior
INHERITS
VERSION0.86
update
DESCRIPTIONIt is rather the description of the affectation of the drag and drop behavior (relative to several files) than the description of an independent component



Details of setup properties

NameTypeDescriptionDefault
oHtmlEvtTargetobjectobject that will catch the mouse event
oHtmlToMoveobjectHTML object to move. This parameter allow to attach drag and drop behavior to javascript object even if they doesn't directly refer to an html object
dragMoodstringdirect move ('directMove ') or ghost of object to move('ghostMove')directMove
bSelectMarkbooleanif true display selection during dragtrue if use a ghost else false
Ghost.aspectstringghost aspect 'frame' (border dash),'rect' (plain div) or 'icon' (little square)frame
Ghost.topinttop of the ghost if it is not the same as the object0
Ghost.heightintheight of the ghost if it is not the same as the object
bMUpActionbooleanif true activate a callback function (synchroDDMup ) onmouse uptrue
magneticsGrid.widthColintwidth of the row of the magnetic grid
magneticsGrid.heightRowintheight of the row of the magnetic grid
bRectLimbooleanindicate that a limit object must be usetrue
bDynamicsMovingLimits booleanif true the moving limits are evaluate on each drag and drop cycle else they are calculate only on the initial affectof the behaviortrue
movingLimits.rectLim.orientationsringdrag limitation: none ('2D'),only horizontal ('h') or vertical('v') drag2D
movingLimits.rectLim.topinttop of the limit rectangle
movingLimits.rectLim.leftintleft of the limit rectangle
movingLimits.rectLim.bottomintbottom of the limit rectangle
movingLimits.rectLim.rightintright of the limit rectangle
movingLimits.rectLim.oHtmlRefobjectspecify the html object to use to calculate the moving limitshtml parent of the drag object
movingLimits.rectLim.bCircularbooleanif set to true, arrived at the limit the object takes the position opposed in the limiting rectanglefalse
isWithLimitsDisplayedbooleanif true display limits border during dragtrue
isWithMovingInfobooleanif true display moving informations during dragtrue
sensitiveEdgeWidthintnumber of pixel from the border to exclude for the drag and drop. This propertie is use when an object must have drag and drop and resize behavior.0
whichMouseButtonForDD stringspecify which mous button can start the drag behavior ('left','right' or 'both')left

Example:
	  	    var o = document.getElementById('objectToMove');
			var setup ={bRectLim 	: false
			,ghost		: {aspect:	'rect'}
			,sensitiveEdgeWidth  :3
			,isWithMovingInfo : true};							
			rialto.widgetBehavior.affect(o,'DragAndDrop',setup);        	
		

CALLBACK METHODS


MethodArguments listReturn valueInheritsTo redefine
synchroobject totalMove,object sinceLastMovevoidnoyes
synchroDDMupobject totalMovevoidnoyes
afterDDint t_total,int l_totalvoidnoyes
afterClicvoidnoyes

synchro

this method is raise on each mouse move event and she pass as parameter an object that contains move informations
Parameters:
object totalMove:object with 2 properties 'top' and 'left' that represents the total top and left move from the begining of the drag
object sinceLastMove:object with 2 properties 'top' and 'left' that represents the top and left move till last mouse move

The code must be redefine after the affectation of the behavior. By default this method does nothing.

synchroDDMup

this method is raise at the end of the drag ONLY IF THE OBJECT AS REALLY MOVE and she pass as parameter an object that contains move informations
Parameters:
object totalMove:object with 2 properties 'top' and 'left' that represents the total top and left move from the begining of the drag

The code must be redefine after the affectation of the behavior. By default this method does nothing.

afterClic

this method is raise at the end of the drag
Parameters:
int t_total:represents the total top move from the begining of the drag
int l_total:represents the total left move from the begining of the drag

The code must be redefine after the affectation of the behavior. By default this method does nothing.


afterClic

this method is raise when there is a click without movement. You have to redifine this method when you want to add a onclick event handler on the object that have a drag androp behavior.
Parameters:

The code must be redefine after the affectation of the behavior. By default this method does nothing.