Xp1c3r Posted January 18, 2021 Share Posted January 18, 2021 Hi, new here, been developing in pixi.js for a bit over two months now, absolutely love it. I have encountered something that I've been stuck on weeks that I hope someone can help me with. The issue is similar to the topic posted in 2019 but with a different use case. Some context, - I'm developing an ECS framework around pixi.js - Wanted to capture normalized events from the InteractionManager to check for all sprite events at the same point - Some events captured were (pointermove, pointertap) from originalEvent (chrome), and (mousemove, mouseover, mousedown, mouseup) from eventData but alas (mouseout, and some other events) are not working - using additional plugins (gsap, pixi-layers) Regular events in the documentation works as listeners attached to the sprite. I needed to trigger those events under my Systems so I did a check on the interactionManager on every tick. Is it the case that pointer-ized (standardized/working) event listeners only exists on PIXI.container but not on InteractionManager? If so do point me to the adapter class, i'll be eternally grateful Do let me know if I'm missing any details, thanks! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 18, 2021 Share Posted January 18, 2021 (edited) > I'm developing an ECS framework around pixi.js nice, that's usually how game engines are built on top of pixi > pixi-layers I wrote custom TreeSearch in that plugin, so it can be wrong, a bit. > Is it the case that pointer-ized (standardized/working) event listeners only exists on PIXI.container but not on InteractionManager? pointer-ized events exist in InteractionManager somewhere, look around. For your goal, CTRL+C-ing TreeSearch or whole interactionManager is fine, dont be afraid of doing that Edited January 18, 2021 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
Xp1c3r Posted January 19, 2021 Author Share Posted January 19, 2021 (edited) Hey ivan, thanks for your work and the quick reply. Turns out after normalizeToPointerData() events are already what I tried previously and not what I needed. I needed a way to have callbacks triggered on update instead of defining it on pixi elements. It's just weird that events like 'pointerover' emitting when defining under sprites but doesn't show up after normalization in the InteractionManager. I'll look for a workaround. Thanks. Edit / Update: (Solved) // normalization let input = this.interaction.normalizeToPointerData(this.interaction.eventData)[0] // checking for hits through treesearch entity.on = (event, onCallback) => { this.interaction.processInteractive(event, entity.go, onCallback) return entity } This worked great for me. Thanks to pixi's modularity allowed me to do this. updateCards(){ // InputManager.debug('Card') InputManager.check('Card', (card) => { card.on('pointerover', (go) => { if (!dragging) { go.lastKnownX = go.x go.lastKnownY = go.y gsap.to(go, { y: -350, duration: 0.2, }) } }).on('pointerout', (go) => { if (!dragging) gsap.to(go, { x: go.lastKnownX, y: go.parent.y, duration: 0.2 }) }) }) } I think I got what you said after looking into the repo. I recall a need to tweak the search for getting sprites under sprites in a post somewhere right? Edited January 19, 2021 by Xp1c3r 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.