nikhilbchilwant / google-web-toolkit-incubator

Automatically exported from code.google.com/p/google-web-toolkit-incubator
1 stars 1 forks source link

SliderBar broken when browser window has horizontal scroll #248

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of gwt and gwt-incubator are you using?
gwt-1.5.3

What OS and browser are you using?
tested on firefox 3 and ie6

Do you see this error in hosted mode, web mode, or both?
both

(If possible, please include a test case that shows the problem)
1) Display the slider at the right sidebar of a page
2) Reduce the size of the browser window to a width smaller than the page width
3) Move the slider thumb.  It will move with a wrong offset.

Workaround if you have one:

To fix this problem, replace the first line of the method:
private void slideKnob(Event event)

Replace:
    int x = DOM.eventGetClientX(event);
By:
    int x = DOM.eventGetClientX(event) + Window.getScrollLeft();

Original issue reported on code.google.com by ofr...@gmail.com on 11 Mar 2009 at 3:46

GoogleCodeExporter commented 8 years ago
Sorry, a step is missing:

2.5) Horizontally scroll the browser window to the right

Original comment by ofr...@gmail.com on 11 Mar 2009 at 3:49

GoogleCodeExporter commented 8 years ago
I found this as well.  There is an easy fix.  In slideKnob(), you need to add 
the
scroll position to x.

      int scrollX = Window.getScrollLeft();
      double percent = (double) (x + scrollX - lineLeft) / lineWidth * 1.0;

(There maybe some error handling you should do as well here, but I'm not sure 
how
getScrollLeft fails or doesn't.)

DOM.eventGetClientX(event) returns coordinates in terms of the visible window, 
not in
terms of the entire document.

Original comment by duckyshe...@gmail.com on 13 Nov 2009 at 6:24