Hi awesome people,
I have an addon in which I added a mode that sets the mouseEvent listener priority to OF_EVENT_ORDER_BEFORE_APP and it modifies the ofMouseEventArgs& object in each callback. The idea is that for any other class, including ofApp gets the mouse coordinates already modified so these match what is seen on screen.
So, my question is. Is it correct or OK to modify an event callback argument while it is still bubbling? It works but I don’t know if it is correct to do such.
Thanks in advance!
All the best
PS: Events bubbling… is that a correct wording? is like from the flash era
sounds kind of hacky but as long as someone won’t use an even higher priority it should work.
i would instead have an event in the addon and register listener to those instead of the core ones, for the app you can also have a function that unregisters the core ones and registers yours. it wouldn’t be as automatic but it seems more robust
Thanks for answering so fast!
Yeah, I feel it is a bit hacky, that’s why i’m concerned.
What you suggest sounds more reasonable. I’ll try it.
BTW, I made this addon to be able to move the camera around in an intuitive way while using the ortho projection so to have a kind of infinetely scrollable and panable canvas, because ofEasyCam is completely unusable for such. I’ve been doing a lot of 2D graphics lately and is incredibly useful. I think that adding something like it to the core would be awesome and super useful.
All the best!
ah nice i was thinking about something along those lines while working on a 2d thing too