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
medema-group
BiG-SCAPE
Commits
d9872e16
Commit
d9872e16
authored
Nov 14, 2018
by
Kautsar, Satria
Browse files
Implement export function on GCF tree SVGs
parent
c713e0fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
html_template/output/html_content/js/bigscape.js
View file @
d9872e16
...
...
@@ -1038,7 +1038,31 @@ BigscapeFunc.openFamDetail = function(id_fam, ids_highlighted, bs_svg, bs_data,
var
btnPanDown
=
$
(
"
<button>down</button>
"
).
click
({
treeSVG
:
treeSVG
,
tempG
:
tempG
,
direction
:
"
down
"
},
panDirection
).
appendTo
(
panZoomTree
);
var
btnPanUp
=
$
(
"
<button>left</button>
"
).
click
({
treeSVG
:
treeSVG
,
tempG
:
tempG
,
direction
:
"
left
"
},
panDirection
).
appendTo
(
panZoomTree
);
var
btnPanDown
=
$
(
"
<button>right</button>
"
).
click
({
treeSVG
:
treeSVG
,
tempG
:
tempG
,
direction
:
"
right
"
},
panDirection
).
appendTo
(
panZoomTree
);
// button to save .svg
function
exportSVG
(
handler
)
{
var
toBeExported
=
handler
.
data
.
treeSVG
.
clone
(
false
,
false
);
toBeExported
.
find
(
"
*
"
).
removeAttr
(
"
svgjs:data
"
);
toBeExported
.
attr
({
"
version
"
:
"
1.1
"
,
"
baseprofile
"
:
"
full
"
,
"
xmlns
"
:
"
http://www.w3.org/2000/svg
"
,
"
xmlns:xlink
"
:
"
http://www.w3.org/1999/xlink
"
,
"
xmlns:ev
"
:
"
http://www.w3.org/2001/xml-events
"
});
var
svg_text
=
toBeExported
[
0
].
outerHTML
;
downloadLink
=
$
(
"
<a>download</a>
"
);
downloadLink
.
attr
({
"
href
"
:
'
data:image/svg+xml;charset=utf-8,
'
+
encodeURIComponent
(
svg_text
),
"
download
"
:
handler
.
data
.
gcf_id
+
"
.svg
"
,
"
display
"
:
"
none
"
});
downloadLink
.
appendTo
(
$
(
"
body
"
));
downloadLink
[
0
].
click
();
downloadLink
.
remove
();
}
var
exportTree
=
$
(
"
<div></div>
"
).
appendTo
(
treeContainer
);
var
btnExport
=
$
(
"
<button>Download SVG</button>
"
).
click
({
treeSVG
:
treeSVG
,
gcf_id
:
bs_families
[
id_fam
][
"
id
"
]},
exportSVG
).
appendTo
(
exportTree
);
// hide domains....*temp*
//treeSVG.find("polygon.arrower-domain").css("display", "none");
...
...
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