MV PIXI Interaction - 'pointerover' Event

-- Issue: PIXI Interactive Event 'pointerover' only activating once instead of continuously
-- Goal: Hover over text to allow function to activate continuously until no longer hovering over text
-- Requirements: Use PIXI commands (I am able to 'event' this with other commands but want to stay with what PIXI has in its engine)

-- Details:

Hello! I have a question regarding PIXI's interactive events. Currently, I am able to use it just fine with the exception of one event command - 'pointerover'.

I am creating a PIXI.Text('DOWN') on the screen and setting its '.interactive' to true. The event 'pointerover' triggers a function to allow the player to move by simply hovering over the text with the mouse/pointer. It works, with the exception that it only triggers it once rather than continuously when the mouse/pointer stays on the text.

I checked the interaction frequency of PIXI and it is set to 10ms. I am able to move the pointer away from the text and then move the pointer back over the text, triggering it again. The issue is that it has to be moved and I'm trying to make it to where all you have to do is leave the pointer on the text to keep it moving.

Poryg had a great tutorial on this in the video below (unfortunately, you can't see all the code):


Does anyone have any clues on how to get it to continuously 'activate'? Would this be an issue with the PIXI version or is there code out there that I am missing? I am using PIXI v4.8.9.

The event listeners don't need a parallel process to keep listening for the mouse pointer events since that is already automated.

(On a different note, I am able to achieve this with a parallel event that checks the pointer position, but I wanted to stay away from that for now and see what else PIXI can do.)

Any assistance is greatly appreciated!
how does your event look like? as it doesn't have issues on the PIXI v4.8.9 version
which I also use with an higher NWJS version (4.8.4).
Thanks for the reply, ShadowDragon! I finally got a bit of time so here is what I have at the moment.

I tested it again with all plugins disabled except the required PIXI code (below) and it was still having the same issues so I went ahead and just started a brand new project on MV with only a few plugins (Community Basic and the code for PIXI). Since this is a new project, it is using 4.5.4 for now. Looks like it's still the same issue - it works only once when the pointer is over the text.

Here is the code I used (wrote pixText() as a function in case I needed to call it in a script call, but for the event, I went ahead and just wrote it out - I tested it with just this script call as well as putting it inside the event like the image below):

JavaScript:
function pixText() {
    const style = new PIXI.TextStyle(
        {
            fontFamily: 'Arial',
            fontSize: 36,
            fontStyle: 'italic',
            fontWeight: 'bold',
            fill: ['#fffff0','#3cfcde','#222222'],
            dropShadow: true,
            dropShadowColor: '#000000',
            dropShadowBlur: 4,
            dropShadowAngle: Math.PI / 6,
            dropShadowDistance: 2,
            wordWrap: true,
            wordWrapWidth: 440,
            lineJoin: 'round'
        }
    )
    let up = new PIXI.Text('UP', style), down = new PIXI.Text('DOWN', style);
    up.interactive = true;
    down.interactive = true;
    down.x = 96;
    up.on('pointerover', e => player_Move(8));
    down.on('pointerover', e => player_Move(2));
 
    // Check if text is on screen
    // let childAdd = SceneManager._scene.children.filter(x=>x.text);
    // if (childAdd.length === 0) {
        SceneManager._scene.addChild(up);
        SceneManager._scene.addChild(down);
    //}
};

function player_Move(dir) {
    $gamePlayer.moveStraight(dir);
    //$gameMap._interpreter.wait(15); // in case movement commands are firing too quick
};

Some of the code is commented out because I was testing if the text was already added to the scene to not add it again. Also, player_Move() was jittery when I used a parallel process, which wasn't required for the event listener, but I wanted to rule that out as well (all it did was saturate the scene with 1000s of PIXI texts in the same area.)

I have what Poryg suggested to make sure interactive is usable:

JavaScript:
Alias_Graphics_createModeBox = Graphics._createModeBox;
Graphics._createModeBox = function () {
    Alias_Graphics_createModeBox.call(this);
    this._modeBox.style.pointerEvents = "none";
};

Alias_Graphics_updateVideo = Graphics._updateVideo;
Graphics._updateVideo = function () {
    Alias_Graphics_updateVideo.call(this);
    this._video.style.pointerEvents = "none";
};

Alias_Graphics_updateUpperCanvas = Graphics._updateUpperCanvas;
Graphics._updateUpperCanvas = function () {
    Alias_Graphics_updateUpperCanvas.call(this);
    this._upperCanvas.style.pointerEvents = "none";
};

And here is what the event looks like:
pixi1.png


No errors in the console.
I do feel like I am missing something - just not sure at the moment. Any assistance is greatly appreciated!

NWJS v0.72, PIXI 4.5.4, MV 1.6.2.

Edit: The "Turn Off" script command in the event doesn't work so I changed it to just remove the specific text on the screen - it doesn't affect the issue but just wanted to let you know about that as well. It should be "SceneManager._scene.children.pop()" twice instead of removeChild(up) and removeChild(down).
This is the intended behaviour of pointerover - only firing when the mouse is moved over an object. In general, events only happen once something happens, they don't fire continuously while some condition is true.

The solution in this case is to also use a pointerout event, which fires when the mouse is moved away from an object.
This is the intended behaviour of pointerover - only firing when the mouse is moved over an object. In general, events only happen once something happens, they don't fire continuously while some condition is true.

The solution in this case is to also use a pointerout event, which fires when the mouse is moved away from an object.
Interesting - I wonder how Poryg achieved it in his video? The event is clearly moving without him having to move the mouse around - similar to holding a button down.

I did also use a pointerout in a later test, which now makes it to where I have to continuous wander in and out of the element rather than just have the mouse stay over the element. Also tested it with pointerdown and it only fires once as you stated.

Edit: the code below is the time it checks the event it seems. I do have another way to check a continuous "hover" where the mouse doesn't move. I just didn't want to add parallel event if there was something else already built in. I may add something to the touch input commands in core and see if that will yield better results.

JavaScript:
/**
         * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked.
         *
         * @member {number}
         * @default 10
         */
        this.interactionFrequency = options.interactionFrequency || 10;
did also use a pointerout in a later test, which now makes it to where I have to continuous wander in and out of the element rather than just have the mouse stay over the element.
I guess I should have been clearer. The idea is to set a switch to ON on pointerover and OFF on pointerout, and then move when said switch is on - don't put continuous actions in the listeners at all.
I guess I should have been clearer. The idea is to set a switch to ON on pointerover and OFF on pointerout, and then move when said switch is on - don't put continuous actions in the listeners at all.
... I was so caught up in PIXI and wanting it to work, I forgot all about just using a switch for a common event.

HA. It's working fine now.

Talk about tunnel vision.

Thanks for the assist!

Between this and the hovering I got from MZ put into MV, things are all coming together. For now. Until the next broken code haha.
This thread is being closed due to being solved. If you need it reopened, report it to let us know why. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/pixi-interaction-pointerover-event.164981/