Changeset 14257 for dojo/trunk/dnd
- Timestamp:
- 07/03/08 15:50:20 (5 months ago)
- Location:
- dojo/trunk/dnd
- Files:
-
- 2 modified
-
Selector.js (modified) (2 diffs)
-
Source.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dojo/trunk/dnd/Selector.js
r14154 r14257 18 18 // node: Node: node or node's id to build the selector on 19 19 // params: Object: a dict of parameters, recognized parameters are: 20 // singular: Boolean: allows selection of only one element, if true 21 // the rest of parameters are passed to the container 20 // singular: Boolean 21 // allows selection of only one element, if true 22 // the rest of parameters are passed to the container 23 // autoSync: Boolean 24 // autosynchronizes the source with its list of DnD nodes, 25 // false by default 22 26 if(!params){ params = {}; } 23 27 this.singular = params.singular; 28 this.autoSync = params.autoSync; 24 29 // class-specific variables 25 30 this.selection = {}; … … 152 157 // summary: event processor for onmousedown 153 158 // e: Event: mouse event 159 if(this.autoSync){ this.sync(); } 154 160 if(!this.current){ return; } 155 161 if(!this.singular && !dojo.dnd.getCopyKeyState(e) && !e.shiftKey && (this.current.id in this.selection)){ -
dojo/trunk/dnd/Source.js
r14158 r14257 43 43 // true by default, works only if copyOnly is true 44 44 // withHandles: Boolean? 45 // allows dragging only by handles 45 // allows dragging only by handles, false by default 46 46 this.isSource = isSource; 47 47 this.accept = accept; 48 48 this.horizontal = horizontal; 49 49 this.copyOnly = copyOnly; 50 this.selfCopy = selfCopy; 51 this.selfAccept = selfAccept; 50 52 this.withHandles = withHandles; 51 53 } … … 63 65 skipForm: false, 64 66 withHandles: false, 67 autoSync: false, 65 68 accept: ["text"], 66 69 … … 238 241 // nodes: Array: the list of transferred items 239 242 // copy: Boolean: copy items, if true, move items otherwise 243 if(this.autoSync){ this.sync(); } 240 244 if(this.isSource){ 241 245 this._changeState("Source", this == source ? (copy ? "Copied" : "Moved") : ""); … … 464 468 } 465 469 }); 470 471 dojo.declare("dojo.dnd.AutoSource", dojo.dnd.Source, { 472 // summary: a source, which syncs its DnD nodes by default 473 474 constructor: function(node, params){ 475 // summary: a constructor of the AutoSource --- see the Source constructor for details 476 this.autoSync = true; 477 }, 478 479 // markup methods 480 markupFactory: function(params, node){ 481 params._skipStartup = true; 482 return new dojo.dnd.AutoSource(node, params); 483 } 484 });