microsoft / microsoft/maker.js

Not Indexing full svg path while making model fromSVGPathData

Open
#569 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2k
Forks
302
Avg merge
21h 28m
Merged PRs (30d)
5

Description

Trying to make model with simple below svg path

M249.286 106.372L471.068 327.86 
H471.068 27.505 27.505 L249.286 106.37200000000001Z

This is the preview of svg path.
image

I am making model with bolow code.

const svgPath=`M249.286 106.372L471.068 327.86 
H471.068 27.505 27.505 L249.286 106.37200000000001Z`

const makerModel=makerjs.importer.fromSVGPathData(svgPath);

Due to some reason it is not indexing some of lines.

const svg=makerjs.exporter.toSVG(makerModel);

Response of final svg becomes like below
image

Final svg output
<svg width="221.782" height="221.488" viewBox="0 0 221.782 221.488" xmlns="http://www.w3.org/2000/svg"><g id="svgGroup" stroke-linecap="round" fill-rule="evenodd" font-size="9pt" stroke="#000" stroke-width="0.25mm" fill="none" style="stroke:#000;stroke-width:0.25mm;fill:none"><path d="M 0 0 L 221.782 221.488 L 0 0 Z" vector-effect="non-scaling-stroke"/></g></svg>

It should give same output as input.

Code reproduced link

### Tasks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the linked CodeSandbox reproduction and start at importer.fromSVGPathData, comparing its result with exporter.toSVG. Done means the complete SVG path, including the H command coordinates and closing segment, is preserved in the exported SVG; add or run a regression check if the repository provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.