Jump to content

problem using cacheAsBitmap & masking


Recommended Posts

I started learning Pixi yesterday and have learnt a lot already, but today I came across my first problem that I can't solve.  I'm making a board game and will be relying on cacheAsBitmap to speed up the drawing of the board which may contain hundreds of static sprites. I also need a rectangular mask on the board so that I can zoom in and out and move the board around inside the masked area (I already got this working).


First of all, the hit areas seems to get displaced when toggling the cacheAsBitmap a few times on a DisplayObjectContainer. Hovering the mouse over the board make the cursor change between a normal cursor and the pointing hand (buttonMode=true) in seemingly random places.  Even worse is that when applying a mask, everything changes position and sometimes even disappears. I haven't been able to find a pattern in this behavior so it's hard for me to explain whats going on. Instead take a look at this jsfiddle where a bunch of rectangles are masked in the center of the canvas:




Clicking the canvas will toggle cacheAsBitmap and after doing it a couple of times everything disappears or moves randomly. If I remove the mask, everything works as expected (though the first problem with wrong hit areas remains).


Am I doing something wrong here or could this be a bug (or two)? I'm using Google Chrome v38.



Link to comment
Share on other sites

  • 5 months later...

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...