new UWA.Controls.Drag.Move(options)
Drag and drop DOM elements in zones. Inherits from Drag.
Drag.Move steps (excludes the 'move' step for simplification):
o
v
start ---> o
|
v
handles
|
v
-----> enter
| __| |__
| | |
| v v
--- leave drop
|__ __| |
| | |
v v |
cancel |
| ___|
| |
v v
stop
v
o
Example
new Drag.Move({
// Constrain the element placement to this zone
container: container,
// Start dragging by clicking on any element matching this selector
delegate: '.moveme, .moveme > *',
// The moving element should be the closest element with the 'moveme' class
handles: function (context) {
return context.target.getClosest('.moveme');
}
});
Parameters
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options hash or a option/value pair. Properties
|
Extends
- UWA.Controls.Drag
Index
Methods
Methods
-
setOptions(Object) → {this}
-
Set the options.
Parameters
Name Type Description Object
options The options to use
Returns
- Type
- this
-
start()
-
Overrides Drag.start. Call callbacks 'start' and 'fixed' to check if we have to start the move process.
-
snap()
-
Overrides Drag.snap. Call the 'handles' callback and initialises the zone and limit caches.
-
refreshCache()
-
Context proof (this method can be called as context.refreshCache). Refresh the zones cache.
-
reset()
-
Overrides the Drag.reset method.
-
stop()
-
Overrides the Drag.stop method. Call the 'drop', 'cancel' and 'stop' callbacks.
-
move()
-
Overrides the Drag.move method. Computes the position of the element, and call the 'leave', 'enter' and 'move' callbacks.
-
setPosition()
-
Set the position of the element, after limiting it with the limits. Populates the 'limit' property.
-
getList(definition) → {Array.<DOMElement>}
-
Get a list of elements based on the type of the parameter. If it is an array, it returns it. If it is a function, calls it and return the results. If it is a string, consider it as a CSS selector to be run within the 'root' element.
Parameters
Name Type Description definition
Array | Function | String Some elements to consider.
Returns
A list of dom elements.
- Type
- Array.<DOMElement>
-
call(name, arg)
-
Invoke a callback if it is defined
Parameters
Name Type Description name
String The name of the callback
arg
Array The parameters to pass to the callback
Returns
The result of the callback
-
refreshPlaceholderCache()
-
Refreshes the placeholder cache
-
placePlaceholder()
-
Put the placeholder between the elements contained in the current zone.