diff --git a/pom.xml b/pom.xml index 64217ac..f5f42c4 100644 --- a/pom.xml +++ b/pom.xml @@ -86,6 +86,11 @@ + + de.conterra.mapapps + mapapps-maven-plugin + ${mapapps.version} + de.conterra.jsregistry ct-jsregistry-maven-plugin diff --git a/src/main/js/bundles/dn_printingenhanced/PrintingEnhancedWidget.vue b/src/main/js/bundles/dn_printingenhanced/PrintingEnhancedWidget.vue index c990c31..fddb193 100644 --- a/src/main/js/bundles/dn_printingenhanced/PrintingEnhancedWidget.vue +++ b/src/main/js/bundles/dn_printingenhanced/PrintingEnhancedWidget.vue @@ -241,14 +241,6 @@ } this.layout = "MAP_ONLY"; } - }, - scaleEnabled: function(scaleEnabled) { - if (scaleEnabled === false) { - this.enablePrintPreview = false; - } - if (scaleEnabled && !this.visibleUiElements.printPreviewCheckbox) { - this.enablePrintPreview = this.printPreviewInitallyVisible; - } } }, mounted: function () { @@ -257,9 +249,6 @@ } else { this.activeTab = 0; } - if (!this.visibleUiElements.printPreviewCheckbox) { - this.printPreviewInitallyVisible = this.enablePrintPreview; - } this.$emit('startup'); }, methods: { diff --git a/src/main/js/bundles/dn_printingenhanced/PrintingEnhancedWidgetFactory.js b/src/main/js/bundles/dn_printingenhanced/PrintingEnhancedWidgetFactory.js index a848800..c3f08ab 100644 --- a/src/main/js/bundles/dn_printingenhanced/PrintingEnhancedWidgetFactory.js +++ b/src/main/js/bundles/dn_printingenhanced/PrintingEnhancedWidgetFactory.js @@ -26,7 +26,7 @@ export default class PrintingEnhancedWidgetFactory { } createInstance() { - return new VueDijit(this.vm, {class: "printing-enhanced-widget"}); + return new VueDijit(this.vm, { class: "printing-enhanced-widget" }); } _initComponent() { @@ -88,9 +88,10 @@ export default class PrintingEnhancedWidgetFactory { "legendEnabled": false, "attributionEnabled": false }; - vm.visibleUiElements = {...defaultVisibleUiElements, ...properties.visibleUiElements}; + vm.visibleUiElements = { ...defaultVisibleUiElements, ...properties.visibleUiElements }; vm.dpiValues = properties.dpiValues; vm.scaleValues = properties.scaleValues; + vm.enablePrintPreview = properties.enablePrintPreview; // listen to view model methods vm.$on('print', () => { esriPrintWidget._handlePrintMap(); @@ -100,7 +101,20 @@ export default class PrintingEnhancedWidgetFactory { }); Binding.for(vm, printingPreviewController) - .syncAll("enablePrintPreview") + .syncToRight("enablePrintPreview", "drawPrintPreview", (enablePrintPreview) => { + if (enablePrintPreview && vm.scaleEnabled) { + return true; + } else { + return false; + } + }) + .syncToRight("scaleEnabled", "drawPrintPreview", (scaleEnabled) => { + if (scaleEnabled && vm.enablePrintPreview) { + return true; + } else { + return false; + } + }) .enable() .syncToLeftNow(); diff --git a/src/main/js/bundles/dn_printingenhanced/PrintingPreviewController.js b/src/main/js/bundles/dn_printingenhanced/PrintingPreviewController.js index f443cf5..0615b0f 100644 --- a/src/main/js/bundles/dn_printingenhanced/PrintingPreviewController.js +++ b/src/main/js/bundles/dn_printingenhanced/PrintingPreviewController.js @@ -32,14 +32,14 @@ const _view = Symbol("_view"); export default declare({ - enablePrintPreview: false, + drawPrintPreview: false, activate() { const printWidget = this._printingWidget; const esriPrintWidget = printWidget._esriWidget; const printViewModel = esriPrintWidget.viewModel; const properties = this._printingEnhancedProperties._properties; - this.enablePrintPreview = properties.enablePrintPreview; + this.drawPrintPreview = properties.enablePrintPreview && properties.scaleEnabled; // get print infos const url = this[_printServiceUrl] = esriPrintWidget.printServiceUrl; @@ -81,20 +81,22 @@ export default declare({ } } // set sketching properties to view - const view = printViewModel.view; - this._oldRotation = null; - this._oldScale = view.scale; - if (properties.enablePrintPreviewMovement) { - if (this._printExtent) { - view.extent = this._printExtent; - this._oldRotation = view.rotation; - view.rotation = this._printRotation; - } else { - this._oldRotation = view.rotation; - view.rotation = 0; + if(printTemplate.scalePreserved) { + const view = printViewModel.view; + this._oldRotation = null; + this._oldScale = view.scale; + if (properties.enablePrintPreviewMovement) { + if (this._printExtent) { + view.extent = this._printExtent; + this._oldRotation = view.rotation; + view.rotation = this._printRotation; + } else { + this._oldRotation = view.rotation; + view.rotation = 0; + } } + view.scale = printTemplate.outScale; } - view.scale = printTemplate.outScale; }); d_aspect.after(printViewModel, "print", (promise) => { @@ -112,7 +114,7 @@ export default declare({ return promise; }); - this.watch("enablePrintPreview", (args) => { + this.watch("drawPrintPreview", (args) => { this._handleDrawTemplateDimensions(); }); }, @@ -221,7 +223,7 @@ export default declare({ const properties = this._printingEnhancedProperties._properties; async(() => { if (((this._printingToggleTool && this._printingToggleTool.active) || - this._printingEnhancedToggleTool.active) && this.enablePrintPreview) { + this._printingEnhancedToggleTool.active) && this.drawPrintPreview) { const geometry = this._printingPreviewDrawer .drawTemplateDimensions(this[_printInfos], this[_templateOptions], properties.defaultPageUnit); if (geometry && zoomTo && this[_templateOptions].scaleEnabled) { @@ -251,7 +253,7 @@ export default declare({ _disablePopups() { const properties = this._printingEnhancedProperties._properties; - if (!this[_view] || !properties.enablePrintPreview) { + if (!this[_view] || !properties.drawPrintPreview) { return; } const view = this[_view];