-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouse/Touch Event bug with multiple stages one renderer #950
Comments
You shouldn't be using multiple stages, one stage per renderer. If you need to group or show/hide different sprites, use a DisplayObjectContainer. |
Oh. Shame. Seemed like that's why the renderer was separated from the stage in this way. Wouldn't that be an ideal feature? |
Looking at the code there is also logic like this: http://www.goodboydigital.com/pixijs/docs/files/src_pixi_renderers_webgl_WebGLRenderer.js.html#l159 // if rendering a new stage clear the batches..
if(this.__stage !== stage)
{
if(stage.interactive)stage.interactionManager.removeEvents(); ...implying multiple stages are expected. |
To be fair if you'd copied in the next line of code it does actually say:
:) I agree that Pixi seems set-up to allow you to swap between rendering Stages quite easily. Objects can change their stage reference easily for example and the renderer is decoupled from the Stage. It does also appear to do quite a bit of house-keeping when rendering a new Stage (batch clearing, filter resets, etc) which may also imply it wasn't meant to do it simultaneously. |
My use-case is not one that requires 60FPS. I think a bit of housecleaning is fine for the benefit of being able to trade off stages. I can't imagine anyone expecting to switch between stages rapidly enough for it to be a problem. Consider this both a bug report and feature request :) |
@wellcaffeinated What feature do you get from swapping stages instead of using containers? I can't think of a case where containers wouldn't be a better choice. |
It's just easier maintenance.
With stages
|
Not necessary, you can do the interaction in the same manner you do with stage, just add it to the active container instead of directly to the stage. In your example: stage.mousedown = function(e){
var c = new PIXI.Graphics();
c.beginFill(0xcc0000, 0.6);
c.drawCircle(e.global.x, e.global.y, 30);
c.endFill();
activeContainer.addChild( c ); //use the activeContainer instead of the stage
}; You are talking about a couple lines of code difference, not some huge maintenance burden. Plus having different container branches and not touching the root of the tree makes a lot more sense IMHO. Its more like: Containers
Stages:
I see only a one step difference that is creating the containers, and you actually have less interactivity code by using a single stage (in your case). |
You could also do some cool transition effects going from one displayobject to another :) |
Stage is outta here for v3. This issue should no longer persist. Cheers all! 👍 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I've found that stages lose interaction management when several are used with one renderer.
Steps to reproduce:
Here is a js fiddle demonstrating the bug: http://jsfiddle.net/wellcaffeinated/27fsywLn/
I'd love any advice for a workaround in the meantime... it's delaying my progress on a project... any help would be appreciated :)
The text was updated successfully, but these errors were encountered: