From de9b5434bb47b7425cd45ae7a3d686153f6abacd Mon Sep 17 00:00:00 2001 From: Benjamin Gerber Date: Mon, 11 Feb 2019 12:59:58 +0100 Subject: [PATCH] Can set rotate maske and disable legend per default --- contribs/gmf/src/directives/print.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/contribs/gmf/src/directives/print.js b/contribs/gmf/src/directives/print.js index 11d8e4d3d690..51e85b9065de 100644 --- a/contribs/gmf/src/directives/print.js +++ b/contribs/gmf/src/directives/print.js @@ -199,14 +199,13 @@ gmf.PrintController = function($element, $rootScope, $scope, $timeout, $q, $inje * @type {boolean} * @private */ - this.rotateMask_ = this['rotateMask'] ? this['rotateMask']() : false; + this.rotateMask_ = false; /** * @type {Object.!} * @private */ - this.fieldValues_ = this['fieldValues'] ? - this['fieldValues']() : {}; + this.fieldValues_ = {}; /** * @type {angular.Scope} @@ -472,6 +471,15 @@ gmf.PrintController = function($element, $rootScope, $scope, $timeout, $q, $inje }; +/** + * Init the controller + */ +gmf.PrintController.prototype.$onInit = function() { + this.rotateMask_ = this['rotateMask'] ? this['rotateMask']() : false; + this.fieldValues_ = this['fieldValues'] ? this['fieldValues']() : {}; +}; + + /** * @param {boolean} active True to listen events related to the print and get * capabilities. False to stop listen them and set rotation to 0. @@ -572,11 +580,7 @@ gmf.PrintController.prototype.updateFields_ = function() { this.updateCustomFields_(); - const legend = this.isAttributeInCurrentLayout_('legend'); - if (this.layoutInfo.legend === undefined) { - this.layoutInfo.legend = !!(legend !== undefined ? - legend : this.fieldValues_['legend']); - } + this.layoutInfo.legend = this.fieldValues_['legend'] !== false; this.layoutInfo.scales = clientInfo['scales'] || []; this.layoutInfo.dpis = clientInfo['dpiSuggestions'] || [];