Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gerber2img
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Quentin Bolsee
gerber2img
Commits
594da506
Commit
594da506
authored
1 year ago
by
Quentin Bolsee
Browse files
Options
Downloads
Patches
Plain Diff
SVG download
parent
13fdb85e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#29202
passed
1 year ago
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.html
+2
-2
2 additions, 2 deletions
index.html
src/interface.js
+15
-4
15 additions, 4 deletions
src/interface.js
with
17 additions
and
6 deletions
index.html
+
2
−
2
View file @
594da506
...
...
@@ -23,7 +23,7 @@
<div>
<!-- <button class="interface" id="loadButton">Load file(s)...</button></input> -->
<button
class=
"interface"
id=
"downloadRenderButton"
>
Download render
</button>
<button
class=
"interface"
id=
"downloadlayersButton"
>
Download layers
</button>
<!--
<button class="interface" id="downloadlayersButton">Download layers</button>
-->
</div>
</div>
<div
class=
"panel"
>
...
...
@@ -37,7 +37,7 @@
</div>
<div>
<input
type=
"checkbox"
id=
"settingsAsSVG"
checked=
un
checked
>
<input
type=
"checkbox"
id=
"settingsAsSVG"
disabled=
"true"
checked=
checked
>
<label
for=
"settingsAsSVG"
>
Download as SVG
</label>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/interface.js
+
15
−
4
View file @
594da506
...
...
@@ -217,7 +217,18 @@ function downloadImage(separateLayers=false) {
return
;
}
saveSvg
.
saveSvgAsPng
(
svgElem
,
"
diagram.png
"
);
let
svgTxt
=
new
XMLSerializer
().
serializeToString
(
svgElem
);
let
url
=
"
data:image/svg+xml;charset=utf-8,
"
+
encodeURIComponent
(
svgTxt
);
let
downloadLink
=
document
.
createElement
(
"
a
"
);
downloadLink
.
href
=
url
;
downloadLink
.
download
=
"
render.svg
"
;
document
.
body
.
appendChild
(
downloadLink
);
downloadLink
.
click
();
document
.
body
.
removeChild
(
downloadLink
);
// window.URL.revokeObjectURL(url);
// document.getElementById("link").href = url;
// saveSvg.saveSvgAsPng(svgElem, "diagram.png");
// if (isNaN(globalSettings.svgDim[0])) {
// return;
// }
...
...
@@ -452,9 +463,9 @@ document.getElementById("downloadRenderButton").addEventListener("click", () =>
downloadImage
(
false
);
});
document
.
getElementById
(
"
downloadlayersButton
"
).
addEventListener
(
"
click
"
,
()
=>
{
downloadImage
(
true
);
});
//
document.getElementById("downloadlayersButton").addEventListener("click", () => {
//
downloadImage(true);
//
});
readSettings
();
initListeners
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment