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
92236ccf
Commit
92236ccf
authored
Sep 01, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes sprite label so it doesn't use a fixed max width
parent
9a21cbc7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
label.dart
packages/flutter_sprites/lib/label.dart
+9
-9
No files found.
packages/flutter_sprites/lib/label.dart
View file @
92236ccf
...
...
@@ -29,28 +29,28 @@ class Label extends Node {
TextPainter
_painter
;
double
_width
;
final
double
_maxWidth
=
10000.0
;
void
paint
(
PaintingCanvas
canvas
)
{
if
(
_painter
==
null
)
{
PlainTextSpan
textSpan
=
new
PlainTextSpan
(
_text
);
StyledTextSpan
styledTextSpan
=
new
StyledTextSpan
(
_textStyle
,
[
textSpan
]);
_painter
=
new
TextPainter
(
styledTextSpan
);
_painter
.
maxWidth
=
_maxWidth
;
_painter
.
minWidth
=
_maxWidth
;
_painter
.
maxWidth
=
double
.
INFINITY
;
_painter
.
minWidth
=
0.0
;
_painter
.
layout
();
_width
=
_painter
.
maxContentWidth
;
_width
=
_painter
.
maxContentWidth
.
ceil
().
toDouble
();
_painter
.
maxWidth
=
_width
;
_painter
.
minWidth
=
_width
;
_painter
.
layout
();
}
Offset
offset
=
Offset
.
zero
;
if
(
_textStyle
.
textAlign
==
TextAlign
.
center
)
{
//canvas.translate(-_maxWidth / 2.0, 0.0);
offset
=
new
Offset
(-
_maxWidth
/
2.0
,
0.0
);
offset
=
new
Offset
(-
_width
/
2.0
,
0.0
);
}
else
if
(
_textStyle
.
textAlign
==
TextAlign
.
right
)
{
//canvas.translate(-_maxWidth, 0.0);
offset
=
new
Offset
(-
_maxWidth
,
0.0
);
offset
=
new
Offset
(-
_width
,
0.0
);
}
_painter
.
paint
(
canvas
,
offset
);
...
...
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