From: Leif W <war...@us...> - 2005-08-12 02:45:06
|
> From: "Leif W" <war...@us...> > Sent: 2005 August 11 Thursday 14:18 > >> From: "Bob Jamison" <bob...@gr...> >> Sent: 2005 August 11 Thursday 13:41 > > I think I understand now. Click somewhere on bg1 and have lyr1 move > there. Centered lyr1 around the point you clicked? And then what > happens? Continue to drag without lifting the button and clicking > lyr1 to initiate a drag event? I've never done that, but I would > guess I'd add an onclick event listener to bg1, and have that handler > move bg1, centered, and attempt to invoke a drag event on bg1. I'd > probably have a delay between the move and the drag, maybe half second > or quarter second. Well, I haven't had the big breakthrough I was hoping for, but I did make some observations. 1) Onclick you can think of like two events: onmousedown and onmouseup. Therefore, a click event does not happen until the mouse comes back up. So you can't use a single click to pull a layer to the mouse and drag, if you use onclick event. So, use onmousedown event. Which leads to the second observation. 2) I think I see now what you might be experiencing. When setting up a background layer, adding to that a layer with a photograph, and adding to that a layer that you move around (fetch and drag), then there's a problem. The onmousedown event is passing the X and Y coordinates +8 or +9 or so. The upper left corner of the fetched layer stops to the 8 or 9 pixels to the lower right of the cursor. Therefore you can never connect with a drag event. If I remove the relative insert later in the document, the upper left corner of the fetched layer comes to a stop precisely underneath the mouse cursor. It's hard to know the intent without having a precise yet simplified example of how the code needs to fit together in the end. I can only guess something like you'll have some text or images or other layers, then you'll want to relatively insert this background layer, with it's photo and it's fetchable/draggable layer. You won't know ahead of time how to precisely position the layer on the page, so everything must be done relative to the background layer. Maybe there's another way to do things? I'm still learning myself. I definitely would like to understand where the offset is coming from. I might have a hunch about some thing. Anyways I'll submit a bug with my above observations so it will not be forgotten. Leif |