diff options
author | Henrik Paul <henrik@vaadin.com> | 2014-08-13 16:26:02 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-08-14 12:19:39 +0000 |
commit | 2caaea2df9d558f0ce67daa3b0641cb832538506 (patch) | |
tree | abb359b4b57d32dd60b6609e9b7ba386c5bd22ee | |
parent | 29ba49ae9fee593f7b4696c7cbf1c8cb1963291d (diff) | |
download | vaadin-framework-2caaea2df9d558f0ce67daa3b0641cb832538506.tar.gz vaadin-framework-2caaea2df9d558f0ce67daa3b0641cb832538506.zip |
Stopping scrollbars from obscuring cell click events (#13334)
Change-Id: I8191b468563b7b91d5663d6d1289d813b21193bc
-rw-r--r-- | client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java b/client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java index 60b6fa27a3..59583dcfec 100644 --- a/client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java +++ b/client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java @@ -24,6 +24,9 @@ import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.EventListener; +import com.google.gwt.user.client.Timer; /** * An element-like bundle representing a configurable and visual scrollbar in @@ -36,6 +39,22 @@ import com.google.gwt.user.client.DOM; */ abstract class ScrollbarBundle { + private class TemporaryResizer extends Object { + private static final int TEMPORARY_RESIZE_DELAY = 1000; + + private final Timer timer = new Timer() { + @Override + public void run() { + internalSetScrollbarThickness(1); + } + }; + + public void show() { + internalSetScrollbarThickness(OSX_INVISIBLE_SCROLLBAR_FAKE_SIZE_PX); + timer.schedule(TEMPORARY_RESIZE_DELAY); + } + } + /** * A means to listen to when the scrollbar handle in a * {@link ScrollbarBundle} either appears or is removed. @@ -248,8 +267,17 @@ abstract class ScrollbarBundle { @Deprecated private HandlerManager handlerManager; + private TemporaryResizer invisibleScrollbarTemporaryResizer = new TemporaryResizer(); + private ScrollbarBundle() { root.appendChild(scrollSizeElement); + Event.sinkEvents(root, Event.ONSCROLL); + Event.setEventListener(root, new EventListener() { + @Override + public void onBrowserEvent(Event event) { + invisibleScrollbarTemporaryResizer.show(); + } + }); } protected abstract int internalGetScrollSize(); @@ -352,6 +380,10 @@ abstract class ScrollbarBundle { scrollPos = Math.max(0, Math.min(maxScrollPos, truncate(px))); if (!pixelValuesEqual(oldScrollPos, scrollPos)) { + if (isInvisibleScrollbar) { + invisibleScrollbarTemporaryResizer.show(); + } + /* * This is where the value needs to be converted into an integer no * matter how we flip it, since GWT expects an integer value. @@ -485,8 +517,7 @@ abstract class ScrollbarBundle { */ public final void setScrollbarThickness(int px) { isInvisibleScrollbar = (px == 0); - internalSetScrollbarThickness(px != 0 ? Math.max(0, px) - : OSX_INVISIBLE_SCROLLBAR_FAKE_SIZE_PX); + internalSetScrollbarThickness(Math.max(1, px)); } /** |