[KSS-checkins] r37102 - kukit/kss.core/branch/gotcha-late-binding/plugins/draganddrop/browser
reebalazs at codespeak.net
reebalazs at codespeak.net
Sun Jan 21 19:22:58 CET 2007
Author: reebalazs
Date: Sun Jan 21 19:22:57 2007
New Revision: 37102
Modified:
kukit/kss.core/branch/gotcha-late-binding/plugins/draganddrop/browser/kss_dragdrop.js
Log:
Make draganddrop reusing the kss binding registry.
I only did the minimal changes. Obviously futher refactoring and simplification will be possible.
Modified: kukit/kss.core/branch/gotcha-late-binding/plugins/draganddrop/browser/kss_dragdrop.js
==============================================================================
--- kukit/kss.core/branch/gotcha-late-binding/plugins/draganddrop/browser/kss_dragdrop.js (original)
+++ kukit/kss.core/branch/gotcha-late-binding/plugins/draganddrop/browser/kss_dragdrop.js Sun Jan 21 19:22:57 2007
@@ -1,34 +1,24 @@
kukit.draganddrop = {};
kukit.draganddrop.DragAndDropEvent = function() {
- this.boundDraggables = [];
- this.boundDroppables = [];
};
-kukit.draganddrop.DragAndDropEvent.prototype.isNotBoundDraggable = function(node) {
- for (var index = 0; index < this.boundDraggables.length; index += 1) {
- if (node == this.boundDraggables[index]) {
- return false;
- }
- }
- return true;
+kukit.draganddrop.DragAndDropEvent.prototype.isNotBoundDraggable = function(oper) {
+ return ! (oper.getBindingForNode(this, 'drop', oper.node) ||
+ oper.getBindingForNode(this, 'hover', oper.node));
};
-kukit.draganddrop.DragAndDropEvent.prototype.isNotBoundDroppable = function(node) {
- for (var index = 0; index < this.boundDroppables.length; index += 1) {
- if (node == this.boundDroppables[index]) {
- return false;
- }
- }
- return true
+kukit.draganddrop.DragAndDropEvent.prototype.isNotBoundDroppable = function(oper) {
+ return ! (oper.getBindingForNode(this, 'drag', oper.node) ||
+ oper.getBindingForNode(this, 'start', oper.node) ||
+ oper.getBindingForNode(this, 'end', oper.node));
};
kukit.draganddrop.DragAndDropEvent.prototype.__bind_drop__ = function(name, func_to_bind, oper) {
// validate and set parameters
oper.completeParms([], {}, 'dad-drop event binding');
self = this;
- if (this.isNotBoundDroppable(oper.node)) {
- this.boundDroppables.push(oper.node);
+ if (this.isNotBoundDroppable(oper)) {
var options = {
onDrop : this.__make_func_to_bind__('drop', oper.node),
onHover: this.__make_func_to_bind__('hover', oper.node)
@@ -41,8 +31,7 @@
kukit.draganddrop.DragAndDropEvent.prototype.__bind_drag__ = function(name, func_to_bind, oper) {
// validate and set parameters
oper.completeParms([], {}, 'dad-drag event binding');
- if (this.isNotBoundDraggable(oper.node)) {
- this.boundDraggables.push(oper.node);
+ if (this.isNotBoundDraggable(oper)) {
var options = {
onDrag : this.__make_func_to_bind__('drag', oper.node),
onStart : this.__make_func_to_bind__('start', oper.node),
More information about the Kukit-checkins
mailing list