MCPcopy Index your code
hub / github.com/davidfig/pixi-scrollbox

github.com/davidfig/pixi-scrollbox @2.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.3.0 ↗ · + Follow
126 symbols 315 edges 13 files 31 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

pixi-scrollbox

A configurable scrollbox designed for pixi.js.

Features: * scrollbox uses a mask to clip to desired boxWidth/boxHeight size * scrollbox scrolls with scrollbars (options.overflow=scroll) * scrollbox's scrollbars may be hidden when not needed (options.overflow=auto or hidden) * scrollbox may also be scrolled by dragging on the content window (options.dragScroll=true)

Live Example

davidfig.github.io/pixi-scrollbox/

Rationale

I needed a scrollbox for the UI of my game and since I had this nifty pixi-viewport, I figured it wouldn't be much work to create it. Five hours later and I realized I was a bit off on my estimates. Hopefully others will find it useful.

Migration from v1 to v2

Scrollbox no longer exports a default object. Instead you need to use:

const Scrollbox = require('pixi-scrollbox').Scrollbox

or

import { Scrollbox } from 'pixi-scrollbox'

There were some minor name changes to the fade options. See documentation.

Simple Example

const PIXI = require('pixi.js')
const Scrollbox = require('pixi-scrollbox').Scrollbox

// create the scrollbox
const scrollbox = new Scrollbox({ boxWidth: 200, boxHeight: 200})

// add a sprite to the scrollbox's content
const sprite = scrollbox.content.addChild(new PIXI.Sprite(PIXI.Texture.WHITE))
sprite.width = sprite.height = 500
sprite.tint = 0xff0000

// force an update of the scrollbox's calculations after updating the children
scrollbox.update()

// add the viewport to the stage
const app = new PIXI.Application()
document.body.appendChild(app.view)
app.stage.addChild(scrollbox)

Installation

npm i pixi-scrollbox pixi-viewport pixi.js

or

yarn add pixi-scrollbox pixi-viewport pixi.js

Note: pixi-viewport and pixi.js are listed as peerDependency, which means you will need to manually install them if they're not already installed (this is to ensure you don't have two versions of these libraries).

or download the latest build from github

<script src="https://github.com/davidfig/pixi-scrollbox/raw/2.3.0/external-directory/pixi.js"></script>
<script src="https://github.com/davidfig/pixi-scrollbox/raw/2.3.0/external-directory/pixi-viewport.js"></script>
<script src="https://github.com/davidfig/pixi-scrollbox/raw/2.3.0/external-directory/scrollbox.js"></script>
<script>
    const Scrollbox = new Scrollbox(options)
</script>

API Documentation

https://davidfig.github.io/pixi-scrollbox/jsdoc/

license

MIT License
(c) 2019 YOPEY YOPEY LLC by David Figatner

Extension points exported contracts — how you extend this code

ResizeOptions (Interface)
(no doc)
@types/index.d.ts
ScrollBoxOptions (Interface)
(no doc)
@types/index.d.ts

Core symbols most depended-on inside this repo

update
called by 19
src/scrollbox.js
k
called by 15
docs/jsdoc/scripts/prettify/prettify.js
u
called by 11
docs/jsdoc/scripts/prettify/prettify.js
stopPropagation
called by 8
src/scrollbox.js
m
called by 6
docs/jsdoc/scripts/prettify/prettify.js
_drawScrollbars
called by 5
src/scrollbox.js
y
called by 5
docs/jsdoc/scripts/prettify/prettify.js
x
called by 5
docs/jsdoc/scripts/prettify/prettify.js

Shape

Function 89
Method 31
Class 4
Interface 2

Languages

TypeScript100%

Modules by API surface

docs/jsdoc/scripts/jquery.min.js64 symbols
src/scrollbox.js33 symbols
docs/jsdoc/scripts/prettify/prettify.js14 symbols
docs/jsdoc/scripts/bootstrap.min.js5 symbols
docs/code.js4 symbols
@types/index.d.ts4 symbols
docs/code-test.js2 symbols

For agents

$ claude mcp add pixi-scrollbox \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact