Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hw_003
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
hw_003
Commits
8bb16561
Commit
8bb16561
authored
Feb 20, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 图片选项处理
parent
8f88565b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
play.component.ts
src/app/play/play.component.ts
+28
-16
No files found.
src/app/play/play.component.ts
View file @
8bb16561
...
...
@@ -867,32 +867,24 @@ export class PlayComponent implements OnInit, OnDestroy {
bg
.
addChild
(
picBg
);
this
.
picBgArr
.
push
(
picBg
);
const
rightBg
=
new
MySprite
(
this
.
ctx
);
rightBg
.
init
(
this
.
images
.
get
(
'
pic_right
'
));
rightBg
.
x
=
picBg
.
x
;
rightBg
.
y
=
picBg
.
y
;
bg
.
addChild
(
rightBg
,
1
);
picBg
.
addChild
(
rightBg
);
rightBg
.
visible
=
false
;
picBg
[
'
rightBg
'
]
=
rightBg
;
const
wrongBg
=
new
MySprite
(
this
.
ctx
);
wrongBg
.
init
(
this
.
images
.
get
(
'
pic_wrong
'
));
wrongBg
.
x
=
picBg
.
x
;
wrongBg
.
y
=
picBg
.
y
;
bg
.
addChild
(
wrongBg
,
1
);
picBg
.
addChild
(
wrongBg
);
wrongBg
.
visible
=
false
;
picBg
[
'
wrongBg
'
]
=
wrongBg
;
const
textKey
=
'
text_
'
+
keyArr
[
i
];
const
title
=
new
MySprite
(
this
.
ctx
);
title
.
init
(
this
.
images
.
get
(
textKey
));
title
.
x
=
picBg
.
x
;
title
.
y
=
picBg
.
y
-
picBg
.
height
/
2
+
39
;
bg
.
addChild
(
title
);
title
.
y
=
-
picBg
.
height
/
2
+
39
;
picBg
.
addChild
(
title
);
this
.
answerTitleArr
.
push
(
title
);
}
...
...
@@ -2141,7 +2133,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
textBgArr
[
i
].
wrongBg
.
visible
=
false
;
if
(
this
.
answerLabelArr
[
i
]
&&
answerArr
[
i
].
text
)
{
this
.
answerLabelArr
[
i
].
text
=
answerArr
[
i
].
text
;
this
.
textBgArr
[
i
].
visible
=
true
;
}
else
{
this
.
answerLabelArr
[
i
].
text
=
''
;
this
.
textBgArr
[
i
].
visible
=
false
;
...
...
@@ -2168,14 +2159,34 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
questionPicRect
.
visible
=
false
;
}
let
maxAnswerLength
=
4
;
for
(
let
i
=
3
;
i
>=
0
;
i
--
)
{
if
(
!
answerArr
[
i
].
pic_url
)
{
maxAnswerLength
--
;
}
else
{
break
;
}
}
const
picLen
=
206
;
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
const
picBg
=
this
.
picBgArr
[
i
];
picBg
.
removeChildren
();
const
oldPic
=
picBg
[
'
pic
'
];
if
(
oldPic
)
{
picBg
.
removeChild
(
oldPic
);
picBg
[
'
pic
'
]
=
null
;
}
picBg
.
wrongBg
.
visible
=
false
;
picBg
.
rightBg
.
visible
=
false
;
const
w
=
1020
;
const
offX
=
-
this
.
questionBg
.
width
/
2
+
75
const
picBgW
=
236
;
const
disW
=
(
w
-
picBgW
*
maxAnswerLength
)
/
3
;
picBg
.
x
=
offX
+
picBg
.
width
/
2
+
i
*
(
picBgW
+
disW
);
picBg
.
x
=
((
i
+
1
)
/
(
maxAnswerLength
+
1
)
-
1
/
2
)
*
(
this
.
questionBg
.
width
);
const
picUrl
=
answerArr
[
i
].
pic_url
;
if
(
picUrl
)
{
const
pic
=
new
MySprite
(
this
.
ctx
);
...
...
@@ -2183,10 +2194,11 @@ export class PlayComponent implements OnInit, OnDestroy {
pic
.
y
=
35
;
pic
.
setScaleXY
(
getMinScale
(
pic
,
picLen
));
picBg
.
addChild
(
pic
);
picBg
[
'
pic
'
]
=
pic
;
}
else
{
picBg
.
visible
=
false
;
}
}
}
...
...
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