Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox Mobile Canvas touch do not define event #336

Closed
Zykino opened this issue Aug 28, 2017 · 7 comments
Closed

Firefox Mobile Canvas touch do not define event #336

Zykino opened this issue Aug 28, 2017 · 7 comments
Assignees
Labels

Comments

@Zykino
Copy link

Zykino commented Aug 28, 2017

I tryed it as soon as I saw #335

  • A bug in the API:
    • Phaser version(s): v2.8.4
    • Live example: Memory done following phaserjs.com's tutorial
    • What should happen: Firefox Mobile 55 (Android 7.1.1) The game should be played like on descktop
    • What happens instead: I see the Game view, but nothing happen when I click to pass the title screen. On the console I have the following (the warning append when I click on a button):
      Phaser CE v2.8.4 | Pixi.js | Canvas | WebAudio " http://phaser.io "♥♥♥
      ReferenceError: event is not defined[En savoir plus] phaser2.8.4.js:36188:1

The stack point in the executeTouchLockCallbacks function, in the if, event is undefined:
if (cb.onEnd === onEnd && cb.callback.call(cb.context, this, event))

Be nice. We do this for free. <3

@samme
Copy link
Collaborator

samme commented Aug 29, 2017

I can't view https://zykino.net/portfolio/Memory-Canvas/ (server dropped connection).

@Zykino
Copy link
Author

Zykino commented Aug 29, 2017

Strange, the server is working fine for me even on an other connection.
It's the exact same code as #335 except that I forced Phaser.CANVAS for easier debugging.

I just tried to check the "use desktop website": it works well (for both WEBGL and CANVAS).
I think they handle WEBGL and touch/mouse events differently in this mode.

@samme
Copy link
Collaborator

samme commented Aug 29, 2017

Please try buttons/action on click (click on button).

@Zykino
Copy link
Author

Zykino commented Aug 29, 2017

I have both error (WEBGL & touch event)

full log console:

loadPath ../  example.js:6:3
Error: WebGL warning: Exceeded 2 live WebGL contexts for this principal, losing the least recently used one.  phaser.js:17190:14
scale.boot() scaleMode 2  example.js:21:5
   Phaser CE v2.8.4 | Pixi.js | WebGL | WebAudio    " http://phaser.io "♥♥♥  phaser.js:35035:13
load.reset() load.path ../  example.js:15:5
Error: WebGL warning: vertexAttribPointer: -1 is not a valid `index`. This value probably comes from a getAttribLocation() call, where this return value -1 means that the passed name didn't correspond to an active attribute in the specified program. phaser.js:18818:9
load.reset() load.path ../  example.js:15:5
Error: WebGL warning: vertexAttribPointer: -1 is not a valid `index`. This value probably comes from a getAttribLocation() call, where this return value -1 means that the passed name didn't correspond to an active attribute in the specified program. phaser.js:18818:9
Error: WebGL: No further warnings will be reported for this WebGL context. (already reported 32 warnings)  phaser.js:18818:9
ReferenceError: event is not defined[En savoir plus] phaser.js:36188:1
	executeTouchLockCallbacks https://samme.github.io/phaser-examples-mirror/js/bower_components/phaser-ce/build/phaser.js:36188:1
	onTouchStart https://samme.github.io/phaser-examples-mirror/js/bower_components/phaser-ce/build/phaser.js:39799:9
	start/this._onTouchStart https://samme.github.io/phaser-examples-mirror/js/bower_components/phaser-ce/build/phaser.js:39725:24

I still got the error messages for WEBGL (#355) but I managed to fix this one by doing the following:

https://github.com/photonstorm/phaser-ce/blob/c692afb16c7482a5dfc5f5f8d5b7f66f68f9b410/src/input/Touch.js#L214-L216
Inverted both lines:

        this.event = event;
                
        this.game.input.executeTouchLockCallbacks(false);

https://github.com/photonstorm/phaser-ce/blob/c692afb16c7482a5dfc5f5f8d5b7f66f68f9b410/src/input/Input.js#L603

        if (cb.onEnd === onEnd && cb.callback.call(cb.context, this, this.event))

@samme samme self-assigned this Aug 29, 2017
@samme samme added the bug label Aug 29, 2017
@samme
Copy link
Collaborator

samme commented Aug 29, 2017

This is a bug in e3f8a9d. Unfortunately it's hidden by window.event in other browsers (and JSHint).

@samme
Copy link
Collaborator

samme commented Aug 29, 2017

@Zykino please try attached: phaser-test.js.zip

@Zykino
Copy link
Author

Zykino commented Aug 30, 2017

With your phaser-test build this is working great for handling the clicks :)
I don't know if I have to close the issue or you are gonna do it in the same time you merge the modification.

@samme samme closed this as completed in fe7fdce Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants