diff --git a/src/app/gui/print/printservice.js b/src/app/gui/print/printservice.js index 89d95c1d8..04fff8e3d 100644 --- a/src/app/gui/print/printservice.js +++ b/src/app/gui/print/printservice.js @@ -224,7 +224,9 @@ function PrintComponentService() { maxx: [0, 0], maxy: [0, 0] }; - this.state.visible && this.setInitState(); + if (this.state.visible) { + this.setInitState(); + } }; } @@ -261,30 +263,30 @@ proto.changeTemplate = function() { if (!this.state.template) { return; } - const isPreviousAtlas = this.state.atlas; - const { - atlas, - maps, - labels - } = this.state.print.find(print => print.name === this.state.template); - this.state.maps = maps; - this.state.atlas = atlas; - this.state.labels = labels; - this.state.atlasValues = []; - this.state.atlas ? + const has_previous = this.state.atlas || 0 === this.state.maps.length; + const print = this.state.print.find(p => p.name === this.state.template) - this._clearPrint() : + this.state.maps = print.maps; + this.state.atlas = print.atlas; + this.state.labels = print.labels; + this.state.atlasValues = []; - isPreviousAtlas ? - this.showPrintArea(true) : - this._setPrintArea(); + if (this.state.atlas) { + this._clearPrint(); + } else if (has_previous) { + this.showPrintArea(true); + } else { + this._setPrintArea(); + } }; /** * On change scala set print area */ proto.changeScale = function() { - this.state.scala && this._setPrintArea(); + if (this.state.scala) { + this._setPrintArea(); + } }; /** @@ -373,6 +375,7 @@ proto.print = function() { return new Promise((resolve, reject) => { //disable sidebar GUI.disableSideBar(true); + //atlas print if (this.state.atlas) { const caller_download_id = ApplicationService.setDownload(true); this.state.loading = true; @@ -497,6 +500,11 @@ proto._calculateInternalPrintExtent = function() { * @private */ proto._setPrintArea = function() { + //No maps set. Only attributes label + if (0 === this.state.maps.length) { + this._clearPrint(); + return; + } this.state.size = this._map.getSize(); const resolution = this._map.getView().getResolution(); this.state.currentScala = getScaleFromResolution(resolution, this._mapUnits); diff --git a/src/app/gui/print/vue/printpage.js b/src/app/gui/print/vue/printpage.js index 9be7a1144..23b525d06 100644 --- a/src/app/gui/print/vue/printpage.js +++ b/src/app/gui/print/vue/printpage.js @@ -23,7 +23,6 @@ const PrintPage = function(options={}) { inherit(PrintPage, Component); - module.exports = PrintPage; diff --git a/src/components/Print.vue b/src/components/Print.vue index ed4037a6a..28ff1f280 100644 --- a/src/components/Print.vue +++ b/src/components/Print.vue @@ -32,6 +32,7 @@ - + - + - + @@ -62,36 +85,55 @@ -