gwtquery icon indicating copy to clipboard operation
gwtquery copied to clipboard

GQUERY Animated scrollPanel onLeft

Open paulux84 opened this issue 10 years ago • 10 comments

Hi, i use this instruction to slide an HorizontalScrollPanel scrollPanel.getHorizontalScrollbar().setHorizontalScrollPosition(scrollPanel.getHorizontalScrollbar().getHorizontalScrollPosition()-200);

I'd like to animate this slide with GQWERY but:

GQuery scrollPanelElem = jquerySelector.getScrollPanel(); scrollPanelElem.animate("opacity:'0'", 500); //it works GWT.log("int "+scrollPanelElem.scrollLeft()); //it doesn't work scrollPanelElem.scrollLeft(200); //it doesn't work, return always 0 scrollPanelElem.animate("scrollLeft: '200'",500, EasingCurve.swing); //it doesn't work

paulux84 avatar Jul 18 '14 12:07 paulux84

What happens if you set at the beginning of you program FX.css3 = false ?

On Fri, Jul 18, 2014 at 2:08 PM, paulux84 [email protected] wrote:

Hi, i use this instruction to slide an HorizontalScrollPanel

scrollPanel.getHorizontalScrollbar().setHorizontalScrollPosition(scrollPanel.getHorizontalScrollbar().getHorizontalScrollPosition()-200);

I'd like to animate this slide with GQWERY but:

GQuery scrollPanelElem = jquerySelector.getScrollPanel(); scrollPanelElem.animate("opacity:'0'", 500); //it works GWT.log("int "+scrollPanelElem.scrollLeft()); //it doesn't work scrollPanelElem.scrollLeft(200); //it doesn't work, return always 0 scrollPanelElem.animate("scrollLeft: '200'",500, EasingCurve.swing); //it doesn't work

— Reply to this email directly or view it on GitHub https://github.com/gwtquery/gwtquery/issues/295.

manolo avatar Jul 18 '14 17:07 manolo

Absolutely nothing! scrollPanelElem.scrollLeft() return always '0' and scollPanelElem no scroll on left

paulux84 avatar Jul 21 '14 08:07 paulux84

Could you tell me on which browsers you get the problem ? What is your GWT version ?

jDramaix avatar Jul 21 '14 09:07 jDramaix

Browser: Chrome Versione 36.0.1985.125 GWT: 2.6.1

paulux84 avatar Jul 21 '14 09:07 paulux84

out of curiosity: Do you have the same problem on firefox ?

On Mon, Jul 21, 2014 at 11:21 AM, paulux84 [email protected] wrote:

Browser: Chrome Versione 36.0.1985.125 GWT: 2.6.1

— Reply to this email directly or view it on GitHub https://github.com/gwtquery/gwtquery/issues/295#issuecomment-49585798.

jDramaix avatar Jul 21 '14 09:07 jDramaix

In fact, I bet your problem is linked to this issue in GWT: https://gwt-review.googlesource.com/#/c/7764/

This issue is fixed and the fix will be available in GWT 2.7. You could test with the nightly build of gwt in order to ensure that it works fine with the last version of GWT

jDramaix avatar Jul 21 '14 09:07 jDramaix

Also on Firefox, this code:

GQuery scrollPanelElem = jquerySelector.getScrollPanel(); Window.alert("int "+scrollPanelElem.scrollLeft());

return '0' in a window alert.

paulux84 avatar Jul 21 '14 10:07 paulux84

Have you any others solutions or workaround?

paulux84 avatar Jul 24 '14 14:07 paulux84

In fcat the animation of a property doesn't seem to work anymore. Please find below the code I've written to animate the scrollTop of an element.

public class ScrollTopAnimation extends Animation {
        private Element element;
        private int start;

        private ScrollTopAnimation(Element element) {
            this.element = element;
        }

        @Override
        protected void onStart() {
            start = element.getScrollTop();
            super.onStart();
        }

        @Override
        protected void onUpdate(double progress) {
            double value = start - start * progress;
            element.setScrollTop((int) value);
        }

        @Override
        protected double interpolate(double progress) {
            return EasingCurve.easeInOut.interpolate(progress);
        }
    }

and I use it like this:

new ScrollTopAnimation(element).run(400);

jDramaix avatar Jul 25 '14 14:07 jDramaix

You have to modify the line: double value = start - start * progress; to achieve what you want (for my part the goal of this animation was to set the scrollTop to 0)

jDramaix avatar Jul 25 '14 14:07 jDramaix