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
8e410772
Commit
8e410772
authored
May 22, 2020
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
0d4eb013
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
88 deletions
+97
-88
workspace.xml
.idea/workspace.xml
+2
-5
engine.js
debug/engine.js
+36
-19
engine.js.map
debug/engine.js.map
+1
-1
AlignManager.ts
src/zeroing/decorators/AlignManager.ts
+47
-24
auto-adjust.ts
src/zeroing/decorators/auto-adjust.ts
+11
-39
No files found.
.idea/workspace.xml
View file @
8e410772
...
@@ -2,14 +2,11 @@
...
@@ -2,14 +2,11 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"af35c04f-08f6-48ed-85db-2f94c60e87fd"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"af35c04f-08f6-48ed-85db-2f94c60e87fd"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2020_5_14,_2_47_下午_[Default_Changelist]1/shelved.patch"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2020_5_14__2_47___Default_Changelist_1.xml"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/debug/engine.js"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/debug/engine.js"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/debug/engine.js"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/debug/engine.js"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/debug/engine.js.map"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/debug/engine.js.map"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/debug/engine.js.map"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/debug/engine.js.map"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/zeroing/decorators/AlignManager.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/zeroing/decorators/AlignManager.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/zeroing/decorators/AlignManager.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/zeroing/decorators/AlignManager.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/zeroing/game-warpper/GameStage.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/zeroing/game-warpper/GameStage.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/zeroing/decorators/auto-adjust.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/zeroing/decorators/auto-adjust.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/zeroing/launcher.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/zeroing/launcher.ts"
afterDir=
"false"
/>
</list>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
@@ -178,7 +175,7 @@
...
@@ -178,7 +175,7 @@
<workItem
from=
"1589888428282"
duration=
"5840000"
/>
<workItem
from=
"1589888428282"
duration=
"5840000"
/>
<workItem
from=
"1589990226868"
duration=
"35000"
/>
<workItem
from=
"1589990226868"
duration=
"35000"
/>
<workItem
from=
"1590026135813"
duration=
"6205000"
/>
<workItem
from=
"1590026135813"
duration=
"6205000"
/>
<workItem
from=
"1590111768143"
duration=
"
6
17000"
/>
<workItem
from=
"1590111768143"
duration=
"
41
17000"
/>
</task>
</task>
<task
id=
"LOCAL-00001"
summary=
"11"
>
<task
id=
"LOCAL-00001"
summary=
"11"
>
<created>
1590043861171
</created>
<created>
1590043861171
</created>
...
...
debug/engine.js
View file @
8e410772
...
@@ -1914,43 +1914,45 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -1914,43 +1914,45 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
_this
=
this
;
var
_this
=
this
;
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
,
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
;
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
_c
=
(
that
.
parent
||
{}),
_d
=
_c
.
_width
,
pW_Z
=
_d
===
void
0
?
0
:
_d
,
_e
=
_c
.
_height
,
pH_Z
=
_e
===
void
0
?
0
:
_e
;
top
/=
100
;
var
judgePL
=
toBoolean
(
percentLeft
),
judgePR
=
toBoolean
(
percentRight
);
bottom
/=
100
;
var
judgePT
=
toBoolean
(
percentTop
),
judgePB
=
toBoolean
(
percentBottom
);
left
/=
100
;
var
_left
=
judgePL
?
percentLeft
/
100
*
pW_Z
:
left
;
right
/=
100
;
var
_right
=
judgePR
?
percentRight
/
100
*
pW_Z
:
right
;
if
(
toBoolean
(
left
)
&&
toBoolean
(
right
))
{
var
_top
=
judgePT
?
percentTop
/
100
*
pH_Z
:
top
;
that
.
x
=
left
*
pW_Z
;
var
_bottom
=
judgePB
?
percentBottom
/
100
*
pH_Z
:
bottom
;
that
.
width
=
(
1
-
left
-
right
)
*
pW_Z
;
if
(
tt
(
_left
,
_right
))
{
that
.
x
=
_left
;
that
.
width
=
pW_Z
-
_left
-
_right
;
}
}
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
/
2
-
tW_Z
/
2
+
horizonCenter
;
}
}
else
if
(
toBoolean
(
left
))
{
else
if
(
toBoolean
(
_
left
))
{
that
.
x
=
left
*
pW_Z
;
that
.
x
=
_left
;
}
}
else
if
(
toBoolean
(
right
))
{
else
if
(
toBoolean
(
_
right
))
{
that
.
x
=
(
1
-
right
)
*
pW_Z
-
tW_Z
;
that
.
x
=
pW_Z
-
_right
-
tW_Z
;
}
}
}
}
if
(
toBoolean
(
top
)
&&
toBoolean
(
bottom
))
{
if
(
toBoolean
(
_top
)
&&
toBoolean
(
_
bottom
))
{
that
.
y
=
top
*
pH_Z
;
that
.
y
=
_top
;
that
.
height
=
(
1
-
top
-
bottom
)
*
pH_Z
;
that
.
height
=
pH_Z
-
_top
-
_bottom
;
}
}
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
/
2
-
tH_Z
/
2
+
verticalCenter
;
}
}
else
if
(
toBoolean
(
top
))
{
else
if
(
toBoolean
(
_
top
))
{
that
.
y
=
top
*
pH_Z
;
that
.
y
=
_top
;
}
}
else
if
(
toBoolean
(
bottom
))
{
else
if
(
toBoolean
(
_
bottom
))
{
that
.
y
=
(
1
-
bottom
)
*
pH_Z
-
tH_Z
;
that
.
y
=
pH_Z
-
_bottom
-
tH_Z
;
}
}
}
}
that
.
children
.
forEach
(
function
(
v
)
{
return
_this
.
align
(
v
);
});
that
.
children
.
forEach
(
function
(
v
)
{
return
_this
.
align
(
v
);
});
...
@@ -1992,6 +1994,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -1992,6 +1994,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
};
return
AlignManager
;
return
AlignManager
;
}());
}());
function
tt
()
{
var
v
=
[];
for
(
var
_i
=
0
;
_i
<
arguments
.
length
;
_i
++
)
{
v
[
_i
]
=
arguments
[
_i
];
}
for
(
var
i
=
0
;
i
<
v
.
length
;
i
++
)
{
if
(
!
toBoolean
(
v
[
i
]))
return
false
;
}
return
true
;
}
var
alignMgr
=
new
AlignManager
();
var
alignMgr
=
new
AlignManager
();
function
applyAutoAdjust
(
ctor
)
{
function
applyAutoAdjust
(
ctor
)
{
...
@@ -2053,6 +2066,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -2053,6 +2066,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
top
:
NaN
,
top
:
NaN
,
right
:
NaN
,
right
:
NaN
,
bottom
:
NaN
,
bottom
:
NaN
,
percentLeft
:
NaN
,
percentTop
:
NaN
,
percentRight
:
NaN
,
percentBottom
:
NaN
,
horizonCenter
:
NaN
,
horizonCenter
:
NaN
,
verticalCenter
:
NaN
,
verticalCenter
:
NaN
,
autoWidth
:
false
,
autoWidth
:
false
,
...
...
debug/engine.js.map
View file @
8e410772
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/zeroing/decorators/AlignManager.ts
View file @
8e410772
...
@@ -49,47 +49,63 @@ class AlignManager {
...
@@ -49,47 +49,63 @@ class AlignManager {
// that.alignEnabled = false;
// that.alignEnabled = false;
// }
// }
let
{
percentWidth
,
percentHeight
,
top
,
bottom
,
left
,
right
,
horizonCenter
,
verticalCenter
}
=
that
;
let
{
percentWidth
,
percentHeight
,
top
,
bottom
,
left
,
right
,
percentTop
,
percentBottom
,
percentLeft
,
percentRight
,
horizonCenter
,
verticalCenter
}
=
that
;
let
{
_width
:
tW_Z
=
0
,
_height
:
tH_Z
=
0
}
=
that
;
let
{
_width
:
tW_Z
=
0
,
_height
:
tH_Z
=
0
}
=
that
;
const
{
_width
:
pW_Z
=
0
,
_height
:
pH_Z
=
0
}
=
(
that
.
parent
||
{});
const
{
_width
:
pW_Z
=
0
,
_height
:
pH_Z
=
0
}
=
(
that
.
parent
||
{});
top
/=
100
;
/// TODO null / 100 == 0 ?????? wtf!!!!
bottom
/=
100
;
// percentWidth /= 100;
left
/=
100
;
// percentHeight /= 100;
right
/=
100
;
// percentTop /= 100;
// percentBottom /= 100;
// percentLeft /= 100;
// percentRight /= 100;
let
judgePL
=
toBoolean
(
percentLeft
)
,
judgePR
=
toBoolean
(
percentRight
);
let
judgePT
=
toBoolean
(
percentTop
)
,
judgePB
=
toBoolean
(
percentBottom
);
// 先转化一下
let
_left
=
judgePL
?
percentLeft
/
100
*
pW_Z
:
left
;
let
_right
=
judgePR
?
percentRight
/
100
*
pW_Z
:
right
;
let
_top
=
judgePT
?
percentTop
/
100
*
pH_Z
:
top
;
let
_bottom
=
judgePB
?
percentBottom
/
100
*
pH_Z
:
bottom
;
/**
/**
* 计算 width 和 x 值
* 计算 width 和 x 值
*/
*/
if
(
t
oBoolean
(
left
)
&&
toBoolean
(
right
))
{
// left
right 都有则直接拉伸或缩小
if
(
t
t
(
_left
,
_right
))
{
// _left _
right 都有则直接拉伸或缩小
that
.
x
=
left
*
pW_Z
;
that
.
x
=
_left
;
that
.
width
=
(
1
-
left
-
right
)
*
pW_Z
;
that
.
width
=
pW_Z
-
_left
-
_right
;
}
else
{
}
else
{
// 先设置下自己的 width
// 先设置下自己的 width
toBoolean
(
percentWidth
)
&&
(
tW_Z
=
that
.
width
=
pW_Z
*
percentWidth
/
100
);
toBoolean
(
percentWidth
)
&&
(
tW_Z
=
that
.
width
=
pW_Z
*
percentWidth
/
100
);
// if (toBoolean(percentWidth)) {
//
// tW_Z = that.width = pW_Z * percentWidth / 100;
//
// }
// 先考虑 horizonCenter 属性
// 先考虑 horizonCenter 属性
if
(
toBoolean
(
horizonCenter
))
{
if
(
toBoolean
(
horizonCenter
))
{
// x 值 = 父节点的中间值 - 自己宽度的一半 - 居中差值
// x 值 = 父节点的中间值 - 自己宽度的一半 - 居中差值
that
.
x
=
pW_Z
/
2
-
tW_Z
/
2
+
horizonCenter
;
that
.
x
=
pW_Z
/
2
-
tW_Z
/
2
+
horizonCenter
;
}
else
if
(
toBoolean
(
left
))
{
// 假如有左边距
}
else
if
(
toBoolean
(
_left
))
{
// 假如有 _left
that
.
x
=
left
*
pW_Z
;
that
.
x
=
_left
;
}
else
if
(
toBoolean
(
right
))
{
// 假如有右边距
}
else
if
(
toBoolean
(
_right
))
{
// 假如有 _right
that
.
x
=
(
1
-
right
)
*
pW_Z
-
tW_Z
;
that
.
x
=
pW_Z
-
_right
-
tW_Z
;
}
}
}
}
...
@@ -97,11 +113,11 @@ class AlignManager {
...
@@ -97,11 +113,11 @@ class AlignManager {
/**
/**
* 计算 height 和 y 值
* 计算 height 和 y 值
*/
*/
if
(
toBoolean
(
top
)
&&
toBoolean
(
bottom
))
{
// top
bottom 都有则直接拉伸或缩小
if
(
toBoolean
(
_top
)
&&
toBoolean
(
_bottom
))
{
// _top _
bottom 都有则直接拉伸或缩小
that
.
y
=
top
*
pH_Z
;
that
.
y
=
_top
;
that
.
height
=
(
1
-
top
-
bottom
)
*
pH_Z
;
that
.
height
=
pH_Z
-
_top
-
_bottom
;
}
else
{
}
else
{
// 先设置下自己的 height
// 先设置下自己的 height
...
@@ -112,13 +128,13 @@ class AlignManager {
...
@@ -112,13 +128,13 @@ class AlignManager {
// x 值 = 父节点的中间值 - 自己高度的一半 - 居中差值
// x 值 = 父节点的中间值 - 自己高度的一半 - 居中差值
that
.
y
=
pH_Z
/
2
-
tH_Z
/
2
+
verticalCenter
;
that
.
y
=
pH_Z
/
2
-
tH_Z
/
2
+
verticalCenter
;
}
else
if
(
toBoolean
(
top
))
{
// 假如有
top
}
else
if
(
toBoolean
(
_top
))
{
// 假如有 _
top
that
.
y
=
top
*
pH_Z
;
that
.
y
=
_top
;
}
else
if
(
toBoolean
(
bottom
))
{
// 假如有
bottom
}
else
if
(
toBoolean
(
_bottom
))
{
// 假如有 _
bottom
that
.
y
=
(
1
-
bottom
)
*
pH_Z
-
tH_Z
;
that
.
y
=
pH_Z
-
_bottom
-
tH_Z
;
}
}
}
}
...
@@ -208,4 +224,11 @@ class AlignManager {
...
@@ -208,4 +224,11 @@ class AlignManager {
}
}
}
}
function
tt
(...
v
)
{
for
(
let
i
=
0
;
i
<
v
.
length
;
i
++
)
{
if
(
!
toBoolean
(
v
[
i
]))
return
false
;
}
return
true
;
}
export
let
alignMgr
=
new
AlignManager
();
export
let
alignMgr
=
new
AlignManager
();
src/zeroing/decorators/auto-adjust.ts
View file @
8e410772
...
@@ -19,9 +19,7 @@ export function applyAutoAdjust(ctor: Function) {
...
@@ -19,9 +19,7 @@ export function applyAutoAdjust(ctor: Function) {
};
};
let
temp
=
new
AdjustProxy
(
null
);
let
temp
=
new
AdjustProxy
(
null
);
for
(
let
key
in
temp
.
data
)
{
for
(
let
key
in
temp
.
data
)
{
if
(
key
==
'alignMode'
if
(
key
==
'alignMode'
)
continue
;
// || key == 'percentWidth' || key == 'percentHeight'
)
continue
;
Object
.
defineProperty
(
ctor
.
prototype
,
key
,
{
Object
.
defineProperty
(
ctor
.
prototype
,
key
,
{
get
:
function
()
{
get
:
function
()
{
...
@@ -39,40 +37,6 @@ export function applyAutoAdjust(ctor: Function) {
...
@@ -39,40 +37,6 @@ export function applyAutoAdjust(ctor: Function) {
});
});
}
}
// Object.defineProperty(ctor.prototype, 'percentWidth', {
// get: function() {
// return this.adjustProxy.data['percentWidth'];
// },
// set: function(v) {
// const adjustProxy: AdjustProxy = this.adjustProxy;
// if(adjustProxy.data['percentWidth'] !== v) {
// adjustProxy.data['percentWidth'] = v;
// adjustProxy.makeDirty();
//
// this._autoWidth = false;
// }
// },
// enumerable: true,
// configurable: true
// });
//
// Object.defineProperty(ctor.prototype, 'percentHeight', {
// get: function() {
// return this.adjustProxy.data['percentHeight'];
// },
// set: function(v) {
// const adjustProxy: AdjustProxy = this.adjustProxy;
// if(adjustProxy.data['percentHeight'] !== v) {
// adjustProxy.data['percentHeight'] = v;
// adjustProxy.makeDirty();
//
// this._autoHeight = isNaN(this._height) || this._height === null || this._height === undefined;
// }
// },
// enumerable: true,
// configurable: true
// });
Object
.
defineProperty
(
ctor
.
prototype
,
'alignMode'
,
{
Object
.
defineProperty
(
ctor
.
prototype
,
'alignMode'
,
{
get
:
function
()
{
get
:
function
()
{
return
this
.
adjustProxy
.
data
[
'alignMode'
];
return
this
.
adjustProxy
.
data
[
'alignMode'
];
...
@@ -104,21 +68,29 @@ class AdjustProxy {
...
@@ -104,21 +68,29 @@ class AdjustProxy {
data
=
{
data
=
{
percentWidth
:
NaN
,
percentWidth
:
NaN
,
percentHeight
:
NaN
,
percentHeight
:
NaN
,
left
:
NaN
,
left
:
NaN
,
top
:
NaN
,
top
:
NaN
,
right
:
NaN
,
right
:
NaN
,
bottom
:
NaN
,
bottom
:
NaN
,
percentLeft
:
NaN
,
percentTop
:
NaN
,
percentRight
:
NaN
,
percentBottom
:
NaN
,
horizonCenter
:
NaN
,
horizonCenter
:
NaN
,
verticalCenter
:
NaN
,
verticalCenter
:
NaN
,
autoWidth
:
false
,
autoWidth
:
false
,
autoHeight
:
false
,
autoHeight
:
false
,
alignEnabled
:
true
,
alignEnabled
:
true
,
alignMode
:
ALIGN_MODE
.
ALWAYS
,
alignMode
:
ALIGN_MODE
.
ALWAYS
,
};
};
private
_host
;
private
_host
;
// private _sizeDirty = false;
// private _sizeDirty = false;
constructor
(
host
)
{
constructor
(
host
)
{
...
...
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