Skip to content

Commit b0bec22

Browse files
author
Andrew Start
committed
Basic fix for tap/touchendoutside events with multitouch.
This fix only handles one touch per display object.
1 parent 685a1da commit b0bec22

File tree

5 files changed

+30
-17
lines changed

5 files changed

+30
-17
lines changed

bin/pixi.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3802,6 +3802,7 @@ if ('undefined' !== typeof module) {
38023802

38033803
},{}],11:[function(require,module,exports){
38043804
'use strict';
3805+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
38053806

38063807
function ToObject(val) {
38073808
if (val == null) {
@@ -3811,14 +3812,26 @@ function ToObject(val) {
38113812
return Object(val);
38123813
}
38133814

3815+
function ownEnumerableKeys(obj) {
3816+
var keys = Object.getOwnPropertyNames(obj);
3817+
3818+
if (Object.getOwnPropertySymbols) {
3819+
keys = keys.concat(Object.getOwnPropertySymbols(obj));
3820+
}
3821+
3822+
return keys.filter(function (key) {
3823+
return propIsEnumerable.call(obj, key);
3824+
});
3825+
}
3826+
38143827
module.exports = Object.assign || function (target, source) {
38153828
var from;
38163829
var keys;
38173830
var to = ToObject(target);
38183831

38193832
for (var s = 1; s < arguments.length; s++) {
38203833
from = arguments[s];
3821-
keys = Object.keys(Object(from));
3834+
keys = ownEnumerableKeys(Object(from));
38223835

38233836
for (var i = 0; i < keys.length; i++) {
38243837
to[keys[i]] = from[keys[i]];
@@ -24925,7 +24938,7 @@ InteractionManager.prototype.processTouchStart = function ( displayObject, hit )
2492524938
//console.log("hit" + hit)
2492624939
if(hit)
2492724940
{
24928-
displayObject._touchDown = true;
24941+
displayObject._touchDown = this.eventData.data.identifier;
2492924942
this.dispatchEvent( displayObject, 'touchstart', this.eventData );
2493024943
}
2493124944
};
@@ -24979,15 +24992,15 @@ InteractionManager.prototype.processTouchEnd = function ( displayObject, hit )
2497924992
{
2498024993
this.dispatchEvent( displayObject, 'touchend', this.eventData );
2498124994

24982-
if( displayObject._touchDown )
24995+
if( displayObject._touchDown === this.eventData.data.identifier)
2498324996
{
2498424997
displayObject._touchDown = false;
2498524998
this.dispatchEvent( displayObject, 'tap', this.eventData );
2498624999
}
2498725000
}
2498825001
else
2498925002
{
24990-
if( displayObject._touchDown )
25003+
if( displayObject._touchDown === this.eventData.data.identifier)
2499125004
{
2499225005
displayObject._touchDown = false;
2499325006
this.dispatchEvent( displayObject, 'touchendoutside', this.eventData );

bin/pixi.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/pixi.min.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/pixi.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/interaction/InteractionManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ InteractionManager.prototype.processTouchStart = function ( displayObject, hit )
695695
//console.log("hit" + hit)
696696
if(hit)
697697
{
698-
displayObject._touchDown = true;
698+
displayObject._touchDown = this.eventData.data.identifier;
699699
this.dispatchEvent( displayObject, 'touchstart', this.eventData );
700700
}
701701
};
@@ -749,15 +749,15 @@ InteractionManager.prototype.processTouchEnd = function ( displayObject, hit )
749749
{
750750
this.dispatchEvent( displayObject, 'touchend', this.eventData );
751751

752-
if( displayObject._touchDown )
752+
if( displayObject._touchDown === this.eventData.data.identifier)
753753
{
754754
displayObject._touchDown = false;
755755
this.dispatchEvent( displayObject, 'tap', this.eventData );
756756
}
757757
}
758758
else
759759
{
760-
if( displayObject._touchDown )
760+
if( displayObject._touchDown === this.eventData.data.identifier)
761761
{
762762
displayObject._touchDown = false;
763763
this.dispatchEvent( displayObject, 'touchendoutside', this.eventData );

0 commit comments

Comments
 (0)