Opened 13 years ago

Closed 12 years ago

#1508 closed defect (invalid)

drag&drop wildcard problem

Reported by: cenyongh@… Owned by: psowden
Priority: high Milestone: 0.9
Component: DnD Version: 0.3
Keywords: dnd wildcard Cc:
Blocked By: Blocking:


I want to use the dojo.dnd and make one of my dropTarget to accept any kind of dragSource,my code is look like this


    function init(){
	new dojo.dnd.HtmlDragSource(dojo.byId("src"),'a')
	new dojo.dnd.HtmlDropTarget(dojo.byId("dest"),'*')


But it doesn't work, so i go into the source code of the dragManager and find out the problem maybe in the cacheTargetLocations of dojo.dnd.HtmlDragManager?. Inside this function there is a line of code look like this

    if(!tn || dojo.lang.find(tempTarget.acceptedTypes, this.dragSource.type) < 0){return; }

this code use the dojo.lang.find method to lookup whether dragSource's type is inside the dropTarget list's acceptedTypes, but it didn't consider the wildcart chacter. So i modified this line of code to this

    if(!tn || (dojo.lang.find(tempTarget.acceptedTypes, '*') < 0) && dojo.lang.find(tempTarget.acceptedTypes, this.dragSource.type) < 0){return; }

But i find the code here looks like a little bit redundancy. Because when we start draging, the dragManager's onMouseMove method will get called, then he will call his cacheTargetLocations() method to find out which dropTarget is to be the candidate, then for each dropTarget in the candicate list, its onDragOver() will be get call,and inside the onDragOver() method, it called drogTarget's accepts() method which again make some filter operation based on the acceptTypes.

Change History (3)

comment:1 Changed 13 years ago by dylan

Milestone: 0.4

comment:2 Changed 13 years ago by dylan

Milestone: 0.40.5

comment:3 Changed 12 years ago by Eugene Lazutkin

Resolution: invalid
Status: newclosed

Wildcards were eliminated in 0.9. Types can be specified as an array of strings. Use common types to implement universal targets.

Note: See TracTickets for help on using tickets.