Revert "* [ios] fix bugs about transform's parse problem" This reverts commit 66f4e8fd27a954c1cfb4a9966415e7de81956bde.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/4e534a49 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/4e534a49 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/4e534a49 Branch: refs/heads/master Commit: 4e534a491c5f8e8a6e1dc5ae91c6f52ea9eb4fe1 Parents: b0ce55f Author: acton393 <zhangxing610...@gmail.com> Authored: Fri Nov 17 00:31:38 2017 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Fri Nov 17 00:31:38 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Component/WXTransform.m | 31 +++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4e534a49/ios/sdk/WeexSDK/Sources/Component/WXTransform.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m b/ios/sdk/WeexSDK/Sources/Component/WXTransform.m index 60c3e3f..9e5c362 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXTransform.m @@ -312,6 +312,7 @@ } } } + _originX = [WXLength lengthWithFloat:originX type:typeX]; _originY = [WXLength lengthWithFloat:originY type:typeY]; } @@ -345,7 +346,7 @@ } } -- (void)parseTranslatex:(NSArray *)value +- (void)parseTranslate:(NSArray *)value { WXLength *translateX; double x = [value[0] doubleValue]; @@ -355,20 +356,30 @@ x = WXPixelScale(x, self.weexInstance.pixelScaleFactor); translateX = [WXLength lengthWithFloat:x type:WXLengthTypeFixed]; } + + WXLength *translateY; + if (value.count > 1) { + double y = [value[1] doubleValue]; + if ([value[1] hasSuffix:@"%"]) { + translateY = [WXLength lengthWithFloat:y type:WXLengthTypePercent]; + } else { + y = WXPixelScale(y, self.weexInstance.pixelScaleFactor); + translateY = [WXLength lengthWithFloat:y type:WXLengthTypeFixed]; + } + } + _translateX = translateX; + _translateY = translateY; +} + +- (void)parseTranslatex:(NSArray *)value +{ + [self parseTranslate:@[value[0], @"0"]]; } - (void)parseTranslatey:(NSArray *)value { - WXLength *translateY; - double y = [value[0] doubleValue]; - if ([value[0] hasSuffix:@"%"]) { - translateY = [WXLength lengthWithFloat:y type:WXLengthTypePercent]; - } else { - y = WXPixelScale(y, self.weexInstance.pixelScaleFactor); - translateY = [WXLength lengthWithFloat:y type:WXLengthTypeFixed]; - } - _translateY = translateY; + [self parseTranslate:@[@"0", value[0]]]; } - (void)parseScale:(NSArray *)value