christolliday / limn

Experimental cross platform GUI library
Other
404 stars 19 forks source link

Handle MouseInputEvent directly #33

Closed wendivoid closed 6 years ago

wendivoid commented 6 years ago

As i begin adding mouse support for my app i noticed limn handle's the MouseInputEvent for you creating separate events eg. MouseMoved, MouseButton... I think these events are to closely related for that behavior.....Currently i have to create an event handler for each type of mouse event and manually share data between them witch i'm finding is quite a pain, for simple use case's such as creating a scrollbar(i cant use limn's builtin one), I think we should remove MouseMoved,MouseWheel, MouseButton(Keeping ClickEvent) in favor of just directly passing MouseInputEvent down to widgets? or maybe create a WidgetMouseIinput to pass to widgets.I think this would make mouse handling a lot simpler in most cases.

christolliday commented 6 years ago

Hmm, yeah I have thought about combining mouse events, but for a different reason, so that if you handle one, the rest do not propagate (bubble up), which would just mean combining MouseButton and ClickEvent. Maybe a WidgetMouseInput would simplify some use cases as well though, especially when you need to share data between them. I actually think ClickEvent should be combined as well, for the reason above, but it should have some helper methods, like event.is_click() to make it easier to use.

I was thinking about improving the ergonomics of handling multiple events, so that you can avoid the boilerplate of creating composite event types, but it doesn't solve the problem of sharing data between events, so in this case I agree having one mouse event is better.

wendivoid commented 6 years ago

Goning to go ahead and close this due to #50.