You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ta...@apache.org on 2017/05/25 02:46:09 UTC
[27/50] incubator-weex git commit: * [html5] rm Math.sign since it's
not compatilble with some android devices.
* [html5] rm Math.sign since it's not compatilble with some android devices.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6b620c61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6b620c61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6b620c61
Branch: refs/heads/0.13-dev
Commit: 6b620c617b0d762c4481afe74223bd30eab42718
Parents: 65df9b6
Author: MrRaindrop <te...@gmail.com>
Authored: Mon May 15 11:45:11 2017 +0800
Committer: MrRaindrop <te...@gmail.com>
Committed: Mon May 15 11:45:11 2017 +0800
----------------------------------------------------------------------
html5/render/vue/components/slider/slideMixin.js | 3 ++-
html5/render/vue/utils/style.js | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6b620c61/html5/render/vue/components/slider/slideMixin.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/components/slider/slideMixin.js b/html5/render/vue/components/slider/slideMixin.js
index 314a377..154ed45 100644
--- a/html5/render/vue/components/slider/slideMixin.js
+++ b/html5/render/vue/components/slider/slideMixin.js
@@ -45,7 +45,8 @@ export default {
const newIndex = this.normalizeIndex(index)
const inner = this.$refs.inner
const step = this._cells.length <= 1 ? 0 : this.currentIndex - index
- this.innerOffset += Math.sign(step) * this.wrapperWidth
+ const sign = step === 0 ? 0 : step > 0 ? 1 : -1
+ this.innerOffset += sign * this.wrapperWidth
if (inner) {
// const match = (inner.style.transform || inner.style.webkitTransform).match(/(\d+)px/)
// const currentOffset = parseFloat(match[1])
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6b620c61/html5/render/vue/utils/style.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/style.js b/html5/render/vue/utils/style.js
index 65e94f2..c4f7d18 100644
--- a/html5/render/vue/utils/style.js
+++ b/html5/render/vue/utils/style.js
@@ -76,7 +76,8 @@ function getUnitScaleMap () {
function limitScale (val, limit) {
limit = limit || 1
- return Math.abs(val) > limit ? val : Math.sign(val) * limit
+ const sign = val === 0 ? 0 : val > 0 ? 1 : -1
+ return Math.abs(val) > limit ? val : sign * limit
}
function parseScale (val: number, unit: string): string {