sorry I didn't really understand that snippet of code - maybe after you've 
looked at what I've done you can say how it relates to what I've done, and 
possibly how I can incorporate it.

I've achieved what I was trying to do, although its probably not the best 
way to do it - and hopefully you guys can point me in the right direction 
so I can get it right.

I've changed "ondrop" and split it into two - ondropSource and 
ondropTarget. With this an event is now triggered if it is the assigned 
"source" or "target" of the drop and you can tell exactly who was the 
"dropped"(source) and who was the "dropped on" (target) - no matter whether 
the event is assigned to the target, or to the source. I've also remove the 
"return" value so that multiple "ondropSource" and "ondropTarget" events 
can fire for different "dropTypes"

As the target layer is not stored if the event is triggered from the 
source, I had to use the "args" column to pass that target object back.

Anyway checkout the code and run the example to understand what I mean - 
try commenting out some of the "ondropSource" and "ondropTarget" events to 
understand how it works. Also notice that you can have different 
"dropTypes" for different handlers. This is handy because you might want 
the target to only fire its event if the source's mouse is in the target - 
but you might want the source to fire if it just overlaps.

hope this makes sense, probably not explaining myself too well.

Mark
PS I've included the changes files in a zip, the mailing list wouldn't 
accept .js attachments this time :(
At 13:07 24/03/2002 +1100, you wrote:
Mark Proctor wrote:

some of my own thoughts:
currently the "drop" event must be defined for every object you might drop 
the source onto. This means that you don't have a drop event that tells you 
the targeting layer, if one hasn't been setup. So I think an event needs to 
be in place for the source that can tell you what the target is whether the 
target has a onDrop listener on not - anyone have any ideas for a good way 
of doing this?

Here's a copy of a drop event listener I just pulled from some old DynaCore 
code (now there's a blast from the past):

    myDrop.ondrop=function(e) {
        me=e.getTarget()
        source=DynAPI.document.dragobject
        me.addChild(source)
    }

The listener is then attached to the required dropzone.

However, if you look into how to implement "simple" events, you could 
attach the above method to the DynLayer.prototype and you will end up with 
a method that is used across ALL dynlayers.

I think grouping would be nice too. While I might setup my ondrop event I 
may only want it to fire for certain layers - or have different onDrop 
events for different targets. So I think it would be nice to an array that 
holds other layers that would fire the event. you can either hold layers, 
or hold groups which contain layers  Does this make sense? Anyone got any 
good ideas on how to implement this?

It is possible to attach the same EventListener to more than one layer. 
Look into this to see how to implement your desired setup.

Another great project would be pixel level detection - although I won't be 
working on this. I think if a bitmap  mask (an array of 1,0 for each pixel 
in the layer) is specified for the source and target it should try to pixel 
level collision detection - this would be great for games - any takers?

You should check out ww.dynacore.net

Pascal has done some amazing this with the DynAPI and DHTML in general.

--
Michael Pemberton
[EMAIL PROTECTED]
ICQ: 12107010






_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/

Attachment: ChangesForDragCode.zip
Description: Zip archive

Reply via email to