Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM5-15
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
YM5-15
Commits
e8c3aa8b
Commit
e8c3aa8b
authored
Mar 13, 2021
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复排版问题
parent
253254ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
Exercises.spreat.ts
src/app/play/Exercises.spreat.ts
+2
-2
Unit.ts
src/app/play/Unit.ts
+8
-7
No files found.
src/app/play/Exercises.spreat.ts
View file @
e8c3aa8b
...
...
@@ -188,8 +188,8 @@ export class Exercises {
text
.
fontName
=
"
GOTHIC
"
;
text
.
boldFontName
=
'
GOTHICB
'
;
text
.
textArr
=
getTextArr
();
text
.
disH
=
20
*
this
.
scaleX
;
text
.
maxWidth
=
980
*
this
.
scaleX
;
text
.
disH
=
20
;
text
.
maxWidth
=
980
;
text
.
setScaleXY
(
this
.
scaleX
);
text
.
refreshSize
();
...
...
src/app/play/Unit.ts
View file @
e8c3aa8b
...
...
@@ -1176,7 +1176,7 @@ export class RichText extends Label {
const
getBlank
=
()
=>
{
let
blank
=
new
Text
();
blank
.
val
=
'
'
;
blank
.
width
=
this
.
ctx
.
measureText
(
blank
.
val
).
width
*
this
.
scaleX
;
blank
.
width
=
this
.
ctx
.
measureText
(
blank
.
val
).
width
;
return
blank
;
}
...
...
@@ -1200,13 +1200,13 @@ export class RichText extends Label {
else
{
this
.
ctx
.
font
=
`
${
this
.
fontSize
}
px
${
this
.
fontName
}
`
;
}
this
.
textArr
[
i
].
width
=
this
.
ctx
.
measureText
(
c
).
width
*
this
.
scaleX
;
this
.
textArr
[
i
].
width
=
this
.
ctx
.
measureText
(
c
).
width
;
tempStr
+=
text
.
val
;
tempArr
.
push
(
this
.
textArr
[
i
]);
continue
}
if
(
this
.
ctx
.
measureText
(
temp
).
width
*
this
.
scaleX
<
w
&&
this
.
ctx
.
measureText
(
temp
+
(
tempStr
)).
width
*
this
.
scaleX
<=
w
)
{
if
(
this
.
ctx
.
measureText
(
temp
).
width
<
w
&&
this
.
ctx
.
measureText
(
temp
+
(
tempStr
)).
width
<=
w
)
{
temp
+=
'
'
+
tempStr
;
tempArr
.
push
(
getBlank
());
...
...
@@ -1300,17 +1300,18 @@ export class RichText extends Label {
for
(
let
b
=
0
;
b
<
row
.
length
;
b
++
)
{
let
textArr
=
row
[
b
];
let
temp
=
""
;
for
(
let
i
=
0
;
i
<
textArr
.
length
;
++
i
)
{
this
.
ctx
.
strokeText
(
textArr
[
i
].
val
,
x
,
y
+
(
b
+
1
)
*
disH
);
// 每行字体y坐标间隔
x
+=
textArr
[
i
].
width
;
temp
+=
textArr
[
i
].
val
;
}
this
.
ctx
.
strokeText
(
temp
,
x
,
y
+
(
b
+
1
)
*
disH
);
// 每行字体y坐标间隔
x
=
0
;
}
}
x
=
0
;
x
=
0
;
this
.
ctx
.
font
=
`
${
this
.
fontSize
}
px
${
this
.
boldFontName
}
`
;
// this.ctx.fillStyle = '#ff7600';
for
(
let
b
=
0
;
b
<
row
.
length
;
b
++
)
{
...
...
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