FredLin Posted April 20, 2021 Share Posted April 20, 2021 Recently I have upgraded the pixi version of my project to 6.0.2. The first thing I noticed is that I can no longer get the event name hint by typing XXX.addListener() on DisplayObject. With pixi v5, I can get the hint of what kind of event I got there. Second, what is the proper way to listen for the 'rightclick' event on DisplayObject in pixi v6? I can't find enough resources about this on Internet. Any help is highly appreciated! Quote Link to comment Share on other sites More sharing options...
jonforum Posted April 20, 2021 Share Posted April 20, 2021 (edited) hu, I think is because they forget add the types events. What you can do for temp fix , is just replace tempory : declare class EventEmitter<EventTypes extends string | symbol = string | symbol> { // by declare class EventEmitter<EventTypes extends string | symbol = keyof HTMLMediaElementEventMap | symbol> { or on(event: keyof HTMLMediaElementEventMap|{}&EventTypes, fn: EventEmitter.ListenerFn, context?: any): this; You shoudl find the type file in `node_modules\eventemitter3\index.d.ts` ------------------------------------------------------------------------ Quote Second, what is the proper way to listen for the 'rightclick' event on DisplayObject in pixi v6? I can't find enough resources about this on Internet. Any help is highly appreciated! sprite.on('pointerup', ({ button }) => { if (button === 0) return eventforButtonLeft(); if (button === 1) return eventforButtonRight(); }); or if you need share events for preventdefault or others behavior. sprite.on('pointerup', ( e, { button }=e ) => { if (button === 0) return eventforButtonLeft(e); if (button === 1) return eventforButtonRight(e); }); Edited April 20, 2021 by jonforum 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.