Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll wheel is not correctly positioned when app is resized #36

Open
FaizalSupriadi opened this issue Apr 19, 2021 · 0 comments
Open

Comments

@FaizalSupriadi
Copy link

I tried to use the scrollbox in my app, but the scroll wheel position is not the same as the box position.

While the box position is correctly tied to the app size and is placed at the top left corner of the app, the scroll wheel position is not and seems to be still tied to the original window size and will be positioned at the top left corner of the original window.
I tried to use resize() to fix it, but that doesn't seem to work.

Anyone know how to fix this?

Code:

const appSize = new Vector2(window.innerHeight * 0.5625, window.innerHeight);

const app = new PIXI.Application({
  width: appSize.x,
  height: appSize.y,
  backgroundColor: new Color(0, 0, 0).hexCode,
  resolution: window.devicePixelRatio || 1,
  autoDensity: true
});

app.renderer.resize(appSize.x, appSize.y);
document.body.appendChild(app.view);

const scrollbox = new Scrollbox({ boxWidth: 200, boxHeight: 200 })
const sprite = scrollbox.content.addChild(new PIXI.Sprite(PIXI.Texture.WHITE))
sprite.width = sprite.height = 500

scrollbox.content.addChild(new PIXI.Text("test"));
scrollbox.update()

app.stage.addChild(scrollbox);

Drawing of issue:
example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant