Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
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
abdullh.alsoleman
Front-End
Commits
b26bae8a
Commit
b26bae8a
authored
Jul 21, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issues with invalidating matrix for SpriteBox
parent
1eff5b8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
sprite_box.dart
packages/flutter/example/game/lib/sprite_box.dart
+19
-6
No files found.
packages/flutter/example/game/lib/sprite_box.dart
View file @
b26bae8a
...
...
@@ -39,6 +39,7 @@ class SpriteBox extends RenderBox {
// Add new references
_addSpriteBoxReference
(
_rootNode
);
markNeedsLayout
();
}
// Tracking of frame rate and updates
...
...
@@ -55,7 +56,7 @@ class SpriteBox extends RenderBox {
_transformMode
=
value
;
// Invalidate stuff
if
(
attached
)
perform
Layout
();
markNeeds
Layout
();
}
/// The transform mode used by the [SpriteBox].
...
...
@@ -68,7 +69,10 @@ class SpriteBox extends RenderBox {
Rect
_visibleArea
;
Rect
get
visibleArea
=>
_visibleArea
;
Rect
get
visibleArea
{
if
(
_visibleArea
==
null
)
_calcTransformMatrix
();
return
_visibleArea
;
}
// Setup
...
...
@@ -150,6 +154,8 @@ class SpriteBox extends RenderBox {
}
void
handleEvent
(
Event
event
,
_SpriteBoxHitTestEntry
entry
)
{
if
(!
attached
)
return
;
if
(
event
is
PointerEvent
)
{
if
(
event
.
type
==
'pointerdown'
)
{
...
...
@@ -212,10 +218,13 @@ class SpriteBox extends RenderBox {
/// var matrix = mySpriteBox.transformMatrix;
Matrix4
get
transformMatrix
{
// Get cached matrix if available
if
(
_transformMatrix
!
=
null
)
{
return
_transformMatrix
;
if
(
_transformMatrix
=
=
null
)
{
_calcTransformMatrix
()
;
}
return
_transformMatrix
;
}
void
_calcTransformMatrix
()
{
_transformMatrix
=
new
Matrix4
.
identity
();
// Calculate matrix
...
...
@@ -273,13 +282,17 @@ class SpriteBox extends RenderBox {
break
;
}
_visibleArea
=
new
Rect
.
fromLTRB
(-
offsetX
/
scaleX
,
-
offsetY
/
scaleY
,
systemWidth
+
offsetX
/
scaleX
,
systemHeight
+
offsetY
/
scaleY
);
_transformMatrix
.
translate
(
offsetX
,
offsetY
);
_transformMatrix
.
scale
(
scaleX
,
scaleY
);
return
_transformMatrix
;
}
void
_invalidateTransformMatrix
()
{
_visibleArea
=
null
;
_transformMatrix
=
null
;
_rootNode
.
_invalidateToBoxTransformMatrix
();
}
...
...
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