Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/core/DraggableList.js
Show All 37 Lines | events : [ | ||||
'didReceive'], | 'didReceive'], | ||||
properties : { | properties : { | ||||
findItemsHandler: null, | findItemsHandler: null, | ||||
compareHandler: null, | compareHandler: null, | ||||
isDropTargetHandler: null, | isDropTargetHandler: null, | ||||
canDragX: false, | canDragX: false, | ||||
outerContainer: null, | outerContainer: null, | ||||
hasInfiniteHeight: false | hasInfiniteHeight: false, | ||||
compareOnMove: false, | |||||
compareOnReorder: false | |||||
}, | }, | ||||
members : { | members : { | ||||
_root : null, | _root : null, | ||||
_dragging : null, | _dragging : null, | ||||
_locked : 0, | _locked : 0, | ||||
_target : null, | _target : null, | ||||
_targets : null, | _targets : null, | ||||
▲ Show 20 Lines • Show All 441 Lines • ▼ Show 20 Lines | _onmove : function(e) { | ||||
// Compute the size and position of the drop target indicator, because we | // Compute the size and position of the drop target indicator, because we | ||||
// need to update our static position computations to account for it. | // need to update our static position computations to account for it. | ||||
var compare_handler = this.getCompareHandler(); | var compare_handler = this.getCompareHandler(); | ||||
var cur_target = false; | var cur_target = false; | ||||
if (target_list) { | if (target_list) { | ||||
if (compare_handler && (target_list !== this)) { | // Determine if we're going to use the compare handler or not: the | ||||
// compare hander locks items into a specific place in the list. For | |||||
// example, on Workboards, some operations permit the user to drag | |||||
// items between lists, but not to reorder items within a list. | |||||
var should_compare = false; | |||||
var is_reorder = (target_list === this); | |||||
var is_move = (target_list !== this); | |||||
if (compare_handler) { | |||||
if (is_reorder && this.getCompareOnReorder()) { | |||||
should_compare = true; | |||||
} | |||||
if (is_move && this.getCompareOnMove()) { | |||||
should_compare = true; | |||||
} | |||||
} | |||||
if (should_compare) { | |||||
cur_target = target_list._getOrderedTarget(this, this._dragging); | cur_target = target_list._getOrderedTarget(this, this._dragging); | ||||
} else { | } else { | ||||
cur_target = target_list._getCurrentTarget(p); | cur_target = target_list._getCurrentTarget(p); | ||||
} | } | ||||
} | } | ||||
// If we've selected a new target, update the UI to show where we're | // If we've selected a new target, update the UI to show where we're | ||||
// going to drop the row. | // going to drop the row. | ||||
▲ Show 20 Lines • Show All 289 Lines • Show Last 20 Lines |