Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM4-10
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
YM4-10
Commits
609c6245
Commit
609c6245
authored
Oct 22, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复加载时,字线挤在一起的问题
parent
1d4d6152
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
Exercises.ts
src/app/play/Exercises.ts
+13
-2
play.component.ts
src/app/play/play.component.ts
+16
-7
No files found.
src/app/play/Exercises.ts
View file @
609c6245
...
@@ -164,6 +164,16 @@ export class Exercises {
...
@@ -164,6 +164,16 @@ export class Exercises {
letterObj
.
isFill
=
letter
.
isFill
;
letterObj
.
isFill
=
letter
.
isFill
;
wordObj
.
letterArr
.
push
(
letterObj
);
wordObj
.
letterArr
.
push
(
letterObj
);
}
//重新设置坐标
for
(
let
j
=
0
;
j
<
wordObj
.
letterArr
.
length
;
++
j
){
let
letterObj
=
wordObj
.
letterArr
[
j
];
let
label
=
letterObj
.
letter
;
let
w
=
Math
.
ceil
(
label
.
width
);
let
w
=
Math
.
ceil
(
label
.
width
);
tH
=
Math
.
ceil
(
label
.
height
);
tH
=
Math
.
ceil
(
label
.
height
);
...
@@ -171,10 +181,10 @@ export class Exercises {
...
@@ -171,10 +181,10 @@ export class Exercises {
let
dw
=
3
;
let
dw
=
3
;
//如果是填空,则增加下划线
//如果是填空,则增加下划线
if
(
letter
.
isFill
==
'
1
'
)
{
if
(
letter
Obj
.
isFill
==
'
1
'
)
{
startX
+=
dw
;
startX
+=
dw
;
console
.
log
(
startX
);
label
.
x
=
startX
;
label
.
x
=
startX
;
let
underLine
=
new
Line
();
let
underLine
=
new
Line
();
...
@@ -201,6 +211,7 @@ export class Exercises {
...
@@ -201,6 +211,7 @@ export class Exercises {
startX
+=
w
;
startX
+=
w
;
totalW
+=
w
;
totalW
+=
w
;
}
}
//不是末位,增加空格
//不是末位,增加空格
...
...
src/app/play/play.component.ts
View file @
609c6245
...
@@ -2,8 +2,8 @@ import { Component, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListene
...
@@ -2,8 +2,8 @@ import { Component, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListene
import
{
import
{
MySprite
,
MySprite
,
ShapeRectNew
ShapeRectNew
,
Label
}
from
'
./Unit
'
;
}
from
'
./Unit
'
;
import
{
res
,
resAudio
}
from
'
./resources
'
;
import
{
res
,
resAudio
}
from
'
./resources
'
;
...
@@ -638,6 +638,15 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -638,6 +638,15 @@ export class PlayComponent implements OnInit, OnDestroy {
*/
*/
initView
()
{
initView
()
{
//预加载字体
const
label
=
new
Label
();
label
.
fontName
=
"
GOTHIC
"
;
label
.
fontSize
=
32
;
label
.
text
=
'
test
'
;
label
.
alpha
=
1
;
label
.
x
=
-
100
;
label
.
y
=
-
100
;
this
.
renderArr
.
push
(
label
);
this
.
initBg
();
this
.
initBg
();
...
@@ -645,7 +654,10 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -645,7 +654,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initBottomPart
();
this
.
initBottomPart
();
this
.
initExercises
();
setTimeout
(()
=>
{
this
.
initExercises
();
},
500
);
}
}
initBg
()
{
initBg
()
{
...
@@ -908,10 +920,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -908,10 +920,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
curIndex
++
;
this
.
curIndex
++
;
this
.
playAudio
(
'
right
'
,
true
,
()
=>
{
this
.
playAudio
(
'
right
'
,
true
,
()
=>
{
let
key
=
'
index_
'
+
index
;
this
.
curAudio
=
this
.
audioObj
[
key
];
this
.
playAudio
(
key
,
true
);
});
});
}
}
}
}
...
...
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