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

ofScale breaks coordinates #6

Open
Raiuc opened this issue Jul 13, 2018 · 1 comment
Open

ofScale breaks coordinates #6

Raiuc opened this issue Jul 13, 2018 · 1 comment

Comments

@Raiuc
Copy link

Raiuc commented Jul 13, 2018

Hi. I'm working with the addon to use buttons inside a little application. When I use ofScale(0.5, 0.5) the app draws the buttons correctly inside the scaled layout, however I can't get the isMousePressed event in the new coordinates.

For example if I draw a button in the layout unscaled at (500,500) and then I do ofScale(0.5, 0.5), the new button will be drawn at (250,250) however the button will not catch clicks on that point but on the original unscaled position (500,500).
How can I fix this?
Thank you.

@memo
Copy link
Owner

memo commented Jul 14, 2018

Hi, unfortunately the events in MSAInteractiveObject don't check for any transformations. The way to solve this would be to transform the coordinates of the rect before checking against mouse coordinates, however when I wrote this addon many years ago there wasn't a way of getting the current transformation. I know now there is a ofGetCurrentMatrix function, but I'm not sure if it works as desired. Sorry I can't be more helpful. There are many other widget based gui addons now for OF that might be more useful too?

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