Giter Club home page Giter Club logo

Comments (5)

waldbaerkoch avatar waldbaerkoch commented on July 21, 2024

My changes:

(function () {
    'use strict';
...
/* #29 */
var _isAndroidNative2_3 = (/Linux;\s+U;\s+Android\s+2\.3/).test(navigator.userAgent);
var _noTranslate = _isAndroidNative2_3;
...
    // Create a global stylesheet to set up stylesheet rules and track dynamic entries
    (function () {
...
        // Determine the hardware acceleration logic to use
        if (_useToggleableHardwareAcceleration) {
            hardwareAccelerationRule = _vendorCSSPrefix + 'transform-style: preserve-3d;';
        } else {
            hardwareAccelerationRule = _vendorCSSPrefix + 'transform: translateZ(0);';
        }
/* #29 */
if (_noTranslate) {
    hardwareAccelerationRule = '';
}
...
        // Override default and global options with supplied options
        if (options) {
...
        }
/* #29 */
if (_noTranslate) {
    _instanceOptions.scrollbars = false;
}
...
        _updateElementPosition = function _updateElementPosition() {
            var axis, computedStyle, splitStyle;

            // Retrieve the current position of each active axis.
            // Custom parsing is used instead of native matrix support for speed and for
            // backwards compatibility.
            for (axis in _scrollableAxes) {
                if (_scrollableAxes.hasOwnProperty(axis)) {
/* #29 */
if (_noTranslate) {
    var _prop = _noTranslate ? (axis === 'y' ? 'top' : 'left') : _vendorTransformLookup;
    computedStyle = window.getComputedStyle(_scrollNodes[axis], null)[_prop];
    _baseScrollPosition[axis] = parseInt(computedStyle.substr(0, computedStyle.length - 2));
} else {
                    computedStyle = window.getComputedStyle(_scrollNodes[axis], null)[_vendorTransformLookup];
                    splitStyle = computedStyle.split(', ');

                    // For 2d-style transforms, pull out elements four or five
                    if (splitStyle.length === 6) {
                        _baseScrollPosition[axis] = parseInt(splitStyle[(axis === 'y') ? 5 : 4], 10);

                    // For 3d-style transforms, pull out elements twelve or thirteen
                    } else {
                        _baseScrollPosition[axis] = parseInt(splitStyle[(axis === 'y') ? 13 : 12], 10);
                    }
}
                    _lastScrollPosition[axis] = _baseScrollPosition[axis];
                }
            }
        };
...
        _setAxisPosition = function _setAxisPosition(axis, position, animationDuration, animationBezier, boundsCrossDelay) {
...
            // Determine the transition property to apply to both the scroll element and the scrollbar
            if (animationDuration) {
                if (!animationBezier) {
                    animationBezier = _kFlingTruncatedBezier;
                }

/* #29 */
if (_noTranslate) {
    transitionCSSString = (axis === 'y' ? 'top' : 'left') + ' ' + animationDuration + 'ms ' + animationBezier.toString();
} else {
                transitionCSSString = _vendorCSSPrefix + 'transform ' + animationDuration + 'ms ' + animationBezier.toString();
}
            } else {
                transitionCSSString = '';
            }
...
            // Update the positions
/* #29 */
if (_noTranslate) {
    _scrollNodes[axis].style[axis === 'y' ? 'top' : 'left'] = position + 'px';
} else {
            _scrollNodes[axis].style[_transformProperty] = _translateRulePrefix + _transformPrefixes[axis] + position + 'px' + _transformSuffixes[axis];
}

I disabled scrollbars for the top/left mode.

from ftscroller.

waldbaerkoch avatar waldbaerkoch commented on July 21, 2024

Partly same problem on Android 2.2*: opening keyboard for text input is ok with FTScroller, but opening the options picker for select doesn't work. It does however with the top/left mode.

from ftscroller.

rowanbeentje avatar rowanbeentje commented on July 21, 2024

@waldbaerkoch Aha, we ran into this one too, and it's probably something I should create an explicit example (and documentation) for. Is this on a Samsung device, specifically?

There's already a bit of code to try and handle this, but it does require some external handling. Older, possibly problematic browsers are detected and rather than using a translate3d(), a translate() is used - and an additional style rule, namely transform-style: preserve-3d, is used to trigger hardware acceleration. The great thing about transform-style is that it can be disabled in CSS, even dynamically.

So, step one, see if disabling hardware acceleration fixes the problem for you by adding this to a stylesheet (hacked with !important just to test with):
.ftscroller_hwaccelerated { -webkit-transform-style: flat !important }
That effectively disables hardware acceleration on older platforms. The advantage of using this rather than the left/top solution is that for a software transform the browser still has to do much less work - no invalidations to worry about.

(The other good thing about the CSS approach is that it can be toggled dynamically, so hardware acceleration can be used in areas not containing forms, or the classes can be added and removed while running just to enable interactions when needed.)

Let me know if that addresses it...

from ftscroller.

waldbaerkoch avatar waldbaerkoch commented on July 21, 2024

I tested with Android native browsers on

  • Samsung: GT-I9000 (2.3, 2.3.3), GT-I9100 (2.3.6), GT-N7000 (2.3.5), GT-P1000 (2.2)
  • HTC: ChaCha (2.3.3), Desire (2.2, 2.2.2), Legend (2.2), Wildfire (2.2.1)
  • Huawei: U8510 (2.3.3)
  • SonyEricsson: R800 (2.3.2), LT26i (2.3.7), U20i (2.3.7)
  • Dell: Streak (2.2)
  • Motorola: MB632 (2.3.5)
  • Kyocera: M9300 (2.2.1)
  • LG: P970 (2.2.2)

All have at least one of the issues.

I'll try your suggestion regarding transform-style...

from ftscroller.

waldbaerkoch avatar waldbaerkoch commented on July 21, 2024
.ftscroller_hwaccelerated { -webkit-transform-style: flat !important }

doesn't really help. In some browser/device combinations the problem relates to form controls that are visible without scrolling, in some other it relates to controls that are visible after scrolling.

from ftscroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.