Well that points me to other issues I see with the DragEvent right now.

In dynapi2, there was a test in DragEvent.onmousemove to check wether the mouse had moved since the mousedown to make sure it's a drag. I'm afraid if we don't do that it might be difficult to have a layer that both shows a selection and accept drag events, like the list I was mentioning. So in that scenario, I can't use

onmousedown : function(e){
DragEvent.startDrag(e,lyrFake);
};

otherwise, I wouldn't be able to make the difference between a mousedown/up for a selection, and a drag session.


The other thing I added to the DragEvent.onmousedown is a detection if the mousedown happened in a form element. If it does, then I just return. I saw something in MouseEvent._eventHandler about it, but I'm not sure if that's enough ? Here's the code I'm using :

DragEvent.lyrListener.onmousedown=function(e) {

//fix to allow forms in draggable layers to select text.
if (is.def&&e.orig) {
var tn = is.ie? e.orig.srcElement.tagName : e.orig.target.tagName;
var ctn = is.ie? e.orig.srcElement.tagName :e.orig.currentTarget.tagName;
if (tn=="INPUT" || tn=="TEXTAREA") {
return;
}
else if (ctn =="INPUT" || ctn =="TEXTAREA") {
return;
}
}

if(e.formElement) return;

......

The last thing I've added is the ability to restrict "dragability" to a certain area of a layer. I've used a DynArea object to represent circles and rectangles that both implemented

isWithinArea(x,y)

Then in DragEvent.onmnouse down , before initializing the dragevent, I added:

// check if event occured within one of the areas (if any)
if (lyr.dragAreas && ! lyr.isWithinArea(e.getPageX()-lyr.getPageX(), e.getPageY()-lyr.getPageY())) {
return;
}

I looked at the Shapes object and we could use this instead of the DynArea which doesn't much. let me know if you want the code.

I still needs that capability. There's one thing I didn't do but that I thought about is to be able to have special parts of the layer where a drag session would mean a resize of the layer rather than a move. Using the concept of areas with a special meaning like addResizeAreas() and keep an array of that, that code could be added to the dragevent.

At last, a comment on the code. I saw in tipstricks.html in the doc section, that it's mentioned to avoid to do for (var and instead use an external variable declaration, I'm not sure why, but it's supposed to be faster to use

var i=iter-1;
do {} while (i--);

than

var i;
for (i=iter;i>0;i--)

Shall we pay attention to that right now ?

Benoit

On Monday, February 24, 2003, at 02:49 PM, Raymond Irving wrote:

--- Benoit Marchant <[EMAIL PROTECTED]> wrote:
I would like to improve the DynLayer_inline, yes. As
CVS goes, I
created a user on sourceforge, but I need a
developer status to push
stuff back in cvs, right ? Who should I ask to get
that ?

Go here to contact Jordi Ministral:
http://sourceforge.net/users/dodoron/


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.

Ok

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);

Why not do the following:

onmousedown : function(e){
DragEvent.startDrag(e,lyrFake);
};


--
Raymond Irving

__________________________________________________
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]/

Reply via email to