Skip to content

Commit

Permalink
Merge pull request #32 from cs-qyzhang/master
Browse files Browse the repository at this point in the history
Reserve the original size of image
  • Loading branch information
gavin-ts authored Nov 28, 2023
2 parents 766dc41 + 8f67cb1 commit ca41eb2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,11 @@ export class D2Processor {
const svg = parser.parseFromString(image, "image/svg+xml");
const containerEl = el.createDiv();

containerEl.style.maxHeight = `${this.plugin.settings.containerHeight}px`;
containerEl.style.height = "100vh";
containerEl.style.width = "100%";
containerEl.style.position = "relative";

const svgEl = svg.documentElement;
svgEl.style.position = "absolute";
svgEl.style.width = "100%";
svgEl.style.height = "100%";
svgEl.style.maxHeight = `${this.plugin.settings.containerHeight}px`;
svgEl.style.maxWidth = "100%";
svgEl.style.height = "fit-content";
svgEl.style.width = "fit-content";

containerEl.innerHTML = this.sanitizeSVGIDs(svgEl, ctx.docId);
}
Expand Down Expand Up @@ -194,6 +190,7 @@ export class D2Processor {
`--pad=${this.plugin.settings.pad}`,
`--sketch=${this.plugin.settings.sketch}`,
"--bundle=false",
"--scale=1",
];
const cmd = args.join(" ");
const child = exec(cmd, options);
Expand Down

0 comments on commit ca41eb2

Please sign in to comment.