Skip to content

Commit e8ec934

Browse files
author
HyeongjunCho
committed
Fix fixAbsoluteLayout.js
1 parent 8c5045e commit e8ec934

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

app/pages/Home.vue

+36-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<template>
2-
<Page class="page" actionBarHidden="true">
3-
<FixedAbsoluteLayout backgroundColor="#eeeeee" width="100%" height="100%">
4-
<Label class="info" customTop="4.7%" customLeft="61.6%" width="20%" height="6%" backgroundColor="#ff0000">
5-
</Label>
6-
<Image src="~/static/image/triangle.png" customTop="50%" customLeft="50%" stretch="none" />
7-
<Image src="~/static/image/triangle.png" customTop="51%" customLeft="51%" stretch="none" />
2+
<Page class="page" actionBarHidden="true" width="100%" height="100%">
3+
<FixedAbsoluteLayout class="pageLayout" backgroundColor="#eeeeee" width="99%" height="100%">
4+
<Label customTop="1%" customLeft="1%" width="50%" height="50%" backgroundColor="#ffffff" />
5+
<Button class="info rates" customTop="4.7%" customLeft="61.6%" text="Rates" textWrap="true" />
6+
<Button class="info status" customTop="11.7%" customLeft="61.6%" text="Status" textWrap="true" />
87
</FixedAbsoluteLayout>
98
</Page>
109
</template>
@@ -24,5 +23,36 @@
2423
// End custom common variables
2524
2625
// Custom styles
26+
@function em($number) {
27+
@if (min-width: 1080px) {
28+
@return $number * 14;
29+
}
30+
@if (min-width: 800px) {
31+
@return $number * 11;
32+
}
33+
@if (min-width: 600px) {
34+
@return $number * 9;
35+
}
36+
@if (min-width: 400px) {
37+
@return $number * 6;
38+
}
39+
@return $number * 5;
40+
}
2741
42+
.page {
43+
position: relative;
44+
}
45+
46+
.info {
47+
background-color: white;
48+
width: 20%;
49+
height: 6%;
50+
padding: 0;
51+
color: black;
52+
border-radius: 5px;
53+
font-size: em(1px);
54+
&:active {
55+
background-color: lightgray;
56+
}
57+
}
2858
</style>

fixAbsoluteLayout.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ const AbsoluteLayout = (function(_super) {
2121

2222
AbsoluteLayout.prototype.setCustomLeft = function(view, value) {
2323
var isPercent = typeof value === "string" && value.indexOf("%") >= 0;
24-
if(isPercent) absoluteLayout_01.setLeft(view, this.getMeasuredWidth() * (parseFloat(value) / 100));
24+
var { width } = this.getActualSize();
25+
if(isPercent) absoluteLayout_01.setLeft(view, width * (parseFloat(value) / 100));
2526
else absoluteLayout_01.setLeft(view, value);
2627
};
2728

2829
AbsoluteLayout.prototype.setCustomTop = function(view, value) {
2930
var isPercent = typeof value === "string" && value.indexOf("%") >= 0;
30-
if(isPercent) absoluteLayout_01.setTop(view, this.getMeasuredHeight() * (parseFloat(value) / 100));
31+
var { height } = this.getActualSize();
32+
if(isPercent) absoluteLayout_01.setTop(view, height * (parseFloat(value) / 100));
3133
else absoluteLayout_01.setTop(view, value);
3234
};
3335

0 commit comments

Comments
 (0)