Jammy Posted April 25, 2017 Share Posted April 25, 2017 Hey guys, I'm wondering if anyone can spare some time to please help me? The issue exists within an existing project so is difficult to debug. I'm hoping people can just suggest anything rather than seeking a specific fix while I continue to debug 1. I create an object and place it on the renderer. 2. Then I attach a function to the "pointerdown" event on that object. furni.interactive = true; furni.on('pointerdown', function(){ game.ui.showElecFurniInfo(this); }); 3. I then create sprites above it that act like flashing/rotating spot lights e.g. light = PIXI.Sprite.fromImage("png/spotlight3.png"); light.width= 64*2; light.height= 64*3; light.x = furni.x+44; light.y = furni.y+10; light.height = light.height /2; light.anchor.set(0.5); light.alpha = 1; light.rotate = -180 light.blendMode = PIXI.BLEND_MODES.ADD; game.render.lights.addChild(light); game.flashingLights.push(light); //This will change the opacity every now and then game.rotatingLights.push(light); //This will rotate the light every now and then This is where the problem starts. The pointerdown event isn't firing if one of the rotating lights happens to be over where I click. Even though light.interactive is not set, and even explicitly setting it doesn't resolve the issue. Notes: Removing the lights does fix the issue. Adding the same pointerdown function to the lights fixes the issues but the lights are bigger than the object so it's a crap 'fix'. See test case below In my real code there are multiple containers both above and below these objects which may have click events Test case outside of the project shows the issue should not occur: [Some form of fix] The problem can be fixed with: light.hitArea = new PIXI.Rectangle(0, 0, 0, 0); This just adds to the confusion more to be honest... 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.