Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-engine
Commits
a7c57e5e
Commit
a7c57e5e
authored
May 28, 2020
by
任建锋
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'designtime' of
http://gitlab2.dui88.com/laoqifeng/zeroing-engine
into designtime
parents
65cbbe6a
0038a0dd
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
24 deletions
+26
-24
engine.js
debug/engine.js
+6
-10
engine.js.map
debug/engine.js.map
+1
-1
AlignManager.ts
src/zeroing/decorators/AlignManager.ts
+19
-13
No files found.
debug/engine.js
View file @
a7c57e5e
...
@@ -1951,12 +1951,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -1951,12 +1951,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if
(
!
that
.
alignEnabled
)
if
(
!
that
.
alignEnabled
)
return
;
return
;
var
percentWidth
=
that
.
percentWidth
,
percentHeight
=
that
.
percentHeight
,
top
=
that
.
top
,
bottom
=
that
.
bottom
,
left
=
that
.
left
,
right
=
that
.
right
,
percentTop
=
that
.
percentTop
,
percentBottom
=
that
.
percentBottom
,
percentLeft
=
that
.
percentLeft
,
percentRight
=
that
.
percentRight
,
horizonCenter
=
that
.
horizonCenter
,
verticalCenter
=
that
.
verticalCenter
;
var
percentWidth
=
that
.
percentWidth
,
percentHeight
=
that
.
percentHeight
,
top
=
that
.
top
,
bottom
=
that
.
bottom
,
left
=
that
.
left
,
right
=
that
.
right
,
percentTop
=
that
.
percentTop
,
percentBottom
=
that
.
percentBottom
,
percentLeft
=
that
.
percentLeft
,
percentRight
=
that
.
percentRight
,
horizonCenter
=
that
.
horizonCenter
,
verticalCenter
=
that
.
verticalCenter
;
var
_a
=
that
.
_width
,
tW_Z
=
_a
===
void
0
?
0
:
_a
,
_b
=
that
.
_height
,
tH_Z
=
_b
===
void
0
?
0
:
_b
;
var
_a
=
that
.
width
,
tW_Z
=
_a
===
void
0
?
0
:
_a
,
_b
=
that
.
height
,
tH_Z
=
_b
===
void
0
?
0
:
_b
;
if
(
that
.
_instanceType
==
"TextFieldNode"
||
that
.
_instanceType
==
"Label"
)
{
var
_c
=
(
that
.
parent
||
{}),
_d
=
_c
.
width
,
pW_Z
=
_d
===
void
0
?
0
:
_d
,
_e
=
_c
.
height
,
pH_Z
=
_e
===
void
0
?
0
:
_e
;
tW_Z
=
that
.
width
;
tH_Z
=
that
.
height
;
}
var
_c
=
(
that
.
parent
||
{}),
_d
=
_c
.
_width
,
pW_Z
=
_d
===
void
0
?
0
:
_d
,
_e
=
_c
.
_height
,
pH_Z
=
_e
===
void
0
?
0
:
_e
;
var
judgePL
=
toBoolean
(
percentLeft
),
judgePR
=
toBoolean
(
percentRight
),
judgePT
=
toBoolean
(
percentTop
),
judgePB
=
toBoolean
(
percentBottom
);
var
judgePL
=
toBoolean
(
percentLeft
),
judgePR
=
toBoolean
(
percentRight
),
judgePT
=
toBoolean
(
percentTop
),
judgePB
=
toBoolean
(
percentBottom
);
var
_left
=
judgePL
?
percentLeft
/
100
*
pW_Z
:
left
,
_right
=
judgePR
?
percentRight
/
100
*
pW_Z
:
right
,
_top
=
judgePT
?
percentTop
/
100
*
pH_Z
:
top
,
_bottom
=
judgePB
?
percentBottom
/
100
*
pH_Z
:
bottom
;
var
_left
=
judgePL
?
percentLeft
/
100
*
pW_Z
:
left
,
_right
=
judgePR
?
percentRight
/
100
*
pW_Z
:
right
,
_top
=
judgePT
?
percentTop
/
100
*
pH_Z
:
top
,
_bottom
=
judgePB
?
percentBottom
/
100
*
pH_Z
:
bottom
;
if
(
toBoolean
(
_left
)
&&
toBoolean
(
_right
))
{
if
(
toBoolean
(
_left
)
&&
toBoolean
(
_right
))
{
...
@@ -1966,7 +1962,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -1966,7 +1962,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
else
{
else
{
toBoolean
(
percentWidth
)
&&
(
tW_Z
=
that
.
width
=
pW_Z
*
percentWidth
/
100
);
toBoolean
(
percentWidth
)
&&
(
tW_Z
=
that
.
width
=
pW_Z
*
percentWidth
/
100
);
if
(
toBoolean
(
horizonCenter
))
{
if
(
toBoolean
(
horizonCenter
))
{
that
.
x
=
pW_Z
/
2
-
tW_Z
/
2
+
horizonCenter
;
that
.
x
=
(
pW_Z
-
tW_Z
)
/
2
+
horizonCenter
;
}
}
else
if
(
toBoolean
(
_left
))
{
else
if
(
toBoolean
(
_left
))
{
that
.
x
=
_left
;
that
.
x
=
_left
;
...
@@ -1982,7 +1978,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -1982,7 +1978,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
else
{
else
{
toBoolean
(
percentHeight
)
&&
(
tH_Z
=
that
.
height
=
pH_Z
*
percentHeight
/
100
);
toBoolean
(
percentHeight
)
&&
(
tH_Z
=
that
.
height
=
pH_Z
*
percentHeight
/
100
);
if
(
toBoolean
(
verticalCenter
))
{
if
(
toBoolean
(
verticalCenter
))
{
that
.
y
=
pH_Z
/
2
-
tH_Z
/
2
+
verticalCenter
;
that
.
y
=
(
pH_Z
-
tH_Z
)
/
2
+
verticalCenter
;
}
}
else
if
(
toBoolean
(
_top
))
{
else
if
(
toBoolean
(
_top
))
{
that
.
y
=
_top
;
that
.
y
=
_top
;
...
@@ -2004,7 +2000,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -2004,7 +2000,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if
(
toBoolean
(
that
.
children
[
i
].
right
))
if
(
toBoolean
(
that
.
children
[
i
].
right
))
continue
;
continue
;
var
_x
=
that
.
children
[
i
].
x
||
0
;
var
_x
=
that
.
children
[
i
].
x
||
0
;
var
_w
=
(
that
.
_instanceType
==
"TextFieldNode"
||
that
.
_instanceType
==
"Label"
)
?
that
.
width
:
(
that
.
children
[
i
].
__width
||
0
)
;
var
_w
=
that
.
children
[
i
].
width
;
(
_x
+
_w
>
maxR
)
?
maxR
=
_x
+
_w
:
0
;
(
_x
+
_w
>
maxR
)
?
maxR
=
_x
+
_w
:
0
;
}
}
that
.
width
=
maxR
;
that
.
width
=
maxR
;
...
@@ -2017,7 +2013,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -2017,7 +2013,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if
(
toBoolean
(
that
.
children
[
i
].
bottom
))
if
(
toBoolean
(
that
.
children
[
i
].
bottom
))
continue
;
continue
;
var
_y
=
that
.
children
[
i
].
y
||
0
;
var
_y
=
that
.
children
[
i
].
y
||
0
;
var
_h
=
(
that
.
_instanceType
==
"TextFieldNode"
||
that
.
_instanceType
==
"Label"
)
?
that
.
height
:
(
that
.
children
[
i
].
__height
||
0
)
;
var
_h
=
that
.
children
[
i
].
height
;
(
_y
+
_h
>
maxB
)
?
maxB
=
_y
+
_h
:
0
;
(
_y
+
_h
>
maxB
)
?
maxB
=
_y
+
_h
:
0
;
}
}
that
.
height
=
maxB
;
that
.
height
=
maxB
;
...
...
debug/engine.js.map
View file @
a7c57e5e
This diff is collapsed.
Click to expand it.
src/zeroing/decorators/AlignManager.ts
View file @
a7c57e5e
...
@@ -43,7 +43,7 @@ class AlignManager {
...
@@ -43,7 +43,7 @@ class AlignManager {
*/
*/
private
align
(
that
)
{
private
align
(
that
)
{
if
(
!
that
.
alignEnabled
)
return
;
// 如果的自动对齐关闭
里
则啥也不干
if
(
!
that
.
alignEnabled
)
return
;
// 如果的自动对齐关闭则啥也不干
// if(that.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
// if(that.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
// that.alignEnabled = false;
// that.alignEnabled = false;
...
@@ -56,12 +56,15 @@ class AlignManager {
...
@@ -56,12 +56,15 @@ class AlignManager {
horizonCenter
,
verticalCenter
horizonCenter
,
verticalCenter
}
=
that
;
}
=
that
;
let
{
_width
:
tW_Z
=
0
,
_height
:
tH_Z
=
0
}
=
that
;
// let {_width: tW_Z = 0, _height: tH_Z = 0} = that;
if
(
that
.
_instanceType
==
"TextFieldNode"
||
that
.
_instanceType
==
"Label"
)
{
let
{
width
:
tW_Z
=
0
,
height
:
tH_Z
=
0
}
=
that
;
tW_Z
=
that
.
width
;
// if (that._instanceType == "TextFieldNode" || that._instanceType == "Label") {
tH_Z
=
that
.
height
;
// tW_Z = that.width;
}
// tH_Z = that.height;
const
{
_width
:
pW_Z
=
0
,
_height
:
pH_Z
=
0
}
=
(
that
.
parent
||
{});
// }
// const {_width: pW_Z = 0, _height: pH_Z = 0} = (that.parent || {});
const
{
width
:
pW_Z
=
0
,
height
:
pH_Z
=
0
}
=
(
that
.
parent
||
{});
/// TODO null / 100 == 0 ?????? wtf!!!! 我裂开了
/// TODO null / 100 == 0 ?????? wtf!!!! 我裂开了
// percentWidth /= 100;
// percentWidth /= 100;
...
@@ -99,7 +102,7 @@ class AlignManager {
...
@@ -99,7 +102,7 @@ class AlignManager {
// 先考虑 horizonCenter 属性
// 先考虑 horizonCenter 属性
if
(
toBoolean
(
horizonCenter
))
{
if
(
toBoolean
(
horizonCenter
))
{
// x 值 = 父节点的中间值 - 自己宽度的一半 - 居中差值
// x 值 = 父节点的中间值 - 自己宽度的一半 - 居中差值
that
.
x
=
pW_Z
/
2
-
tW_Z
/
2
+
horizonCenter
;
that
.
x
=
(
pW_Z
-
tW_Z
)
/
2
+
horizonCenter
;
}
else
if
(
toBoolean
(
_left
))
{
// 假如有 _left
}
else
if
(
toBoolean
(
_left
))
{
// 假如有 _left
...
@@ -128,7 +131,7 @@ class AlignManager {
...
@@ -128,7 +131,7 @@ class AlignManager {
// 先考虑 horizonCenter 属性
// 先考虑 horizonCenter 属性
if
(
toBoolean
(
verticalCenter
))
{
if
(
toBoolean
(
verticalCenter
))
{
// x 值 = 父节点的中间值 - 自己高度的一半 - 居中差值
// x 值 = 父节点的中间值 - 自己高度的一半 - 居中差值
that
.
y
=
pH_Z
/
2
-
tH_Z
/
2
+
verticalCenter
;
that
.
y
=
(
pH_Z
-
tH_Z
)
/
2
+
verticalCenter
;
}
else
if
(
toBoolean
(
_top
))
{
// 假如有 _top
}
else
if
(
toBoolean
(
_top
))
{
// 假如有 _top
...
@@ -140,7 +143,6 @@ class AlignManager {
...
@@ -140,7 +143,6 @@ class AlignManager {
}
}
}
}
that
.
children
&&
that
.
children
.
forEach
(
v
=>
this
.
align
(
v
));
that
.
children
&&
that
.
children
.
forEach
(
v
=>
this
.
align
(
v
));
}
}
...
@@ -150,7 +152,7 @@ class AlignManager {
...
@@ -150,7 +152,7 @@ class AlignManager {
*/
*/
private
autoSize
(
that
)
{
private
autoSize
(
that
)
{
const
len
=
that
.
children
?
that
.
children
.
length
:
0
const
len
=
that
.
children
?
that
.
children
.
length
:
0
;
if
(
len
>
0
)
{
if
(
len
>
0
)
{
// 检测本身的是否是可以自动宽
// 检测本身的是否是可以自动宽
...
@@ -179,7 +181,9 @@ class AlignManager {
...
@@ -179,7 +181,9 @@ class AlignManager {
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
if
(
toBoolean
(
that
.
children
[
i
].
right
))
continue
;
/// TODO 开启这个,忽略带 right 值的子节点
if
(
toBoolean
(
that
.
children
[
i
].
right
))
continue
;
/// TODO 开启这个,忽略带 right 值的子节点
let
_x
=
that
.
children
[
i
].
x
||
0
;
let
_x
=
that
.
children
[
i
].
x
||
0
;
let
_w
=
(
that
.
_instanceType
==
"TextFieldNode"
||
that
.
_instanceType
==
"Label"
)
?
that
.
width
:
(
that
.
children
[
i
].
__width
||
0
);
// let _w = (that._instanceType == "TextFieldNode" || that._instanceType == "Label") ? that.width : (that.children[i].__width || 0);
// let _w = that.children[i].__width || 0;
let
_w
=
that
.
children
[
i
].
width
;
(
_x
+
_w
>
maxR
)
?
maxR
=
_x
+
_w
:
0
;
(
_x
+
_w
>
maxR
)
?
maxR
=
_x
+
_w
:
0
;
}
}
that
.
width
=
maxR
;
that
.
width
=
maxR
;
...
@@ -210,7 +214,9 @@ class AlignManager {
...
@@ -210,7 +214,9 @@ class AlignManager {
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
if
(
toBoolean
(
that
.
children
[
i
].
bottom
))
continue
;
/// TODO 开启这个,忽略带 bottom 值的子节点
if
(
toBoolean
(
that
.
children
[
i
].
bottom
))
continue
;
/// TODO 开启这个,忽略带 bottom 值的子节点
let
_y
=
that
.
children
[
i
].
y
||
0
;
let
_y
=
that
.
children
[
i
].
y
||
0
;
let
_h
=
(
that
.
_instanceType
==
"TextFieldNode"
||
that
.
_instanceType
==
"Label"
)
?
that
.
height
:
(
that
.
children
[
i
].
__height
||
0
);
// let _h = (that._instanceType == "TextFieldNode" || that._instanceType == "Label") ? that.height : (that.children[i].__height || 0);
// let _h = that.children[i].__height || 0;
let
_h
=
that
.
children
[
i
].
height
;
(
_y
+
_h
>
maxB
)
?
maxB
=
_y
+
_h
:
0
;
(
_y
+
_h
>
maxB
)
?
maxB
=
_y
+
_h
:
0
;
}
}
that
.
height
=
maxB
;
that
.
height
=
maxB
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment