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 |
From: <do...@cr...> - 2005-08-12 14:32:07
|
Okay.. instead of inserting the background layer the way you are now, What I do is have a div in my html at the location i want my layer, then onload, i use the Inline extension to pull out the position of the relative div in the document, and position my layer accordingly. I can't help but wonder if adding the layer to the dynapi.document (which inserts it in the browser's DOM) then inserting it a second time with your inset call.. try using the FireFox dom inspector (i think it's included, but you may want to DL it from the FF extensions page) once you page is loaded, you can browse through the document's objects to see if your layer is there twice. cheers P.S. Sample code that exhibits the error would be great.. make it much easier to deterine the issue at hand :-) Leif W <war...@us...> said: > > 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 > > > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help > -- |
From: Leif W <war...@us...> - 2005-08-20 19:12:44
|
> From: <do...@cr...> > Sent: 2005 August 12 Friday 10:31 > > Okay.. instead of inserting the background layer the way you are now, > What I > do is have a div in my html at the location i want my layer, then > onload, i > use the Inline extension to pull out the position of the relative div > in the > document, and position my layer accordingly. I tried various combinations of addChild and insert to no avail. The outermost layer gets positioned incorrectly. I'll have to try the inline feature. But I'd really like to understand the problem. I don't think it's doing anything that shouldn't be possible with a fully dynamic layer. Maybe it's a usage thing. But as I'm still learning the API, I can't spot it off hand. > I can't help but wonder if adding the layer to the dynapi.document > (which > inserts it in the browser's DOM) then inserting it a second time with > your > inset call.. try using the FireFox dom inspector (i think it's > included, but > you may want to DL it from the FF extensions page) once you page is > loaded, > you can browse through the document's objects to see if your layer is > there twice. Using Firefox, I saw only one instance of the DIV. I'm wondering perhaps if adding the child and inserting it messes with the box model stuff. I seemed to get a few pixels difference (from 7-20), which might be some CSS border widths of DIV and IMG tags. > P.S. Sample code that exhibits the error would be great.. make it much > easier > to deterine the issue at hand :-) Well, yeah. But without any further input from the user, I can only guess by the erroneous behaviour I see in my test code based upon the user's initial incomplete example. Please note that I did create a bug entry for this so that I would not forget. [ 1257263 ] Events send wrong X/Y coords to relative layers. http://sourceforge.net/tracker/index.php?func=detail&aid=1257263&group_id=5757&atid=105757 |