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

Do not double update color channels when their associated entry text is changed programmatically, fixes #2075 #2109

Merged
merged 2 commits into from Mar 26, 2021

Conversation

fpabl0
Copy link
Member

@fpabl0 fpabl0 commented Mar 23, 2021

Description:

Fixes #2075

While this PR fixes #2075, color picker still has some problems on mobile, when the user move the slider in one of the R G B channels, the remaining RGB channels are moved too sometimes 😞

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@andydotxyz
Copy link
Member

Thanks for this fix.
I wonder though - do you have a thought on why this happens on mobile apps but not desktop?
Perhaps there is a bug elsewhere that we are working around here?

@fpabl0
Copy link
Member Author

fpabl0 commented Mar 23, 2021

I wonder though - do you have a thought on why this happens on mobile apps but not desktop?

My thought is that it is caused due to the performance differences between mobile and desktop drivers. If you look carefully color picker seems to refresh things in a cyclic way:

  • It updates the slider value when entry text change.
  • It updates the entry text when the slider value change.

The Refresh by other hand set the entry text value and set the slider value, that results in multiple updates due to points above. If the two above points are executed enough fast we don't see the problem because it is the same value (desktop case) - although it is not performant. In mobile, these points are not executed so fast, so they overlaps each other with the next value updates. That cause that OnChanged callback in Entry tries to update colorChannel to different value comparing to the OnChanged callback in the slider. So it keeps changing forever because they can't be agreed which value is the right one.

@fpabl0
Copy link
Member Author

fpabl0 commented Mar 23, 2021

Perhaps there is a bug elsewhere that we are working around here?

I would say the bug is in desktop and mobile, but desktop is enough fast to mitigate it, while mobile cannot.

@andydotxyz
Copy link
Member

Let me know when are happy to landed this @fpabl0 an I will cherry pick it to the release branch

@fpabl0 fpabl0 merged commit 1a6c38f into fyne-io:develop Mar 26, 2021
@fpabl0
Copy link
Member Author

fpabl0 commented Mar 26, 2021

@andydotxyz Landed :)

@andydotxyz
Copy link
Member

Thanks, picked over

@fpabl0 fpabl0 deleted the fix/2075 branch April 4, 2021 17:03
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.

None yet

2 participants