Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复style样式中,pageHeight的rp单位无效问题 #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Tangram/Helper/TangramLayoutParseHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,17 @@ @implementation TangramLayoutParseHelper
layout.pageWidth = pageWidthInConfig/375.f*SCREEN_WIDTH;
}
}
CGFloat pageHeightInConfig = [styleDict tm_floatForKey:@"pageHeight"];
if (disableScale) {
layout.pageHeight = pageHeightInConfig;
}
else{
layout.pageHeight = pageHeightInConfig/375.f*SCREEN_WIDTH;

//高度应该和宽度一样使用rp单位, 要不然style中设置rp单位无效
CGFloat pageHeightInConfig = [self floatRPValueByObject:[styleDict tm_safeObjectForKey:@"pageHeight"]];

if (pageWidthInConfig > 0.f) {
if (disableScale || [[styleDict tm_stringForKey:@"pageHeight"] containsString:@"rp"]) {
layout.pageHeight = pageHeightInConfig;
}
else{
layout.pageHeight = pageHeightInConfig/375.f*SCREEN_WIDTH;
}
}
layout.hGap = [styleDict tm_floatForKey:@"hGap"];
if ([[styleDict tm_stringForKey:@"hasIndicator"] isEqualToString:@"false"]) {
Expand Down
4 changes: 2 additions & 2 deletions TangramDemo/TangramDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/../Pods/Target Support Files/Pods-TangramDemo/Pods-TangramDemo-resources.sh",
"${PODS_ROOT}/Target Support Files/Pods-TangramDemo/Pods-TangramDemo-resources.sh",
"${PODS_ROOT}/../Tangram/Resources/TangramKitVVElementTypeMap.plist",
"${PODS_ROOT}/../Tangram/Resources/TangramLayoutTypeMap.plist",
"${PODS_ROOT}/../Tangram/Resources/TmallComponent2.out",
Expand All @@ -219,7 +219,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-TangramDemo/Pods-TangramDemo-resources.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TangramDemo/Pods-TangramDemo-resources.sh\"\n";
showEnvVarsInLog = 0;
};
F04088E1AA23D8122992FFBB /* [CP] Check Pods Manifest.lock */ = {
Expand Down