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

chore: enhace the SVG usage in visual editor #1987

Merged
merged 23 commits into from
Feb 14, 2020
Merged

Conversation

yeze322
Copy link
Contributor

@yeze322 yeze322 commented Feb 12, 2020

Description

closes #1497
resovles #1906

This PR improves the usage of SVG elements in VisualEditor, with the improvements, several pixel issues are fixed (#1906 ) and #1497 wil be closed.

Details

Covered 3 areas of changes:

- Area Description
1 SVG semantic structure [before] create a <svg /> container per edge -> [after] multiple edges share one svg container
2 Fix pixel issues fix the line cap/miter problem; fix the trailing circle not aligned issue; '+' icon size aligns to design
3 Implement the EdgeUtil lib retire the old lib EdgeComponent which doesn't follows svg conventions

1. semantic svg

  • Multiple edges now share one <svg /> container (compared to previous solution, create a new svg container for every edge).
    // before
    <svg><line /></svg>
    <svg><line /></svg>
    
    // now
    <svg>
      <line />
      <line />
    </svg>
  • The trailing circle is implemented as a <circle /> element
    // before
    <div style={{ borderRadius: '16px', border: '2px solid #979797' }} />
    // after
    <circle r="8" cx="50" cy="50" fill="none" stroke="#979797" strokeWidth="2" />
    It also fixes the circle alignment problem.
  • An arrowhead is drawn by <polyline /> instead of two lines

2. fix pixel issues

  • fix the trailing circle alignment issue (by drawing it with svg.circle)
    [now]
    image
    [before]
    image
  • fix the line cap/miter problem appears in an arrowhead (reported by William)
    [now]
    image
    [before]
    image
  • Adds button on edge
    image

3. EdgeUtil lib:
As a result of 1&2, this PR contains a new lib for drawing edges and retires the old one EdgeComponent.
image

image

Task Item

#1497
#1906

Screenshots

@github-actions
Copy link

Coverage Status

Coverage decreased (-0.3%) to 41.93% when pulling e346cc8 on visual/edgeUtils into db96de4 on master.

@yeze322 yeze322 changed the title refactor: Implement a better EdgeUtil in visual editor refactor: enhace the SVG usage in visual editor Feb 13, 2020
@yeze322 yeze322 changed the title refactor: enhace the SVG usage in visual editor chore: enhace the SVG usage in visual editor Feb 13, 2020
@yeze322 yeze322 marked this pull request as ready for review February 13, 2020 13:44
@cwhitten cwhitten merged commit eb9a5fc into master Feb 14, 2020
@cwhitten cwhitten deleted the visual/edgeUtils branch February 14, 2020 18:34
@a-b-r-o-w-n a-b-r-o-w-n mentioned this pull request Feb 21, 2020
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.

3 participants