Hello,
In project TouchStart TouchEnd not working as expected!
In my project i have two buttons…
Both buttons have same script:
var ButtonClickScript = pc.createScript('buttonClickScript');
// initialize code called once per entity
ButtonClickScript.prototype.initialize = function() {
this.entity.element.on('mousedown', function (evt) {
console.log("mousedown = "+ this.entity.name);
}, this);
this.entity.element.on('mouseup', function (evt) {
console.log("mouseup = "+ this.entity.name);
}, this);
this.entity.element.on('touchstart', function (evt) {
console.log("touchstart = "+ this.entity.name);
}, this);
this.entity.element.on('touchend', function (evt) {
console.log("touchend = "+ this.entity.name);
}, this);
};
// update code called every frame
ButtonClickScript.prototype.update = function(dt) {
};
[On computer] When mouse down on button1 and mouse up on button2 it works fine and shows the proper msg in console.log…
mousedown = Button1
mouseup = Button2
[On Mobile] When touch start on button1 and touch end on button2 it does not work as expected and shows the msg in console.log…
touchstart = Button1
touchend = Button1
Here is the project link…
https://playcanvas.com/project/798699/overview/touchstart-touchend-issue
How i can fix this?
It would be great if anyone can help…
Thanks in Advance!