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

How to check if the container inside pixi-viewport contains a point returned by the "on wheel" event? #465

Open
devexus opened this issue Sep 27, 2023 · 3 comments

Comments

@devexus
Copy link

devexus commented Sep 27, 2023

When I use "zoomed" listener it returns only "type" and "viewport". How can I get information about pointer position?
image

@blnvdanil
Copy link
Contributor

blnvdanil commented Oct 1, 2023

There is no simple way to do that, since viewport just firest the event that way. You can copy the source code of a wheel plugin and add custom parameters in every place where the event is fired.

Why would you need to do that at all?

@devexus
Copy link
Author

devexus commented Oct 3, 2023

I used 2 event listeners one wheel event, and zoomed event. The first one returns mouse position, then I story it in a variable and I have a access to that variable in zoomed event.

I want to do something like zoom-in image which is in lower resolution, then when scale is reached I want to change view with selected image in higher resolution.

@blnvdanil
Copy link
Contributor

blnvdanil commented Oct 10, 2023

But why would you need to check if the pointer is inside of an image? Why cant you just check if the image is still visible in viewport? You just need to check if viewport's current rectangle intersects image's rectangle

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

2 participants