Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
54fd4251
Commit
54fd4251
authored
May 06, 2017
by
amandaghassaei
Browse files
save svg
parent
cd41ba82
Changes
2
Show whitespace changes
Inline
Side-by-side
js/controls.js
View file @
54fd4251
...
...
@@ -112,6 +112,10 @@ function initControls(globals){
globals
.
threeView
.
saveSVG
();
});
setLink
(
"
#saveSVG
"
,
function
(){
globals
.
pattern
.
saveSVG
();
});
setCheckbox
(
"
#ambientOcclusion
"
,
globals
.
ambientOcclusion
,
function
(
val
){
globals
.
ambientOcclusion
=
val
;
});
...
...
js/pattern.js
View file @
54fd4251
...
...
@@ -638,8 +638,27 @@ function initPattern(globals){
};
}
function
saveSVG
(){
if
(
globals
.
extension
==
"
fold
"
){
//todo solve for crease pattern
globals
.
warn
(
"
No crease pattern available for FOLD format.
"
);
return
;
}
var
serializer
=
new
XMLSerializer
();
var
source
=
serializer
.
serializeToString
(
document
.
getElementById
(
"
mySVG
"
));
var
svgBlob
=
new
Blob
([
source
],
{
type
:
"
image/svg+xml;charset=utf-8
"
});
var
svgUrl
=
URL
.
createObjectURL
(
svgBlob
);
var
downloadLink
=
document
.
createElement
(
"
a
"
);
downloadLink
.
href
=
svgUrl
;
downloadLink
.
download
=
globals
.
filename
+
"
.svg
"
;
document
.
body
.
appendChild
(
downloadLink
);
downloadLink
.
click
();
document
.
body
.
removeChild
(
downloadLink
);
}
return
{
loadSVG
:
loadSVG
,
saveSVG
:
saveSVG
,
getFacesAndVerticesForEdges
:
getFacesAndVerticesForEdges
,
triangulatePolys
:
triangulatePolys
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment