Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM4-13
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-13
Commits
b7bc70cd
Commit
b7bc70cd
authored
Oct 31, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix
parent
73bda07a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
play.component.ts
src/app/play/play.component.ts
+18
-11
No files found.
src/app/play/play.component.ts
View file @
b7bc70cd
...
...
@@ -121,7 +121,7 @@ export class PlayComponent implements OnInit, OnDestroy {
g_currentDragElementID
:
any
=
null
;
// 当前拖动的动画元件
g_dragFirstClickY
:
any
;
g_dragFirstClickX
:
any
;
g_enableDragDistance
:
number
=
20
*
this
.
g_mapScale
;
g_enableDragDistance
:
number
=
5
*
this
.
g_mapScale
;
g_enableDragging
:
any
;
// ------------------------------------
...
...
@@ -511,7 +511,6 @@ export class PlayComponent implements OnInit, OnDestroy {
let
element
=
null
element
=
this
.
g_cartoon
.
createCartoonElement
(
"
image-puzzle-
"
+
index
+
"
_
"
+
side
,
"
MySprite
"
)
console
.
log
(
item
.
media
.
image_url
)
element
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
item
.
media
.
image_url
))
element
.
ref
.
scaleX
=
(
item
.
rect
.
width
/
element
.
ref
.
width
)
*
parent
.
ref
.
scaleX
element
.
ref
.
scaleY
=
(
item
.
rect
.
height
/
element
.
ref
.
height
)
*
parent
.
ref
.
scaleY
...
...
@@ -532,20 +531,17 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
element
.
ref
)
this
.
render
(
textShow
.
ref
)
this
.
render
(
elementDrag
.
ref
)
this
.
render
(
elementDrag
.
ref
,
10
)
element
.
timeoutID
=
null
this
.
subscribeMapDragEvent
(
element
.
id
,
()
=>
{
console
.
log
(
element
.
id
,
"
触发点击
"
)
element
.
timeoutID
=
setTimeout
(()
=>
{
if
(
item
.
media
.
audio_url
)
{
console
.
log
(
element
.
id
,
"
触发播放音频
"
)
this
.
g_cartoon
.
stopAllAudio
()
this
.
g_cartoon
.
playAudio
(
item
.
media
.
audio_url
)
}
},
this
.
g_dragDelay
);
},
()
=>
{
console
.
log
(
element
.
id
,
"
触发拖动
"
)
if
(
element
.
timeoutID
)
{
clearTimeout
(
element
.
timeoutID
)
element
.
timeoutID
=
null
...
...
@@ -553,10 +549,12 @@ export class PlayComponent implements OnInit, OnDestroy {
elementDrag
.
ref
.
x
=
this
.
g_clickX
,
elementDrag
.
ref
.
y
=
this
.
g_clickY
},
()
=>
{
console
.
log
(
element
.
id
,
"
触发释放
"
)
elementDrag
.
ref
.
x
=
elementDrag
.
initX
,
elementDrag
.
ref
.
y
=
elementDrag
.
initY
this
.
m_elementDraged
=
element
.
id
;
setTimeout
(()
=>
{
this
.
m_elementDraged
=
null
;
},
100
);
this
.
g_enableMapUp
=
true
;
this
.
g_enableMapDown
=
true
;
})
...
...
@@ -588,7 +586,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
textDrag
=
null
textDrag
=
this
.
g_cartoon
.
createCartoonElementLabel
(
"
text-puzzle-left-drag
"
,
"
"
+
this
.
g_formData
.
wordLeft_text
+
"
"
,
"
MMTextBook-Bold
"
,
"
#C8161E
"
,
48
*
this
.
g_mapScale
,
-
500
,
-
500
)
this
.
render
(
textDrag
.
ref
)
this
.
render
(
textDrag
.
ref
,
10
)
this
.
render
(
element
.
ref
)
element
.
timeoutID
=
null
...
...
@@ -610,6 +608,9 @@ export class PlayComponent implements OnInit, OnDestroy {
textDrag
.
ref
.
x
=
textDrag
.
initX
,
textDrag
.
ref
.
y
=
textDrag
.
initY
this
.
m_elementDraged
=
element
.
id
;
setTimeout
(()
=>
{
this
.
m_elementDraged
=
null
;
},
100
);
this
.
g_enableMapUp
=
true
;
this
.
g_enableMapDown
=
true
;
})
...
...
@@ -643,7 +644,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
textDrag
=
null
textDrag
=
this
.
g_cartoon
.
createCartoonElementLabel
(
"
text-puzzle-middle-drag
"
,
"
"
+
this
.
g_formData
.
wordMiddle_text
+
"
"
,
"
MMTextBook-Bold
"
,
"
#C8161E
"
,
48
*
this
.
g_mapScale
,
-
500
,
-
500
)
this
.
render
(
textDrag
.
ref
)
this
.
render
(
textDrag
.
ref
,
10
)
this
.
render
(
element
.
ref
)
element
.
timeoutID
=
null
...
...
@@ -665,6 +666,9 @@ export class PlayComponent implements OnInit, OnDestroy {
textDrag
.
ref
.
x
=
textDrag
.
initX
,
textDrag
.
ref
.
y
=
textDrag
.
initY
this
.
m_elementDraged
=
element
.
id
;
setTimeout
(()
=>
{
this
.
m_elementDraged
=
null
;
},
100
);
this
.
g_enableMapUp
=
true
;
this
.
g_enableMapDown
=
true
;
})
...
...
@@ -697,7 +701,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
textDrag
=
null
textDrag
=
this
.
g_cartoon
.
createCartoonElementLabel
(
"
text-puzzle-right-drag
"
,
"
"
+
this
.
g_formData
.
wordRight_text
+
"
"
,
"
MMTextBook-Bold
"
,
"
#C8161E
"
,
48
*
this
.
g_mapScale
,
-
500
,
-
500
)
this
.
render
(
textDrag
.
ref
)
this
.
render
(
textDrag
.
ref
,
10
)
this
.
render
(
element
.
ref
)
element
.
timeoutID
=
null
...
...
@@ -706,7 +710,7 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
timeoutID
=
setTimeout
(()
=>
{
this
.
g_cartoon
.
stopAllAudio
()
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
wordRight_audio_url
)
},
500
);
},
this
.
g_dragDelay
);
},
()
=>
{
if
(
element
.
timeoutID
)
{
clearTimeout
(
element
.
timeoutID
)
...
...
@@ -719,6 +723,9 @@ export class PlayComponent implements OnInit, OnDestroy {
textDrag
.
ref
.
x
=
textDrag
.
initX
,
textDrag
.
ref
.
y
=
textDrag
.
initY
this
.
m_elementDraged
=
element
.
id
;
setTimeout
(()
=>
{
this
.
m_elementDraged
=
null
;
},
100
);
this
.
g_enableMapUp
=
true
;
this
.
g_enableMapDown
=
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