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: custom drawing render #271

Merged
merged 2 commits into from
May 27, 2024
Merged

Conversation

chrismclarke
Copy link
Collaborator

@chrismclarke chrismclarke commented May 13, 2024

Description

Targets PR #270 to help fix issue of generated SVG not rendering.

  • Fix issue where svg paths not correctly calculated relative to container
  • Add dialog to make it easier to draw in larger area

Discussion

The main issue appears to be not actually related to rendering, but the positioning of the generated paths. When using the drawing tool within another container the generated path sits outside of the container (path is calculated relative to the entire page not the current container)

There is possibly a separate issue where listening for mouse events don't correctly support setPointerCapture operation, and so have been replaced by pointer events - TBC whether these still work on touch devices... (follow-up PR)

While trying to diagnose the issue I also did a quick github search for projects that use both perfect-freehand with angular:
https://github.com/search?q=perfect-freehand+angular+language%3AJSON&type=code

An interesting project that stuck out was: https://github.com/mostafazke/ng-whiteboard
I think the component is possibly a little overly complex for our current use case, but may be of future interest if trying to expand to a more feature-rich whiteboard.

Screenshots / Videos

Before - svg path renders outside area of svg element (and so does not show). drawing will only work if drawing container fixed to top-left corner ([0,0] position)

Screenity.video.-.May.13.2024.1.webm

After - svg path correctly computes to relative container

Screenity.video.-.May.13.2024.webm

@github-actions github-actions bot added fix and removed fix labels May 13, 2024
@chrismclarke chrismclarke requested a review from FaithDaka May 13, 2024 21:28
@chrismclarke chrismclarke marked this pull request as ready for review May 13, 2024 21:29
@FaithDaka FaithDaka merged commit ffa566b into feat-custom-drawing May 27, 2024
1 check passed
@FaithDaka FaithDaka deleted the fix/custom-drawing-render branch May 27, 2024 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants