SamYan Posted October 12, 2018 Share Posted October 12, 2018 Hi, Can anyone tell me please what the best way to hide a "BETTING CONFIGURATION" container by clicking anywhere on the screen other than that container? Actually i'm detecting the mouse coordinates and comparing with the window / container coordinates, but it's good practice? public static isColliding(mouse: any, object: any): boolean { return !(mouse.x < object.x || mouse.x > (object.x + object.width) || mouse.y < object.y || mouse.y > (object.y + object.height)); } this.baseContainer.interactive = true; this.baseContainer.addListener('pointerdown', () => { if (Utils.isColliding(this.mouseCoord, betConfigUI)) { console.log('you are in window space'); } else { console.log('you are not in the window space'); } }) Thanks in advance! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 12, 2018 Share Posted October 12, 2018 Of course pixi built-in interaction is not enough for serious cases like this. Your solution is good enough. SamYan 1 Quote Link to comment Share on other sites More sharing options...
SamYan Posted October 12, 2018 Author Share Posted October 12, 2018 12 minutes ago, ivan.popelyshev said: Of course pixi built-in interaction is not enough for serious cases like this. Your solution is good enough. Spasibo Ivan! ivan.popelyshev 1 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.