class SAPO.Component.Droppable

requires SAPO.Dom.Event

requires SAPO.Dom.Css

requires SAPO.Utility.Dimensions

requires SAPO.Dom.Element

Accepts draggable elements and executes actions accordingly.

Defined in Component/Droppable/0.1/lib.js

Function Summary
action (Object coords, String type, Object ev, Object draggable)
Method called by a draggable to execute an action on a droppable
add (String|DOMElement element, [Object options])
Makes an element droppable and adds it to the stack of droppable elements
remove (String|DOMElement el)
Removes an element from the droppable stack and removes the droppable behavior
update (String|DOMElement element)
updates location and size of droppable element
invoke every time a drag starts

Function Details

function action

action(Object coords, String type, Object ev, Object draggable)
Method called by a draggable to execute an action on a droppable
Parameters:
coords - coordinates where the action happened
type - type of action. drag or drop.
ev - Event object
draggable - draggable element

function add

add(String|DOMElement element, [Object options])
Makes an element droppable and adds it to the stack of droppable elements
Parameters:
element - target element
[options] - options object
  • [ String hoverclass ] - Classname applied when an acceptable draggable element is hovering the element
  • [ Array|String accept ] - Array or comma separated string of classnames for elements that can be accepted by this droppable
  • [ Function onHover ] - callback called when an acceptable draggable element is hovering the droppable. Gets the draggable and the droppable element as parameters.
  • [ Function onDrop ] - callback called when an acceptable draggable element is dropped. Gets the draggable, the droppable and the event as parameters

function remove

remove(String|DOMElement el)
Removes an element from the droppable stack and removes the droppable behavior
Parameters:
el - target element TODO: is this used at all?!

function update

update(String|DOMElement element)
updates location and size of droppable element
Parameters:
element - target element

function updateAll

updateAll()
invoke every time a drag starts