You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/03/31 07:29:01 UTC

[26/50] [abbrv] incubator-weex git commit: * [html5] fix scroll direction of event.contentOffset.y

* [html5] fix scroll direction of event.contentOffset.y


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7a8f5a53
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7a8f5a53
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7a8f5a53

Branch: refs/heads/0.12-dev
Commit: 7a8f5a53ce1ffbfbf848c14666a8928f8da30c26
Parents: a726be7
Author: MrRaindrop <te...@gmail.com>
Authored: Mon Mar 27 17:09:20 2017 +0800
Committer: MrRaindrop <te...@gmail.com>
Committed: Mon Mar 27 17:09:20 2017 +0800

----------------------------------------------------------------------
 html5/render/vue/mixins/scrollable.js | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7a8f5a53/html5/render/vue/mixins/scrollable.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/mixins/scrollable.js b/html5/render/vue/mixins/scrollable.js
index a55273b..2ed1be4 100644
--- a/html5/render/vue/mixins/scrollable.js
+++ b/html5/render/vue/mixins/scrollable.js
@@ -19,7 +19,19 @@ function getThrottledScroll (context) {
         evt.contentSize = { width: rect.width, height: rect.height }
         evt.contentOffset = {
           x: wrapper.scrollLeft,
-          y: wrapper.scrollTop
+          /**
+           * positive direciton for y-axis is down.
+           * so should use negative operation on scrollTop.
+           *
+           *  (0,0)---------------> x
+           *       |
+           *       |
+           *       |
+           *       |
+           *       v y
+           *
+           */
+          y: -wrapper.scrollTop
         }
         context.$emit('scroll', evt)
       }