pixijs / pixi-ui

Provide a definitive user experience in your PixiJS application without any frontend library!
https://pixijs.io/pixi-ui/
MIT License
300 stars 49 forks source link

Why scrollWidget's height is always zero? #51

Open nanwangjkl opened 3 years ago

nanwangjkl commented 3 years ago
const mockScroll = new PUXI.ScrollWidget({
  scrollY: true,
  scrollX: true,
  scrollBars: true,
  height: 600
}).setLayoutOptions(
  new PUXI.FastLayoutOptions({
    width: 0.5,
    height: 0.25,
    x: 0.5,
    y: 0.7,
    anchor: PUXI.FastLayoutOptions.CENTER_ANCHOR
  })
).setBackground(0xffaabb)
  .setBackgroundAlpha(0.5)
  .addChild(new PUXI.Button({ text: 'Button 1' }).setBackground(0xff))
  .addChild(new PUXI.Button({ text: 'Button 2' })
    .setLayoutOptions(new PUXI.FastLayoutOptions({ x: 0, y: 50 }))
    .setBackground(0xff))
  .addChild(new PUXI.Button({ text: 'Button 3' })
    .setLayoutOptions(new PUXI.FastLayoutOptions({ x: 0, y: 250 }))
    .setBackground(0xff))

I created a scrollwidget just like the demo shows. but the height is always 0, i can't get the scrollwidget to scroll a bit. I don't see any instruction on how to use the widget correctly. please kindly help