Nikatlas 6 年之前
父節點
當前提交
54da0335b5
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 2 0
      src/Game/views/demo/CardToHolder.js
  2. 3 4
      src/helpers/dragAndDrop.js

+ 2 - 0
src/Game/views/demo/CardToHolder.js

@@ -9,6 +9,8 @@ class CardToHolder extends PIXI.Container{
 
         let card = new Card({});
         this.addChild(card);
+        let card2 = new Card({'x': -200});
+        this.addChild(card2);
 
         let holder = new CardHolder({'x':-170,'y':0,'w':203,'h':323});
         this.addChild(holder);

+ 3 - 4
src/helpers/dragAndDrop.js

@@ -1,7 +1,5 @@
 import EventManager from '../Game/services/EventManager';
 
-
-
 function dragAndDrop(sprite) {
 // Sprite must be interactive and if container Hit Area must be specified!
     sprite
@@ -18,8 +16,9 @@ function dragAndDrop(sprite) {
         .on('touchmove', onDragMove);
 
     EventManager.on('CardPlaced', (position) => {
-        console.log("CardPlaced");
-        sprite.placedPosition = position;
+        if(sprite.dragging) {
+            sprite.placedPosition = position;
+        }
     });
 }