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

Removed limit for MouseHighlighter Animation Duration and Animation D… #29352

Conversation

fredso90
Copy link
Contributor

…elay.

(If user sets these values to 0ms, it will actually be set to 1ms to avoid crashing the app)

Summary of the Pull Request

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

…elay.

(If user sets these values to 0ms, it will actually be set to 1ms to avoid crashing the app)
@fredso90
Copy link
Contributor Author

I made this a draft because I don't know if my hack to avoid the fader not working is allowed or not. When I tested this solution with both Fade Duration and Fade Delay set to 0, it worked as intended (except that it's actually 1ms instead of the displayed 0)

@@ -196,7 +196,7 @@
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="100"
Minimum="100"
Minimum="0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not setting this to 1 instead of doing a hack?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured that would lead to an annoying interaction.
If you try to go to 0 and end up on 1 and then increase the duration again using the arrows, you'd end up on 11 or 101.
But that's probably worth it to avoid the hack, right?

Copy link
Collaborator

@htcfreek htcfreek Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two xaml properties for this control you can use to manipulate this behavior: SmallChange and LargeChange. Not sure if it makes sense to adjust them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my thinking. Then I'd have to add conditionals for those. Which in turn could lead to users getting annoyed because it doesn't work "as it should".
That's my justification for my hack. If we don't want that, then I think I'd prefer to just set the limit to 1 as you suggested.

@@ -205,7 +205,7 @@
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="100"
Minimum="100"
Minimum="0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@Jay-o-Way
Copy link
Collaborator

Why would it crash with zero in the first place?

@fredso90
Copy link
Contributor Author

Why would it crash with zero in the first place?

I haven't been able to figure that out yet. Looking into it now.

@fredso90
Copy link
Contributor Author

Why would it crash with zero in the first place?

image

Okay, so I'm not entirely sure what I'm looking at. This is from _msvc_chrono.hpp

image

And this is from the MouseHighlighter.cpp file. Does this mean (sorry if my question is dumb) that the duration can't be 0 because we use std::chrono?

@Jay-o-Way
Copy link
Collaborator

"period negative or zero" seems to be the reason. An animation that takes no time, would technically not be an animation.

@fredso90
Copy link
Contributor Author

"period negative or zero" seems to be the reason. An animation that takes no time, would technically not be an animation.

That's my interpretation as well. Then the question becomes, should I keep my hack or set the lower limit to 1ms? I can't really see another way of resolving the issue.

@htcfreek
Copy link
Collaborator

"period negative or zero" seems to be the reason. An animation that takes no time, would technically not be an animation.

That's my interpretation as well. Then the question becomes, should I keep my hack or set the lower limit to 1ms? I can't really see another way of resolving the issue.

I think the best thing is setting it to 1. If we can't crash on a json value of zero or negative int you can remove the hack. Otherwise we should keep it.

@fredso90
Copy link
Contributor Author

fredso90 commented Oct 22, 2023

With the value limited to 1, I don't crash when I test locally. Removed the hack and set the lower limits to 1. If everything looks good and we all agree that this is the best course of action, I believe this one is ready.

@Jay-o-Way
Copy link
Collaborator

I do agree the "101" issue isn't pretty. If it were me, I would go for the work-around in code. But that's just me, or us 3. Maybe another opinion would be good.

@htcfreek
Copy link
Collaborator

I do agree the "101" issue isn't pretty. If it were me, I would go for the work-around in code. But that's just me, or us 3. Maybe another opinion would be good.

I think it's confusing if for a user if he/she sets 0 and it acts as 1. I would mark it as ready and wait on feedback from the core team.

@Jay-o-Way
Copy link
Collaborator

There is nobody who could possibly detect an animation of one millisecond.

@fredso90
Copy link
Contributor Author

Another option is to have the lower limit set to 1, and add a conditional that makes LargeChange and SmallChange 99 and 9 respectively if it's set to 1. What do you think about such a solution?

@Jay-o-Way
Copy link
Collaborator

Another option is to have the lower limit set to 1, and add a conditional that makes LargeChange and SmallChange 99 and 9 respectively if it's set to 1. What do you think about such a solution?

Wayyy too complicated. I suggest to go with your first solution and (in code) treat zero as one. We're dealing with milliseconds here, not seconds...

@fredso90
Copy link
Contributor Author

Another option is to have the lower limit set to 1, and add a conditional that makes LargeChange and SmallChange 99 and 9 respectively if it's set to 1. What do you think about such a solution?

Wayyy too complicated. I suggest to go with your first solution and (in code) treat zero as one. We're dealing with milliseconds here, not seconds...

True. That would be overengineering a simple problem. Okay. I'll add the workaround again, and then let the core team have the final say.

Reintroducing workaround
Changed the minimum values for FadeDelayMs and FadeDuration back to 0.
@fredso90 fredso90 marked this pull request as ready for review October 22, 2023 21:50
Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution!
I don't think this actually solves the issue it states. The issue asks for different colors for double click.
But I think this is a way for people to distinguish double clicks if they want to, so it's still useful.

@jaimecbernardo jaimecbernardo merged commit 8eb4867 into microsoft:main Oct 24, 2023
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

Successfully merging this pull request may close these issues.

4 participants