dojox/mdnd/dropMode/VerticalDropMode (version 1.10)

Summary

Enabled a type of calcul for Dnd. Default class to find the nearest target.

Property Summary

Method Summary

  • _checkInterval(areaList,index,x) check if the dragNode is in the interval.
  • _updateArea(area) update the DnD area object (i.e. update coordinates of its DOM node)
  • addArea(areas,object) Add a DnD 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 DnD 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 intervals between areas 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)

check if the dragNode is in the interval. The x coordinate is basically provided by the getDragPoint method.

Parameter Type Description
areaList Array

a list of DnD areas objects

index Integer

index of a DnD area (to get the interval)

x Coord

coordinate x, of the dragNode

Returns:any | boolean

true if the dragNode is in intervall

_updateArea(area)

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

Parameter Type Description
area Object

the DnD area

addArea(areas,object)

Add a DnD 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

return for:

  • X point : the middle
  • Y point : search if the user goes up or goes down with his mouse.
  • Up : top of the draggable item
  • Down : bottom of the draggable item
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 example : {'x':10,'y':10}

getDropIndex(targetArea,coords)

Return the index where the drop has to be placed.

Parameter Type Description
targetArea Object

a DnD 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 DnD area. Coordinates are basically provided by the getDragPoint method.

Parameter Type Description
areaList Array

a list of DnD areas objects

coords Object

coordinates [x,y] of the dragItem

currentIndexArea integer

an index representing the active DnD area

Returns:any | number

the index of the DnD area

initItems(area)

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

Parameter Type Description
area Object

the DnD 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 DnD 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 intervals between areas to determinate the nearest area to drop an item. Algorithm : the marker should be the vertical line passing by the central point between two contiguous areas. Note: If the page has only one targetArea, it's not necessary to calculate coords.

Parameter Type Description
areaList Array

array of areas

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