Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
ym-23
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
ym-23
Commits
a8c3b205
Commit
a8c3b205
authored
Jun 09, 2020
by
Seaborn Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 标点符号始终保持黑色
parent
4273faa8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
17 deletions
+35
-17
play.component.ts
src/app/play/play.component.ts
+35
-17
No files found.
src/app/play/play.component.ts
View file @
a8c3b205
...
...
@@ -712,12 +712,12 @@ export class PlayComponent implements OnInit, OnDestroy {
}
// console.log('letter:',letter) ;
const
array
=
this
.
split
(
letter
.
letter_val
);
let
letter_spr
=
new
Label
();
letter_spr
.
ctx
.
fillStyle
=
"
#000
"
;
letter_spr
.
text
=
letter
.
letter_val
;
letter_spr
.
text
=
array
[
0
]
;
letter_spr
.
textAlign
=
'
left
'
;
// letter_spr.fontSize = word_content.word_font_size ? word_content.word_font_size : 110;
letter_spr
.
fontSize
=
40
;
letter_spr
.
fontName
=
'
GOTHICB
'
;
letter_spr
.
fontColor
=
this
.
getColor
(
letter
.
letter_color
);
...
...
@@ -727,24 +727,31 @@ export class PlayComponent implements OnInit, OnDestroy {
rowHeight
=
letter_spr
.
height
;
letter_spr
.
y
=
rows
*
rowHeight
-
rowHeight
/
2
;
tempWidth
+=
letter_spr
.
width
+
10
;
tempWidth
+=
letter_spr
.
width
;
rowGroup
[
rows
-
1
].
letterLabels
.
push
(
letter_spr
);
rowGroup
[
rows
-
1
].
width
=
tempWidth
;
let
symbol
;
if
(
array
[
1
])
{
symbol
=
new
Label
();
symbol
.
ctx
.
fillStyle
=
"
#000
"
;
symbol
.
text
=
array
[
1
];
symbol
.
textAlign
=
'
left
'
;
symbol
.
fontSize
=
40
;
symbol
.
fontName
=
'
GOTHICB
'
;
symbol
.
fontColor
=
this
.
getColor
(
'
C04
'
);
symbol
.
refreshSize
();
//设置坐标
symbol
.
x
=
tempWidth
+
5
;
rowHeight
=
symbol
.
height
;
symbol
.
y
=
rows
*
rowHeight
-
rowHeight
/
2
;
tempWidth
+=
symbol
.
width
;
rowGroup
[
rows
-
1
].
letterLabels
.
push
(
symbol
);
rowGroup
[
rows
-
1
].
width
=
tempWidth
;
}
/* if(letter.is_=="1"){
//遇到换行
rows++;
if(tempWidth>totalWidth){
totalWidth = tempWidth+10;
}
tempWidth = 0;
rowGroup.push({
width: 0,
letterLabels: []
});
} */
tempWidth
+=
10
;
if
(
i
==
letters
.
length
-
1
)
{
if
(
tempWidth
>
totalWidth
)
{
...
...
@@ -752,6 +759,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
word_bg
.
addChild
(
letter_spr
);
if
(
symbol
)
{
word_bg
.
addChild
(
symbol
);
}
}
//重新调整位置,使文字居中
...
...
@@ -1086,4 +1096,12 @@ export class PlayComponent implements OnInit, OnDestroy {
audio
.
pause
();
audio
.
currentTime
=
0
;
}
private
split
(
text
:
string
)
{
if
(
text
.
match
(
/^.*
[
,|.|!|?
]
$/
))
{
return
[
text
.
substr
(
0
,
text
.
length
-
1
),
text
.
substr
(
text
.
length
-
1
,
1
)]
}
return
[
text
];
}
}
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