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
9566ced2
Commit
9566ced2
authored
May 19, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复包围盒计算的问题
parent
a2a8ee9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
Container.ts
src/2d/display/Container.ts
+28
-26
No files found.
src/2d/display/Container.ts
View file @
9566ced2
...
@@ -439,41 +439,40 @@ export default class Container extends DisplayObject {
...
@@ -439,41 +439,40 @@ export default class Container extends DisplayObject {
this
.
_lastBoundsID
=
this
.
_boundsID
this
.
_lastBoundsID
=
this
.
_boundsID
this
.
_bounds
.
clear
();
this
.
_bounds
.
clear
();
//算自己的
//算自己的
this
.
_calculateBounds
();
if
(
!
this
.
_calculateBounds
()){
for
(
let
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
{
const
child
=
this
.
children
[
i
];
const
child
=
this
.
children
[
i
];
if
(
!
child
.
visible
||
!
child
.
renderable
)
{
if
(
!
child
.
visible
||
!
child
.
renderable
)
{
continue
;
continue
;
}
child
.
calculateBounds
();
if
(
child
.
$mask
)
{
child
.
$mask
.
calculateBounds
();
//取交集矩形
if
(
child
.
_bounds
.
x
<
child
.
$mask
.
_bounds
.
x
)
{
child
.
_bounds
.
x
=
child
.
$mask
.
_bounds
.
x
;
}
if
(
child
.
_bounds
.
y
<
child
.
$mask
.
_bounds
.
y
)
{
child
.
_bounds
.
y
=
child
.
$mask
.
_bounds
.
y
;
}
if
(
child
.
_bounds
.
width
>
child
.
$mask
.
_bounds
.
width
)
{
child
.
_bounds
.
width
=
child
.
$mask
.
_bounds
.
width
;
}
}
if
(
child
.
_bounds
.
height
>
child
.
$mask
.
_bounds
.
height
)
{
child
.
calculateBounds
();
child
.
_bounds
.
height
=
child
.
$mask
.
_bounds
.
height
;
if
(
child
.
$mask
)
{
child
.
$mask
.
calculateBounds
();
//取交集矩形
if
(
child
.
_bounds
.
x
<
child
.
$mask
.
_bounds
.
x
)
{
child
.
_bounds
.
x
=
child
.
$mask
.
_bounds
.
x
;
}
if
(
child
.
_bounds
.
y
<
child
.
$mask
.
_bounds
.
y
)
{
child
.
_bounds
.
y
=
child
.
$mask
.
_bounds
.
y
;
}
if
(
child
.
_bounds
.
width
>
child
.
$mask
.
_bounds
.
width
)
{
child
.
_bounds
.
width
=
child
.
$mask
.
_bounds
.
width
;
}
if
(
child
.
_bounds
.
height
>
child
.
$mask
.
_bounds
.
height
)
{
child
.
_bounds
.
height
=
child
.
$mask
.
_bounds
.
height
;
}
Rectangle
.
createFromRects
(
this
.
_bounds
,
child
.
_bounds
);
}
else
{
Rectangle
.
createFromRects
(
this
.
_bounds
,
child
.
_bounds
);
}
}
Rectangle
.
createFromRects
(
this
.
_bounds
,
child
.
_bounds
);
}
else
{
Rectangle
.
createFromRects
(
this
.
_bounds
,
child
.
_bounds
);
}
}
}
}
}
}
/**
/**
* 加"_"的方法基本是为了自己特殊处理
* 加"_"的方法基本是为了自己特殊处理
*/
*/
protected
_calculateBounds
()
{
protected
_calculateBounds
()
:
boolean
{
//子类自己重写
//子类自己重写
//let wp = this.worldMatrix.transformPoint(this.x, this.y);
//let wp = this.worldMatrix.transformPoint(this.x, this.y);
...
@@ -496,7 +495,10 @@ export default class Container extends DisplayObject {
...
@@ -496,7 +495,10 @@ export default class Container extends DisplayObject {
matrix
.
transformPoint
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
,
DisplayObject
.
_p3
);
matrix
.
transformPoint
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
,
DisplayObject
.
_p3
);
matrix
.
transformPoint
(
rect
.
x
,
rect
.
y
+
rect
.
height
,
DisplayObject
.
_p4
);
matrix
.
transformPoint
(
rect
.
x
,
rect
.
y
+
rect
.
height
,
DisplayObject
.
_p4
);
Rectangle
.
createFromPoints
(
this
.
_bounds
,
DisplayObject
.
_p1
,
DisplayObject
.
_p2
,
DisplayObject
.
_p3
,
DisplayObject
.
_p4
);
Rectangle
.
createFromPoints
(
this
.
_bounds
,
DisplayObject
.
_p1
,
DisplayObject
.
_p2
,
DisplayObject
.
_p3
,
DisplayObject
.
_p4
);
return
true
;
}
}
return
false
;
}
}
/**
/**
...
...
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