Browse Source

TouchEvents

Nikatlas 6 năm trước cách đây
mục cha
commit
1ef9e0e1f5
2 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 0 2
      src/Game/views/base/Card.js
  2. 4 2
      src/Game/views/base/CardHolder.js

+ 0 - 2
src/Game/views/base/Card.js

@@ -123,8 +123,6 @@ class Card extends GuiableContainer{
     moveTo(point, milliseconds=1000) {
         let path = new PIXI.tween.TweenPath();
         path.moveTo(this.position.x, this.position.y).lineTo(point.x, point.y);
-        console.log(this.position.x);
-        console.log(this.position.y);
 
         this._tween = PIXI.tweenManager.createTween(this);
         this._tween.easing = PIXI.tween.Easing.outQuart();

+ 4 - 2
src/Game/views/base/CardHolder.js

@@ -45,10 +45,12 @@ class CardHolder extends GuiableContainer{
         this.sprite.interactive = true;
         this.sprite.hitArea = new PIXI.Rectangle(0, 0, this.w, this.h);
         this.sprite.cursor = 'pointer';
-        this.sprite.on('mouseup', () => {
+        let fn = () => {
             // This is called before it is removed from the DragEnd Callback
             EventManager.trigger('CardPlaced', [this, this._onDrop]); 
-        });
+        };
+        this.sprite.on('mouseup', fn);
+        this.sprite.on('touchend', fn);
 
         this.position.set(this.x,this.y);