rifflist Posted May 8, 2019 Share Posted May 8, 2019 Howdy! Brand new to Pixi.js and JS development in general. I have a quick question regarding InteractionManager. I have two objects on the stage: a box with a scroll listener for mousewheel events and multiple boxes "underneath" with pointertap listeners. Is there a way to capture these scroll events and the pointertap events on the objects underneath? The current behavior is.. the scroll events are fired, but because that scroll box is interactive and above the click boxes, the pointertap events are not fired. Any thoughts? Thanks in advance! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
rifflist Posted May 15, 2019 Author Share Posted May 15, 2019 *bump Still not sure how to approach this. Any ideas? Thanks!! Quote Link to comment Share on other sites More sharing options...
themoonrat Posted May 15, 2019 Share Posted May 15, 2019 PixiJS itself doesn't listen for mousewheel events at all, so I'm wondering what kind of setup you have here! It's this something you could recreate as a basic version of on www.pixiplayground.com ? Quote Link to comment Share on other sites More sharing options...
jonforum Posted May 15, 2019 Share Posted May 15, 2019 hum he maybe create the event like this. mask.interactive = true; mask.on('pointerdown' , this.pointerdown_mask , this); mask.on('pointerup' , this.pointerup_mask , this); mask.on('mouseupoutside' , this.mouseupoutside_mask , this); mask.on('mousewheel' , this.mousewheel_mask , this); than you can via listener make a hittest to emmit the scroll event. document.addEventListener('wheel',(e) => { // authorize zoom only when is inside canvas if (e.path.contains($app.renderer.view)) { const hitTest = $mouse.interaction.hitTest($mouse.position); // Dispatch scroll event if (hitTest) { hitTest._events.mousewheel && hitTest.emit('mousewheel',e,hitTest) || $camera.onMouseWheel.call($camera,e); }else{ $camera.onMouseWheel.call($camera,e); } }; }); But you should share code to understand what is your issue. [pixiplayground or codepen ] but from what am understand , no is not possible, because the events alway look for sprite order. So if you have a big sprite in your screen + interactive . All interactive sprite under will no emit. you can do a custom hittest maybe ?? Or think you will need a kind of z-index for the events.. maybe. On my side i alway setup my stuff to avoid this issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.