Bugs item #762495, was opened at 2003-06-28 20:31
Message generated for change (Settings changed) made by xwisdom
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105757&aid=762495&group_id=5757

Category: DynAPI 3 API
Group: Unverified
Status: Open
>Resolution: Fixed
Priority: 5
Submitted By: Sam Blum (bs_php)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wrong position retured when page has been scrolled down.

Initial Comment:
Reproduced the bug in IE and Mozilla 1.3

To see the effect, open the dynapi example:
examples/dynapi.api.mouseevent.html 
- You should see some colored layers that are cascaded 
in each 
  other in the middle of the page. 
- On the left we have some links to turn mouse-events 
on and off.
- The debugger window should open as well.

The page contains so much info, that a standard scroll-
bar should appear on the right of the browser. If not 
make the browser window less high.

Now do as follows:
A) Turn on the click/dblclick events for the blue layer. 
   This is done by clicking on the 
      "Listen to click/dblclick events -> blue -> on" 
   link (see the page)

B) Then click on the blue layer top left corner and look 
   at the output on the debugger window. It should say 
   something like this: 
   "click blue xy=0,0 pXY=300,200 origin=blue"

   NOTE: 
   xy are the coordinates of the click on the blue layer 
   relative to it's own top left corner. pXY are the 
   absolute coordinates relative to the view (top left 
   corner of the browser).

C) Now scroll down a little and click again on the blue 
   layer (try to hit the same spot). Now in the debugger 
   window look at the result: 
   "click blue xy=0,-148 pXY=300,52 origin=blue"

BUG: 
  Compare the xy result 0,0 and 0,-148. I would have 
  expected to get the same result in case A) and B) 
  for xy (the pXY results are OK). But the y axis has 
  a negative number, caused by the scrolling.
  
  
Side Effect Bug:  
  Next I modified the code and set the red layer 
to 'relative'
  Thus, I added line:  red.setPosition('relative');
  This will position the layers at the bottom of the 
  page. Again try to repeat B) and C) (as good as you 
can) 
  and compare the results:
    "click blue xy=8,496 pXY=308,696 origin=blue"
    "click blue xy=8,396 pXY=308,596 origin=blue"

The effect is the same AND a *side effect* shows up:
alway have an x offset of 8px (13px on IE). But I heard 
that reletive posistioning is problematic.

-- bs_php

----------------------------------------------------------------------

Comment By: Raymond Irving (xwisdom)
Date: 2003-06-30 12:55

Message:
Logged In: YES 
user_id=696242

Hi bs_php,

Bug verified and fixed

I've implemented your fix into the MouseEvent files and it 
seems to have resolve the porblem. Many thanks for this fix.

--
Raymond Irving

----------------------------------------------------------------------

Comment By: Sam Blum (bs_php)
Date: 2003-06-28 23:18

Message:
Logged In: YES 
user_id=308859

This would my suggestion for mouse_dom.js

p.getScrollX = function() {return 
document.body.scrollTop||0};
p.getScrollY = function() {return 
document.body.scrollLeft||0};
p.getX=function() {return (this.x||0)  + this.getScrollX()};
p.getY=function() {return (this.y||0)  + this.getScrollY()};


This would my suggestion for mouse_ie.js
p.getScrollX = function() {return window.pageXOffset||0};
p.getScrollY = function() {return window.pageYOffset||0};
p.getX=function() {return (this.x||0)  + this.getScrollX()};
p.getY=function() {return (this.y||0)  + this.getScrollY()};



----------------------------------------------------------------------

Comment By: Sam Blum (bs_php)
Date: 2003-06-28 22:47

Message:
Logged In: YES 
user_id=308859

OK here is the solution ( I know it' currently a hack) 
=================================
For Mozzila 1.3 in mouse_dom.js replace the lines:

  p.getX = function() {return this.x};
  p.getY = function() {return this.y};

with 

  p.getX_ = function() {
    var _x = this.x||0;
    var _xOffset = 0;
    if (this.ns) {
      _xOffset = document.body.scrollTop||0;
    }else{
      _xOffset = window.pageXOffset||0;
    }
    return _x + _xOffset;
  };
  
  p.getY_ = function() {
    var _y = this.y||0;
    var _yOffset = 0;
    if (this.ns) {
      _yOffset = document.body.scrollLeft||0;
    }else{
      _yOffset = window.pageYOffset||0;
    }
    return _y + _yOffset;
  };


NOTE: I've seen in the code that this.x and this.y are refered 
often directly (not using the getX()-methode) so there may 
more to correct then just the methods  

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105757&aid=762495&group_id=5757


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to