ArcBees / gwtquery

A jQuery clone for GWT, and much more.
MIT License
85 stars 38 forks source link

GQUERY Animated scrollPanel onLeft #295

Open paulux84 opened 10 years ago

paulux84 commented 10 years ago

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

manolo commented 10 years ago

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

On Fri, Jul 18, 2014 at 2:08 PM, paulux84 notifications@github.com 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.

paulux84 commented 10 years ago

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

jDramaix commented 10 years ago

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

paulux84 commented 10 years ago

Browser: Chrome Versione 36.0.1985.125 GWT: 2.6.1

jDramaix commented 10 years ago

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

On Mon, Jul 21, 2014 at 11:21 AM, paulux84 notifications@github.com 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 commented 10 years ago

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

paulux84 commented 10 years ago

Also on Firefox, this code:

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

return '0' in a window alert.

paulux84 commented 10 years ago

Have you any others solutions or workaround?

jDramaix commented 10 years ago

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 commented 10 years ago

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)