Commit b7bc70cd authored by 李维's avatar 李维

Bug fix

parent 73bda07a
......@@ -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;
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment