Please feel free to rename it to _applyImageEventDragHandler() and adapt it to dynapi3 and test it.
I have to play a little with dynapi3 and move a bunch of stuff ot it to get used to the new structure.
I wanted to mention something I did with the dragevent that I'll need to port over.
What I needed was to be able to move a cell in a list to another list.
For optimization reasons, I didn't want each of the cell to be dynalyers, so all dragevents are handled at the list level.
The trick I did was to have a "dragging cell" dynlayer with the same parent as the 2 lists. So what I did is basically :
dragstart on list 1,
findout what cell that was on,
configure the "dragging cell" to looks like that cell,
replace the dragevent.src from list1 to "dragging cell",
and when the drop happens, do whatever is needed.
I tried removing and adding layers on the fly, which should work, but I had serious issues with some browsers that led me to this solution. Plus the fact that each cell aren't dynlayers which makes a significant difference in performances. And that I needed to ba able to drag several layers in the same time.
What needs to happens is after the dragevent.src is changed, then de.parentPageX and de.parentPageY needs to be re evaluated for the new layer to be dragged.
So we could jut move
de.parentPageX = dlyr.parent.getPageX();
de.parentPageY = dlyr.parent.getPageY();
after
dlyr.invokeEvent("dragstart",de);
so within ondragstart, the layer could to the trick, as long that invokeEvent is a blocking call, which I think it is.
I found this web page about javascript optimizations, there's some interresting stuff there, most not really javascript specific.
http://home.earthlink.net/~kendrasg/info/js_opt/
Benoit
On Monday, February 24, 2003, at 11:34 AM, Raymond Irving wrote:
Nice work Benoit!
The dynlayer_ie.js and dynlayer_opera.js files had a
fix to this problem, but I think your solution will
work just fine for all browsers. I would however call
the function ._applyImageEventDragHandler()
Are your change making their way into CVS?
Are you the person working on the DynLayer_inline
module?
--
Raymond Irving
--- Benoit Marchant <[EMAIL PROTECTED]> wrote:
I fixed this issue by callinghttp://www24.brinkster.com/dyntools/next/examples/demo.dragover.html
this.applyDomImageEventWorkaround(). It
will basically respect any custom event handler on
the image if any
exists.
It needs to be called after each setHTML, and when
you map a dynlayer
to an inline div with something like getInline .
I was tired of doing this by hand all the time !
Is DynMouseEvent.EventMethod now
MouseEvent._eventHandler ?
domImageWorkaround = function(event) {
DynMouseEvent.EventMethod(event);
return false;
}
DynLayer.prototype.applyDomImageEventWorkaround =
function() {
if(is.dom && !is.ie) {
var images =
this.elm.getElementsByTagName("img");
for (var j=0;j<images.length; j++) {
var image = images[j];
image.lyrobj = this;
if((typeof(image.onmousedown) ==
"undefined") ||
(typeof(image.onmousedown) != "function"))
{
image.onmousedown = domImageWorkaround;
}
if((typeof(image.onmouseup) ==
"undefined") ||
(typeof(image.onmouseup) != "function"))
{
image.onmouseup = domImageWorkaround;
}
}
}
}
That probbaly should be included in dynapi as it's
really annoying.
Benoit
On Sunday, February 23, 2003, at 06:19 PM, Dan
Willemsen wrote:
One thing that I noticed while looking at the demowas, that sometimes,
in Mozilla 1.0.1(Linux), mozilla picks up its owndrag-and-drop code,
trying to drag the image, while interuptingdynapi's drag and drop
functions. I don't see a way to fix this, unlessthere is a handle in
the mozilla code somewhere to disable image drags,that can be accessed
via javascript.object.
Just my two cents.
Dan W
On Sun, 2003-02-23 at 19:49, Raymond Irving wrote:
Hello Everyone,
I've added a few new events to the DragEvent
they are as follows:
ondrop, ondragover and ondragout
You can see a live demo here:
http://www24.brinkster.com/dyntools/next/dynapi3x.zipand you can download the changes here:
-------------------------------------------------------codeQuestions:
-----------
1) Should we leave the ondrop, ondragover, etc
intoinside the dragevent.js? Or should we move it
mode?dragdrop?
2) What do you think about the drag-over stealth
__________________________________________________Any other comments?
--
Raymond Irving
moreDo you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips,
http://taxes.yahoo.com/
http://www.mail-archive.com/[EMAIL PROTECTED]/Develop an edge.This SF.net email is sponsored by: SlickEdit Inc.
you can use.The most comprehensive and flexible code editor
more. FREE 30-Day Trial.Code faster. C/C++, C#, Java, HTML, XML, many
www.slickedit.com/sourceforge
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
---------------------------------------------------------
Dan Willemsen <[EMAIL PROTECTED]>
http://www.mail-archive.com/[EMAIL PROTECTED]/This SF.net email is sponsored by: SlickEdit Inc.Develop an edge.
The most comprehensive and flexible code editoryou can use.
Code faster. C/C++, C#, Java, HTML, XML, manymore. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/