Enabled a type of calcul for Dnd. Default class to find the nearest target.
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 |
true if the dragNode is in interval
update the DnD area object (i.e. update coordinates of its DOM node)
Parameter | Type | Description |
---|---|---|
area | Object | the DnD area |
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 |
a sorted area
return coordinates of the draggable item
return for:
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 |
an object of coordinates example : {'x':10,'y':10}
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 |
a number or -1 if the area has no children or the drop index represents the last position in to the area
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 |
the index of the DnD area
initialize the horizontal line in order to determinate the drop zone.
Parameter | Type | Description |
---|---|---|
area | Object | the DnD area |
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 |
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 |