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

Issue with resizing, dragging not registering #456

Open
wighawag opened this issue Aug 21, 2023 · 6 comments
Open

Issue with resizing, dragging not registering #456

wighawag opened this issue Aug 21, 2023 · 6 comments

Comments

@wighawag
Copy link

Repo that reproduce the issue : https://github.com/bug-reproduction/pixi-viewport-test

When resizing the window from small to big, dragging does not register in some places, see readme : https://github.com/bug-reproduction/pixi-viewport-test#readme

@blnvdanil
Copy link
Contributor

blnvdanil commented Aug 31, 2023

I guess that you should call resize method on viewport after each resize of your canvas, you can use resize-observer for instance.
Here you can see that viewport updates its hitArea, which depends on screenWidth

this._hitAreaDefault = new Rectangle(this.left, this.top, this.worldScreenWidth, this.worldScreenHeight);

@wighawag
Copy link
Author

Hi @blnvdanil thanks for your comment. This is indeed how I currently get around the issue. I listen for resize event and call resize on the viewport.

But I expected this to be handled automatically. Is that the expected behavior @davidfig ?

@blnvdanil
Copy link
Contributor

blnvdanil commented Sep 2, 2023

@wighawag I think it's not, because you may want to have several viewports on the screen, and in that case that is not possible to guess the way you would like to change the size of those viewports on resize of the page

At least some configuration options should be available, but there are no such options as far as I can say

@blnvdanil
Copy link
Contributor

blnvdanil commented Sep 2, 2023

Well seems that I am wrong, and there is an option forceHitArea. But there is no any intention to resize viewport on resize of the canvas in the source code

@Heilemann
Copy link

@blnvdanil What is resize-observer? How might I use it? I'm running into some version of this, but on initialization.

@blnvdanil
Copy link
Contributor

blnvdanil commented Sep 6, 2023

@Heilemann
That is browser api, which lets you observe size changes of a HTML element

https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver

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

3 participants