Jump to content

registerPointerEvent not emitting in 5.1


Growler
 Share

Recommended Posts

I have three pointer events I'd like to register within game.playerEntity:

me.input.registerPointerEvent('pointerdown', me.game.viewport, this.pointerdown.bind(this));
me.input.registerPointerEvent('pointerup', me.game.viewport, this.pointerup.bind(this));
me.input.registerPointerEvent('pointermove', me.game.viewport, this.pointermove.bind(this));

I do this within the init:

game.PlayerEntity = me.Entity.extend({
    init: function(x, y, settings) {
        // call the constructor
        this._super(me.Entity, 'init', [x, y, settings]);

        ...

       // me.input registrations here:

I thought somehow the binding wasn't working, so I passed in an anon function and it's still not firing:

me.input.registerPointerEvent("pointermove", me.game.viewport, function(event) {
	console.log('Test');
});

How do I get pointer events to work in Melon 5.1?

Link to comment
Share on other sites

Link to comment
Share on other sites

that's weird to be honest.... that we have some bugs yes totally possible, but for it not to work at all, it's really surprising.... would you mind sharing your code, or at least a minimal version of it that can reproduce the issue ?

Link to comment
Share on other sites

  • 2 weeks later...

@obiot @Parasyte I figured out what it was. I had a GUI DOM element that acts as container for all overlay GUI elements set to width = 100%, height = 100%; and its z-index was overlaying the canvas. So the canvas API wasn't registering events. This is tricky as I wanted an overlaying DOM container to contain all GUI elements.

Link to comment
Share on other sites

On 6/24/2018 at 2:58 AM, Parasyte said:

FWIW, you can use the pointer-events CSS property to allow events to "fall through" the invisible DOM container to the canvas below. You'll have to set the same property on the GUI element children to allow them to recapture pointer events that the parent ignores.

should this be something we add programatically through melonJS (or add to the boilerplate) to prevent the issues with other developers ?

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...