EaselJS extension adds ScrollContainer to CreateJS.
ScrollContainer provides scroll bars and you can use as normal Container.
- instantiate ScrollContainer with canvas element
- set contentSize and bounds to calculate bar size
- add to stage
- add object to ScrollContainer by calling
addChild
const scroll = new createjs.ScrollContainer(canvas)
scroll.setBounds(0, 0, 520, 300)
scroll.contentSize = {
width: 1200,
height: 960
}
stage.addChild(scroll)
const circle = new createjs.Shape()
circle.graphics.beginFill("DeepSkyBlue").drawCircle(0, 0, 50)
circle.x = 100
circle.y = 100
scroll.addChild(circle)
- Shows scroll bar like Windows 10
- Scroll by the mouse wheel
- Scroll by bar dragging
- This does not clip children