Skip to content

Commit 7f2feea

Browse files
committed
All the touch handlers now store the full TouchEvent, not just the Touch List entry
1 parent bf48c53 commit 7f2feea

1 file changed

Lines changed: 32 additions & 20 deletions

File tree

src/input/Pointer.js

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -609,32 +609,33 @@ var Pointer = new Class({
609609
* @private
610610
* @since 3.0.0
611611
*
612-
* @param {TouchEvent} event - The Touch Event to process.
612+
* @param {Touch} touch - The Changed Touch from the Touch Event.
613+
* @param {TouchEvent} event - The full Touch Event.
613614
*/
614-
touchstart: function (event)
615+
touchstart: function (touch, event)
615616
{
616-
if (event['pointerId'])
617+
if (touch['pointerId'])
617618
{
618-
this.pointerId = event.pointerId;
619+
this.pointerId = touch.pointerId;
619620
}
620621

621-
this.identifier = event.identifier;
622-
this.target = event.target;
622+
this.identifier = touch.identifier;
623+
this.target = touch.target;
623624
this.active = true;
624625

625626
this.buttons = 1;
626627

627628
this.event = event;
628629

629-
this.downElement = event.target;
630+
this.downElement = touch.target;
630631

631632
// Sets the local x/y properties
632-
this.manager.transformPointer(this, event.pageX, event.pageY, false);
633+
this.manager.transformPointer(this, touch.pageX, touch.pageY, false);
633634

634635
this.primaryDown = true;
635636
this.downX = this.x;
636637
this.downY = this.y;
637-
this.downTime = event.timeStamp;
638+
this.downTime = touch.timeStamp;
638639

639640
this.isDown = true;
640641

@@ -649,16 +650,17 @@ var Pointer = new Class({
649650
* @private
650651
* @since 3.0.0
651652
*
652-
* @param {TouchEvent} event - The Touch Event to process.
653+
* @param {Touch} touch - The Changed Touch from the Touch Event.
654+
* @param {TouchEvent} event - The full Touch Event.
653655
*/
654-
touchmove: function (event)
656+
touchmove: function (touch, event)
655657
{
656658
this.event = event;
657659

658660
// Sets the local x/y properties
659-
this.manager.transformPointer(this, event.pageX, event.pageY, true);
661+
this.manager.transformPointer(this, touch.pageX, touch.pageY, true);
660662

661-
this.moveTime = event.timeStamp;
663+
this.moveTime = touch.timeStamp;
662664

663665
this.wasTouch = true;
664666
},
@@ -670,23 +672,24 @@ var Pointer = new Class({
670672
* @private
671673
* @since 3.0.0
672674
*
673-
* @param {TouchEvent} event - The Touch Event to process.
675+
* @param {Touch} touch - The Changed Touch from the Touch Event.
676+
* @param {TouchEvent} event - The full Touch Event.
674677
*/
675-
touchend: function (event)
678+
touchend: function (touch, event)
676679
{
677680
this.buttons = 0;
678681

679682
this.event = event;
680683

681-
this.upElement = event.target;
684+
this.upElement = touch.target;
682685

683686
// Sets the local x/y properties
684-
this.manager.transformPointer(this, event.pageX, event.pageY, false);
687+
this.manager.transformPointer(this, touch.pageX, touch.pageY, false);
685688

686689
this.primaryDown = false;
687690
this.upX = this.x;
688691
this.upY = this.y;
689-
this.upTime = event.timeStamp;
692+
this.upTime = touch.timeStamp;
690693

691694
this.isDown = false;
692695

@@ -703,15 +706,24 @@ var Pointer = new Class({
703706
* @private
704707
* @since 3.15.0
705708
*
706-
* @param {TouchEvent} event - The Touch Event to process.
709+
* @param {Touch} touch - The Changed Touch from the Touch Event.
710+
* @param {TouchEvent} event - The full Touch Event.
707711
*/
708-
touchcancel: function (event)
712+
touchcancel: function (touch, event)
709713
{
710714
this.buttons = 0;
711715

712716
this.event = event;
713717

718+
this.upElement = touch.target;
719+
720+
// Sets the local x/y properties
721+
this.manager.transformPointer(this, touch.pageX, touch.pageY, false);
722+
714723
this.primaryDown = false;
724+
this.upX = this.x;
725+
this.upY = this.y;
726+
this.upTime = touch.timeStamp;
715727

716728
this.isDown = false;
717729

0 commit comments

Comments
 (0)