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

Always call resizeCanvas #15870

Merged
merged 3 commits into from
Nov 22, 2024
Merged

Always call resizeCanvas #15870

merged 3 commits into from
Nov 22, 2024

Conversation

marcusmoore
Copy link
Collaborator

Description

This PR partially addresses an issue (#15530) with the signature pad on small screens.

Currently, rendering the signature pad on very small screens (less than 470px it seems like) has two issues:

  • The lines are blurry
  • The lines progressively appear further to the right of the cursor location the further right the line is drawn:
    Current issue

With this PR the lines are drawn accurately and more clear:
CleanShot 2024-11-21 at 14 39 44

This is achieved by always calling the function that handles high DPI screens and also re-calling it when the screen is re-sized.

But, two things I've noticed is that manually re-sizing the window from large to small or opening/closing the sidebar still exhibit the previous behavior. I'm opening this PR as-is since I think the major problem is solved and I couldn't find an easy solution for the last two issues.


The diff for this looks worse than it is. Showing No Whitespace makes it a lot clearer since I removed an if block and de-indented a chunk of code.


This builds on the work in #14577

Fixes #15530

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@marcusmoore marcusmoore requested a review from snipe as a code owner November 21, 2024 22:54
Copy link

what-the-diff bot commented Nov 21, 2024

PR Summary

  • Initialization of SignaturePad: We've positioned the initialization of signaturePad at the beginning of the script. This leads to more efficient setup and use of this section of the application.
  • Enhancements to the Resize Function: We've refined the explanatory comments within the resize function, even providing a URL for further insights into handling high DPI (dots per inch) scenarios. This improves understanding of how the function handles differently sized screens.
  • Inclusion of SignaturePad Clear Function: We're now employing the signaturePad.clear() method within the resizeCanvas function. This guarantees accurate operation whenever the screen size alters, avoiding any potential inconsistencies.
  • Minor Revisions in Comments: A few comments have been reworded to give clearer understanding, particularly around matters connected to mobile and DPI concerns. These changes make the script more comprehensible and easier to maintain.

@snipe snipe merged commit f125c90 into snipe:develop Nov 22, 2024
9 checks passed
@marcusmoore marcusmoore deleted the bug/sc-26857 branch November 22, 2024 01:00
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.

2 participants