Improve mouse interactions in Avalonia control#1040
Improve mouse interactions in Avalonia control#1040swharden merged 9 commits intoScottPlot:masterfrom
Conversation
|
As an aside, there is still quite a bit of functionality commented out in AvaPlot.axaml.cs. It fits mostly into these categories:
Let me know your opinion. |
|
It looks like Avalonia does support changing the cursor on |
|
Thanks for this PR and the notes about the commented-out blocks! I was about to list-out the changes I made but it looks like you're already on it. Regarding right-click, controls respond to right-clicks by invoking whatever is in Let me know if all these changes look good to you! If so I'll merge now. Thanks again for all your Avalonia input! 👍 🚀 |
All looks good, thanks for taking this up! EDIT: It might be worth looking into preventing rendering in the designer view, like is done in WPF and WinForms |
I removed it in 99c786f because I didn't realize until now Avalonia even had a designer mode (it doesn't work out of the box on my system) I'd like to move toward the design time display I'm using in WinForms (#1043), but I'm really scared about difficult to diagnose design-time crashes. Do you think this can be done safely in a way that falls back to something simple? I'll try to implement something similar for WPF shortly |
I think it might have been this extension: https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaforVisualStudio
By and large, if it can be done in WPF it can be done in Avalonia the same way (although sometimes with a bit of extra work). As for doing it in WPF, perhaps if it detects designer mode it enables a massive try-catch block that swallows everything (like how webservers stay alive and just send an HTTP 500 if there's an unhandled exception). Now that I think about it, it may be easier to always have the massive try-catch block, but rethrow if not in the designer, and handle it in the designer. I don't think this is likely to be worth the extra effort in debugging. Perhaps when in designer mode it might be best to use an entirely different code path. Or simply accept that designer crashes may happen, I think most of the time when these issues occur it is related to .csproj issues, so I don't know how much we're increasing the surface. |
Ah, that makes sense
I'll research this topic more as it relates to the WPF control and note my findings in #1043, and I'm happy to leave things as they are now for the Avalonia control. I'll go ahead and merge this is, and if/when you're inspired to make a fancier designer view for the Avalonia control you can choose the implementation you feel best about. Thanks again for this PR! This one-liner turned into a solid improvement 👍 |

New Contributors:
please review CONTRIBUTING.md
Purpose:
#999 (comment)
New Functionality:
Forwards mouse moved events to the parent object in Avalonia.