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

Fix zoom on first click #83826

Merged
merged 3 commits into from Nov 5, 2019
Merged

Fix zoom on first click #83826

merged 3 commits into from Nov 5, 2019

Conversation

MartinBrathen
Copy link
Contributor

This PR fixes #81877

The problem was that fast clicks would zoom on first click. I fixed this by adding the state variable isActive that keeps track of when the preview is active or not.

I also changed the name of a function from changeActive(value) to setActive(value) to make the code more intuitive.

I moved a postMessage call out of the update() function to avoid unnecessary calls.

Please let me know if any of these last two changes are unwanted and I'll revert them.

@MartinBrathen
Copy link
Contributor Author

@mjbvz I've found a bug where the webviewEditor.onDidChangeViewState eventhandler will not be called in the case where the user performs these actions:

  1. Open two images in split view. Image A & B.
  2. Click on image A to ensure it has focus.
  3. press ctrl | alt + [appropriate number] to give image B focus.
  4. Now click on image A

webviewEditor.onDidChangeViewState should get triggered and you should also see how image A gains focus, but this does not happen.

When trying this on stable 1.39.2 the same visual bug appears, where image A does not seem to get focus.

This bug effects this PR and #82074 since both rely on webviewEditor.onDidChangeViewState being triggered.

webviewEditor.onDidChangeViewState(() => {

@mjbvz mjbvz self-assigned this Nov 1, 2019
@mjbvz mjbvz merged commit c53db9b into microsoft:master Nov 5, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Nov 5, 2019

Thanks. The fix looks good! Can you open a new issue for the webview problem so I can investigate

@mjbvz mjbvz added this to the November 2019 milestone Nov 5, 2019
@MartinBrathen
Copy link
Contributor Author

Thanks! I'll have it done by tomorrow.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image preview should not zoom on first click if unfocused
2 participants