Commit 27477440 authored by Anton Petrov's avatar Anton Petrov
Browse files

Enable saving 2D image as a png

parent 6be2af28
......@@ -64,6 +64,13 @@ var secondary_structures = {
});
};
ctrl.downloadPng = function() {
document.getElementById('svg-pan-zoom-controls').setAttribute('visibility', 'hidden');
saveSvgAsPng(document.querySelector("#rna_ss_traveler svg"), "2D diagram.png").then(function(){
document.getElementById('svg-pan-zoom-controls').setAttribute('visibility', 'visible');
});
}
ctrl.displaySecondary = function() {
if (ctrl.numStructures === 0) {
return;
......
......@@ -33,6 +33,7 @@
<div>
<a class="btn btn-default" id="2d-traveler-toggle-colors" ng-click="$ctrl.toggleColors()">Toggle colours</a>
<a class="btn btn-default" id="2d-traveler-download-png" ng-click="$ctrl.downloadPng()">Download PNG</a>
</div>
<div id="rna_ss_traveler" class="thumbnail col-md-12 col-sm-12 col-xs-12" style="overflow: auto;"></div>
......
......@@ -47,6 +47,7 @@
"json3": "^3.3.2",
"moment": "^2.18.1",
"query": "^0.2.0",
"save-svg-as-png": "^1.4.14",
"slick-carousel": "^1.8.1",
"svg-pan-zoom": "^3.6.0",
"timelinejs3": "^3.4.0",
......
......@@ -165,6 +165,7 @@ limitations under the License.
<script src="{% static "node_modules/jquery.mousewheel/jquery.mousewheel.js" %}"></script>
<script src="{% static "node_modules/tipsy-1a/src/javascripts/jquery.tipsy.js" %}"></script>
<script src="{% static "node_modules/svg-pan-zoom/dist/svg-pan-zoom.js" %}"></script>
<script src="{% static "node_modules/save-svg-as-png/lib/saveSvgAsPng.js" %}"></script>
<!-- New genoverse contains tooltip from jquery ui, it conflicts with bootstrap - bridge it! -->
<!-- Bridge doesn't work now
<!-- <script>$.widget.bridge('uitooltip', $.ui.tooltip);</script> -->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment