Skip to content

Commit

Permalink
Handle no maps case print layout
Browse files Browse the repository at this point in the history
  • Loading branch information
volterra79 committed Feb 27, 2024
1 parent 6bbdb38 commit 62047f2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/app/gui/print/printservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ function PrintComponentService() {
maxx: [0, 0],
maxy: [0, 0]
};
this.state.visible && this.setInitState();
if (this.state.visible) {
this.setInitState();
}
};
}

Expand Down Expand Up @@ -261,6 +263,7 @@ proto.changeTemplate = function() {
return;
}
const isPreviousAtlas = this.state.atlas;
const isPreviousNoMaps = 0 === this.state.maps.length; /** since 3.10.0 **/
const {
atlas,
maps,
Expand All @@ -274,7 +277,7 @@ proto.changeTemplate = function() {

this._clearPrint() :

isPreviousAtlas ?
isPreviousAtlas || isPreviousNoMaps ?
this.showPrintArea(true) :
this._setPrintArea();
};
Expand All @@ -283,7 +286,9 @@ proto.changeTemplate = function() {
* On change scala set print area
*/
proto.changeScale = function() {
this.state.scala && this._setPrintArea();
if (this.state.scala) {
this._setPrintArea();
}
};

/**
Expand Down Expand Up @@ -372,6 +377,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;
Expand Down Expand Up @@ -496,6 +502,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);
Expand Down

0 comments on commit 62047f2

Please sign in to comment.