mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 22:28:13 +00:00
[Enhancement] Hide export buttons during export
Buttons temporarily hide until export completes.
This commit is contained in:
@ -21,7 +21,7 @@
|
|||||||
-->
|
-->
|
||||||
<span ng-controller="PlotController as plot"
|
<span ng-controller="PlotController as plot"
|
||||||
class="abs holder holder-plot">
|
class="abs holder holder-plot">
|
||||||
<span class="l-btn-set">
|
<span class="l-btn-set" ng-show="!plot.hideExportButtons">
|
||||||
<a class="s-button t-export icon-download labeled first"
|
<a class="s-button t-export icon-download labeled first"
|
||||||
ng-click="plot.exportJPG()"
|
ng-click="plot.exportJPG()"
|
||||||
title="Export This View's Data as JPG">
|
title="Export This View's Data as JPG">
|
||||||
|
@ -373,21 +373,33 @@ define(
|
|||||||
* Export the plot to PDF
|
* Export the plot to PDF
|
||||||
*/
|
*/
|
||||||
PlotController.prototype.exportPDF = function () {
|
PlotController.prototype.exportPDF = function () {
|
||||||
this.ExportImageService.exportPDF(this.$element[0], "plot.pdf");
|
var self = this;
|
||||||
|
self.hideExportButtons = true;
|
||||||
|
self.ExportImageService.exportPDF(self.$element[0], "plot.pdf", function() {
|
||||||
|
self.hideExportButtons = false;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export the plot to PNG
|
* Export the plot to PNG
|
||||||
*/
|
*/
|
||||||
PlotController.prototype.exportPNG = function () {
|
PlotController.prototype.exportPNG = function () {
|
||||||
this.ExportImageService.exportPNG(this.$element[0], "plot.png");
|
var self = this;
|
||||||
|
self.hideExportButtons = true;
|
||||||
|
self.ExportImageService.exportPNG(self.$element[0], "plot.png", function() {
|
||||||
|
self.hideExportButtons = false;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export the plot to JPG
|
* Export the plot to JPG
|
||||||
*/
|
*/
|
||||||
PlotController.prototype.exportJPG = function () {
|
PlotController.prototype.exportJPG = function () {
|
||||||
this.ExportImageService.exportJPG(this.$element[0], "plot.jpg");
|
var self = this;
|
||||||
|
self.hideExportButtons = true;
|
||||||
|
self.ExportImageService.exportJPG(self.$element[0], "plot.jpg", function() {
|
||||||
|
self.hideExportButtons = false;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return PlotController;
|
return PlotController;
|
||||||
|
@ -71,23 +71,32 @@ define(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportImageService.prototype.exportPDF = function (element, filename) {
|
ExportImageService.prototype.exportPDF = function (element, filename, callback) {
|
||||||
|
callback = typeof callback === "function" ? callback : function () {};
|
||||||
|
|
||||||
renderElement(element, function (img) {
|
renderElement(element, function (img) {
|
||||||
var pdf = new jsPDF("l", "px", [element.offsetHeight, element.offsetWidth]);
|
var pdf = new jsPDF("l", "px", [element.offsetHeight, element.offsetWidth]);
|
||||||
pdf.addImage(img, "JPEG", 0, 0, element.offsetWidth, element.offsetHeight);
|
pdf.addImage(img, "JPEG", 0, 0, element.offsetWidth, element.offsetHeight);
|
||||||
pdf.save(filename);
|
pdf.save(filename);
|
||||||
|
callback();
|
||||||
}, "jpeg");
|
}, "jpeg");
|
||||||
};
|
};
|
||||||
|
|
||||||
ExportImageService.prototype.exportJPG = function (element, filename) {
|
ExportImageService.prototype.exportJPG = function (element, filename, callback) {
|
||||||
|
callback = typeof callback === "function" ? callback : function () {};
|
||||||
|
|
||||||
renderElement(element, function (img) {
|
renderElement(element, function (img) {
|
||||||
saveAs(img, filename);
|
saveAs(img, filename);
|
||||||
|
callback();
|
||||||
}, "blob");
|
}, "blob");
|
||||||
};
|
};
|
||||||
|
|
||||||
ExportImageService.prototype.exportPNG = function (element, filename) {
|
ExportImageService.prototype.exportPNG = function (element, filename, callback) {
|
||||||
|
callback = typeof callback === "function" ? callback : function () {};
|
||||||
|
|
||||||
renderElement(element, function (img) {
|
renderElement(element, function (img) {
|
||||||
saveAs(img, filename);
|
saveAs(img, filename);
|
||||||
|
callback();
|
||||||
}, "blob");
|
}, "blob");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user