dojox/mdnd/dropMode/OverDropMode (version 1.10)

Summary

Default class to find the nearest target only if the mouse is over an area.

Usage

var foo = new OverDropMode();
dojox/mdnd/dropMode/OverDropMode

Property Summary

Method Summary

  • _checkInterval(areaList,index,x,y) check if the dragNode is in the interval.
  • _updateArea(area) update the D&D area object (i.e. update coordinates of its DOM node)
  • addArea(areas,object) Add a D&D Area into an array sorting by the x position.
  • destroy()
  • getDragPoint(coords,size,mousePosition) return coordinates of the draggable item.
  • getDropIndex(targetArea,coords) Return the index where the drop has to be placed.
  • getTargetArea(areaList,coords,currentIndexArea) get the nearest D&D area.
  • initItems(area) initialize the horizontal line in order to determinate the drop zone.
  • refreshItems(area,indexItem,size,added) take into account the drop indicator DOM element in order to compute horizontal lines
  • updateAreas(areaList) refresh areas position and size to determinate the nearest area to drop an item

Properties

_oldBehaviour

see getDragpoint()

_oldXPoint

used to save a X position

_oldYPoint

used to save a Y position

Methods

_checkInterval(areaList,index,x,y)

check if the dragNode is in the interval.

Parameter Type Description
areaList Array

a list of D&D areas objects

index Integer

index of a D&D area (to get the interval)

x Coord

coordinate x, of the dragNode (see getDragPoint())

y Coord
Returns:any | boolean

true if the dragNode is in intervall

_updateArea(area)

update the D&D area object (i.e. update coordinates of its DOM node)

Parameter Type Description
area Object

the D&D area.

addArea(areas,object)

Add a D&D Area into an array sorting by the x position.

Parameter Type Description
areas Array

array of areas

object Object

data type of a DndArea

Returns:any | Array

a sorted area

destroy()
getDragPoint(coords,size,mousePosition)

return coordinates of the draggable item.

  • For X point : the x position of mouse
  • For Y point : the y position of mouse
Parameter Type Description
coords Object

an object encapsulating X and Y position

size Object

an object encapsulating width and height values

mousePosition Object

coordinates of mouse

Returns:any | Object

an object of coordinates examples:{'x':10,'y':10}

getDropIndex(targetArea,coords)

Return the index where the drop has to be placed.

Parameter Type Description
targetArea Object

a D&D area object.

coords Object

coordinates [x,y] of the draggable item.

Returns:any | number

a number or -1 if the area has no children or the drop index represents the last position in to the area

getTargetArea(areaList,coords,currentIndexArea)

get the nearest D&D area.

Parameter Type Description
areaList Array

a list of D&D areas objects

coords Object

coordinates [x,y] of the dragItem (see getDragPoint())

currentIndexArea integer

an index representing the active D&D area

Returns:any | number

the index of the D&D area

initItems(area)

initialize the horizontal line in order to determinate the drop zone.

Parameter Type Description
area Object

the D&D area.

refreshItems(area,indexItem,size,added)

take into account the drop indicator DOM element in order to compute horizontal lines

Parameter Type Description
area Object

a D&D area object

indexItem Integer

index of a draggable item

size Object

dropIndicator size

added Boolean

boolean to know if a dropIndicator has been added or deleted

updateAreas(areaList)

refresh areas position and size to determinate the nearest area to drop an item

the area position (and size) is equal to the postion of the domNode associated.

Parameter Type Description
areaList Array

array of areas

Error in the documentation? Can’t find what you are looking for? Let us know!