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
42134529
Commit
42134529
authored
May 22, 2020
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
7d860051
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
45 deletions
+70
-45
workspace.xml
.idea/workspace.xml
+5
-1
engine.js
debug/engine.js
+30
-7
engine.js.map
debug/engine.js.map
+1
-1
Container.ts
src/2d/display/Container.ts
+0
-30
AlignManager.ts
src/zeroing/decorators/AlignManager.ts
+6
-3
auto-adjust.ts
src/zeroing/decorators/auto-adjust.ts
+28
-3
No files found.
.idea/workspace.xml
View file @
42134529
...
@@ -3,7 +3,11 @@
...
@@ -3,7 +3,11 @@
<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/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.map"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/debug/engine.js.map"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/2d/display/Container.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/2d/display/Container.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/decorators/AlignManager.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/zeroing/decorators/AlignManager.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"
/>
</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"
/>
...
@@ -172,7 +176,7 @@
...
@@ -172,7 +176,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=
"
6062
000"
/>
<workItem
from=
"1590111768143"
duration=
"
10300
000"
/>
</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 @
42134529
...
@@ -1956,8 +1956,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -1956,8 +1956,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
AlignManager
.
prototype
.
autoSize
=
function
(
that
)
{
AlignManager
.
prototype
.
autoSize
=
function
(
that
)
{
var
len
=
that
.
children
.
length
;
var
len
=
that
.
children
.
length
;
if
(
len
>
0
)
{
if
(
len
>
0
)
{
if
(
that
.
autoWidth
if
(
that
.
autoSizeMode
===
AUTO_SIZE_MODE
.
ALL
&&
!
toBoolean
(
that
.
percentWidth
))
{
||
that
.
autoSizeMode
===
AUTO_SIZE_MODE
.
WIDTH
&&
!
toBoolean
(
that
.
percentWidth
))
{
var
maxR
=
0
;
var
maxR
=
0
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
if
(
toBoolean
(
that
.
children
[
i
].
right
))
if
(
toBoolean
(
that
.
children
[
i
].
right
))
...
@@ -1968,8 +1969,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -1968,8 +1969,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
that
.
width
=
maxR
;
that
.
width
=
maxR
;
}
}
if
(
that
.
autoHeight
if
(
that
.
autoSizeMode
===
AUTO_SIZE_MODE
.
ALL
&&
!
toBoolean
(
that
.
percentHeight
))
{
||
that
.
autoSizeMode
===
AUTO_SIZE_MODE
.
HEIGHT
&&
!
toBoolean
(
that
.
percentHeight
))
{
var
maxB
=
0
;
var
maxB
=
0
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
if
(
toBoolean
(
that
.
children
[
i
].
bottom
))
if
(
toBoolean
(
that
.
children
[
i
].
bottom
))
...
@@ -2000,7 +2002,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -2000,7 +2002,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
};
var
temp
=
new
AdjustProxy
(
null
);
var
temp
=
new
AdjustProxy
(
null
);
var
_loop_1
=
function
(
key
)
{
var
_loop_1
=
function
(
key
)
{
if
(
key
==
'alignMode'
)
if
(
key
==
'alignMode'
||
key
==
'autoSizeMode'
)
return
"continue"
;
return
"continue"
;
Object
.
defineProperty
(
ctor
.
prototype
,
key
,
{
Object
.
defineProperty
(
ctor
.
prototype
,
key
,
{
get
:
function
()
{
get
:
function
()
{
...
@@ -2020,6 +2023,20 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -2020,6 +2023,20 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
for
(
var
key
in
temp
.
data
)
{
for
(
var
key
in
temp
.
data
)
{
_loop_1
(
key
);
_loop_1
(
key
);
}
}
Object
.
defineProperty
(
ctor
.
prototype
,
'autoSizeMode'
,
{
get
:
function
()
{
return
this
.
adjustProxy
.
data
[
'autoSizeMode'
];
},
set
:
function
(
v
)
{
var
adjustProxy
=
this
.
adjustProxy
;
if
(
adjustProxy
.
data
[
'autoSizeMode'
]
!==
v
)
{
adjustProxy
.
data
[
'autoSizeMode'
]
=
v
;
adjustProxy
.
makeDirty
();
}
},
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'
];
...
@@ -2042,6 +2059,13 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -2042,6 +2059,13 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
ALIGN_MODE
[
"ONCE"
]
=
"once"
;
ALIGN_MODE
[
"ONCE"
]
=
"once"
;
ALIGN_MODE
[
"ALWAYS"
]
=
"always"
;
ALIGN_MODE
[
"ALWAYS"
]
=
"always"
;
})(
ALIGN_MODE
||
(
ALIGN_MODE
=
{}));
})(
ALIGN_MODE
||
(
ALIGN_MODE
=
{}));
var
AUTO_SIZE_MODE
;
(
function
(
AUTO_SIZE_MODE
)
{
AUTO_SIZE_MODE
[
"NONE"
]
=
"none"
;
AUTO_SIZE_MODE
[
"WIDTH"
]
=
"width"
;
AUTO_SIZE_MODE
[
"HEIGHT"
]
=
"height"
;
AUTO_SIZE_MODE
[
"ALL"
]
=
"all"
;
})(
AUTO_SIZE_MODE
||
(
AUTO_SIZE_MODE
=
{}));
var
AdjustProxy
=
(
function
()
{
var
AdjustProxy
=
(
function
()
{
function
AdjustProxy
(
host
)
{
function
AdjustProxy
(
host
)
{
this
.
data
=
{
this
.
data
=
{
...
@@ -2057,8 +2081,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -2057,8 +2081,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
percentBottom
:
NaN
,
percentBottom
:
NaN
,
horizonCenter
:
NaN
,
horizonCenter
:
NaN
,
verticalCenter
:
NaN
,
verticalCenter
:
NaN
,
autoWidth
:
false
,
autoSizeMode
:
AUTO_SIZE_MODE
.
NONE
,
autoHeight
:
false
,
alignEnabled
:
true
,
alignEnabled
:
true
,
alignMode
:
ALIGN_MODE
.
ALWAYS
,
alignMode
:
ALIGN_MODE
.
ALWAYS
,
};
};
...
...
debug/engine.js.map
View file @
42134529
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/2d/display/Container.ts
View file @
42134529
...
@@ -779,36 +779,6 @@ export default class Container extends DisplayObject {
...
@@ -779,36 +779,6 @@ export default class Container extends DisplayObject {
protected
__width
=
0
;
// 忽略 相对宽度 的 宽度,在父级计算自动宽度的时候用到
protected
__width
=
0
;
// 忽略 相对宽度 的 宽度,在父级计算自动宽度的时候用到
protected
__height
=
0
;
// 忽略 相对高度 的 高度,在父级计算自动高度的时候用到
protected
__height
=
0
;
// 忽略 相对高度 的 高度,在父级计算自动高度的时候用到
/// TODO 移到了auto-dujust里
// protected _autoWidth = false; // 自动宽度?
// protected _autoHeight = false; // 自动高度?
// public get autoWidth() {
// return this._autoWidth;
// }
//
// public get autoHeight() {
// return this._autoHeight;
// }
// public set autoWidth(autoWidth) {
// if(autoWidth === this._autoWidth) return;
// this._autoWidth = autoWidth;
// this.adjustProxy.makeDirty();
// }
//
// public set autoHeight(autoHeight) {
// if(autoHeight === this._autoHeight) return;
// this._autoHeight = autoHeight;
// this.adjustProxy.makeDirty();
// }
// public judgeAutoSize() {
// this.autoWidth = !(toBoolean(this.right) || toBoolean(this.percentWidth) || toBoolean(this._width));
// this.autoHeight = !(toBoolean(this.bottom) || toBoolean(this.percentHeight) || toBoolean(this._height));
// }
get
x
():
number
{
get
x
():
number
{
return
this
.
position
.
x
;
return
this
.
position
.
x
;
}
}
...
...
src/zeroing/decorators/AlignManager.ts
View file @
42134529
import
{
ALIGN_MODE
}
from
"./auto-adjust"
;
import
{
ALIGN_MODE
,
AUTO_SIZE_MODE
}
from
"./auto-adjust"
;
import
{
toBoolean
}
from
"../utils/utils"
;
import
{
toBoolean
}
from
"../utils/utils"
;
import
{
Container
}
from
"../../2d/display/index"
;
import
{
Container
}
from
"../../2d/display/index"
;
...
@@ -150,7 +150,9 @@ class AlignManager {
...
@@ -150,7 +150,9 @@ class AlignManager {
if
(
len
>
0
)
{
if
(
len
>
0
)
{
// 检测本身的是否是可以自动宽
// 检测本身的是否是可以自动宽
if
(
that
.
autoWidth
// if (that.autoWidth
if
(
that
.
autoSizeMode
===
AUTO_SIZE_MODE
.
ALL
||
that
.
autoSizeMode
===
AUTO_SIZE_MODE
.
WIDTH
// && !toBoolean(that.right) /// TODO 我把它注释了 注释这行可以让容器设置了 right 后反向撑开,保持 right 边距不变
// && !toBoolean(that.right) /// TODO 我把它注释了 注释这行可以让容器设置了 right 后反向撑开,保持 right 边距不变
&&
!
toBoolean
(
that
.
percentWidth
))
{
&&
!
toBoolean
(
that
.
percentWidth
))
{
...
@@ -180,7 +182,8 @@ class AlignManager {
...
@@ -180,7 +182,8 @@ class AlignManager {
}
}
// 检测本身的是否是可以自动高
// 检测本身的是否是可以自动高
if
(
that
.
autoHeight
if
(
that
.
autoSizeMode
===
AUTO_SIZE_MODE
.
ALL
||
that
.
autoSizeMode
===
AUTO_SIZE_MODE
.
HEIGHT
// && !toBoolean(that.bottom) /// TODO 我把它注释了 注释这行可以让容器设置了 bottom 后反向撑开,保持 bottom 边距不变
// && !toBoolean(that.bottom) /// TODO 我把它注释了 注释这行可以让容器设置了 bottom 后反向撑开,保持 bottom 边距不变
&&
!
toBoolean
(
that
.
percentHeight
))
{
&&
!
toBoolean
(
that
.
percentHeight
))
{
...
...
src/zeroing/decorators/auto-adjust.ts
View file @
42134529
...
@@ -19,7 +19,8 @@ export function applyAutoAdjust(ctor: Function) {
...
@@ -19,7 +19,8 @@ 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'
)
continue
;
if
(
key
==
'alignMode'
||
key
==
'autoSizeMode'
)
continue
;
Object
.
defineProperty
(
ctor
.
prototype
,
key
,
{
Object
.
defineProperty
(
ctor
.
prototype
,
key
,
{
get
:
function
()
{
get
:
function
()
{
...
@@ -37,6 +38,22 @@ export function applyAutoAdjust(ctor: Function) {
...
@@ -37,6 +38,22 @@ export function applyAutoAdjust(ctor: Function) {
});
});
}
}
Object
.
defineProperty
(
ctor
.
prototype
,
'autoSizeMode'
,
{
get
:
function
()
{
return
this
.
adjustProxy
.
data
[
'autoSizeMode'
];
},
set
:
function
(
v
)
{
const
adjustProxy
:
AdjustProxy
=
this
.
adjustProxy
;
if
(
adjustProxy
.
data
[
'autoSizeMode'
]
!==
v
)
{
adjustProxy
.
data
[
'autoSizeMode'
]
=
v
;
adjustProxy
.
makeDirty
();
}
},
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'
];
...
@@ -61,6 +78,13 @@ export enum ALIGN_MODE {
...
@@ -61,6 +78,13 @@ export enum ALIGN_MODE {
ALWAYS
=
'always'
,
ALWAYS
=
'always'
,
}
}
export
enum
AUTO_SIZE_MODE
{
NONE
=
'none'
,
WIDTH
=
'width'
,
HEIGHT
=
'height'
,
ALL
=
'all'
,
}
/**
/**
* 自适应数据
* 自适应数据
*/
*/
...
@@ -82,8 +106,9 @@ class AdjustProxy {
...
@@ -82,8 +106,9 @@ class AdjustProxy {
horizonCenter
:
NaN
,
horizonCenter
:
NaN
,
verticalCenter
:
NaN
,
verticalCenter
:
NaN
,
autoWidth
:
false
,
autoSizeMode
:
AUTO_SIZE_MODE
.
NONE
,
autoHeight
:
false
,
// autoWidth: false,
// autoHeight: false,
alignEnabled
:
true
,
alignEnabled
:
true
,
alignMode
:
ALIGN_MODE
.
ALWAYS
,
alignMode
:
ALIGN_MODE
.
ALWAYS
,
...
...
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