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
Fix missing update of mouse coordinates in MouseCoordinateWidget #2366
Conversation
Makes sense to me. Found the same today, but didn't investigate this. Thanks to @starnutoditopo for find this. |
Thanks for the fix! I am trying to think of a better way to refresh widgets without having to use INotifyPropertyChanged. If I remember correctly you contributed to Mapsui a long long time ago. I can't find you in the issues. Perhaps it was BruTile or SharpMap. |
But why do you want to circumvent INotifyPropertyEvent? You don't want to have the Map in the Widgets. And you don't want to have a common event like INotifyPropertyEvent. I could then only think about a flag, where the Widgets sets to show, that the Map should be redrawn. Or is there something else? |
Hi, Paul! Yes: I think we exchanged some mails very long ago, but I don't remember for what project. Nice to "meet" you again! |
Should be dropped. Problem is, that MouseCoordinateWidget doesn't implement INotifyPropertyChanged and therefore doesn't update the map. If MouseCoordinateWidget did it correct, then it would work correct. This PR is a workaround. And as a side effect, we have to propagate the map to the widget. Solution is to implement INotifyPropertyChanged for Widget. Could be found here. |
I am not going to accept INotifyPropertyChanged in the current phase. I want to investigate alternatives. It will take time to investigate alternatives. And I want to spend my time working on other issues the coming period. In the meantime I will merge this. It is a small fix, it can easily be reverted in follow up PRs. |
@pauldendulk Is there a reason, why INotifyPropertyChanged interface is not a viable way? |
I was afraid you might ask this 😬 I did not want to answer because I tend to use an hour of my time by trying to formulate things like this. A short version of my arguments:
Thanks for your question. It helpt my own thinking when writing this here. |
We use it already.
Yes. But normally the same code. And the lines are easy, and all using C# understand what's going on.
No, I know, that I shouldn't introduce any tools.
Your suggestion was to add a LayerListWidget. I want to have a LoggingWidget. I only introduced long time ago ScaleBarWidget, because I thought, that this is a useful improvement, and the ButtonWidget, because I needed it for the MapView. Sorry for that. The rest of this mess is not my work.
Yes, could be. But at the moment we have no better idea. And what the result is to wait, until we have a better idea, you could see at the Layers. We still have no possibility for ordering them.
Yes, as above: Isn't it better to make a rework with INotifyPropertyChanged than to do nothing and keep it as it is (ScaleBarWidget use float for Height, TextBox use int? for Height and BoxWidget use int)? Isn't it better to make the code better and improve basics later?
Yes, as above: We could stop the whole development with this argument. Isn't it better to wait until we have the optimal code? And btw. you will not look into this new code, because it is a horrible mess of changes to the whole code, because you have to change even more.
Yes, as above: Could be, but not to improve the code could bring problems too.
Could be. I will not introduce it. I only want to rearrange some code. I'm introducing nothing special to widgets. I make a rework of the code, use more inheritance for the different widgets, simplify the code for handling touchable widgets (add IWidgetTouchable and IWidgetExtended to one interface) and reorder the folder structure to make it more clear what is going on. When I started with Mapsui.Forms, you said, I should make an extra project, because this brings too much trouble into the development of Mapsui. I never read this again from your side. Not at Avalonia 0.x and 11.x, Eto, WinUI or Uno. Sorry, forgot Blazor and Maui. None of this improved the functionality of Mapsui, but each of them brought trouble. And in between this there was .NET standard, .NET core, .NET 5, 6, 7 and 8, a change of the build process and much more. And now the change of the doc framework. Evolution of Mapsui? I know, that some of this has to be done, but only? I could do nothing for Mapsui 5. It's all about build process and frameworks. Nothing, that I can help. The only I could do is to transfer MapView parts to MapControl. The first should be the buttons. But for this, it would be good to have GroupedWidgets class to add two or more buttons to one position. And for this, the widgets should be reworked, because there is a mess of different things that are not good. That is, what I did. Have I done it wrong? Yes, totally. And in the end I realised that nobody can check this. That's why I'm doing it again. Step by step, so that you can follow every little commit. Will the end result be exactly the same as before? Sure, it can't be any different. Can I wait until the decision has been made whether to continue using INotifyPropertyChanged or not? No, completely impossible. In 3 months or 1 year, I can only track my changes with the same effort as you. So if I have to wait with the PRs until this decision has been made, then it is better if I delete them straight away. No problem with this. Sorry, that I waste your time. I needed 2 days to make the first version and another 2 days to now make the PRs with the small steps. Perhaps you could at the end look one or two hours into this. That would be nice. Thank you for your work. |
😧 |
@starnutoditopo No problem. It's not about your PR, but fits here. So, you made all correct. Thank you. |
Some thoughts about this discussion:
Advantage is that isDirty Properties can although be filled by overriding the OnPropertyChanged Method. |
@inforithmics and @pauldendulk: See #2376 |
At runtime, in Mapsui.Samples.Wpf, section "Editing", the MouseCoordinateWidget only updates sometimes (notably: when something else needs a UI refresh):
With this patch, the mouse position is updated every time it changes, by invoking
Map.RefreshGraphics();
.