Sign in to follow this  

Pixi hitArea for whole stage

Recommended Posts

I have on stage special "workspace" pixi container -  I use it to allow user to draw on it.  It works perfect if I set hitArea dimensions to renderer width and height but the problem is that user can move this layer or zoom in/out.
I think result is obvious, after move/zoom it is not possible to draw on canvas because hitArea "run" out from the screen or it is too small.

My question is what is the best actual solution for this (pixi v4)?

I was thinking about setting Infinite hitArea but this is not possible. I could set hitArea Rectangle to be like 999999px so it should not be possible to go out of drawing area but is it ok? Can setting very big hitArea slow down interaction manager?
Also another option was to replace hitArea (make it bigger) after move/zoom but this is proably not the best idea. Is there any elegant solution to cover this case easly?

Share this post

Link to post
Share on other sites

You could also consider adding your events at the renderer level, and do some maths to translate to your container.


let location = new PIXI.Point();

renderer.plugins.interaction.on( 'pointerdown', ( event ) => {
  container.worldTransform.applyInverse(, location );


Share this post

Link to post
Share on other sites

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.