Jump to content

Make a scrollable field


Laumark
 Share

Recommended Posts

var myContainer = new PIXI.Container();
//...


//do that once
myContainer.filterArea = new PIXI.Rectangle(myContainer.position.x, myContainer.position.y, containterWidth, containerHeight);

// Instead of mask I use filter. There's no "noop" filter, but fxaa is best choice :)

var fxaaFilter = new PIXI.FXAAFilter();
myContainer.filters = [fxaaFilter];

//that's how you scroll it.
//better to cache "myContainer.height" after you add all elements there
myContainer.pivot.y = Math.max(0, Math.min(scrollY, myContainer.height - filter));

Something like that. Also, there is a problem with InteractinoManager, it does not take into account that trick, so it'll be possible to click on elements that were scrolled out of bounds. BUT if you make top and bottom views interactable and that they appear ON TOP (after) that thing, everything will be ok :)

Link to comment
Share on other sites

  • 5 years 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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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