comparison client/src/components/fairway/Fairwayprofile.vue @ 3667:c91bcb92e0b7

client: fix rendering of diagram on PDF (Fairwayprofile)
author Fadi Abbud <fadi.abbud@intevation.de>
date Mon, 17 Jun 2019 11:00:21 +0200
parents 9e91b416d5bb
children c086f5176ef2
comparison
equal deleted inserted replaced
3666:db87f34805fb 3667:c91bcb92e0b7
91 <translate>Export to PDF</translate> 91 <translate>Export to PDF</translate>
92 </button> 92 </button>
93 </div> 93 </div>
94 </DiagramLegend> 94 </DiagramLegend>
95 <div 95 <div
96 ref="diagramContainer" 96 id="pdfContainer"
97 class="d-flex flex-fill justify-content-center align-items-center diagram-container position-relative" 97 class="d-flex flex-fill justify-content-center align-items-center diagram-container position-relative"
98 > 98 >
99 <div class="direction-indicator"></div> 99 <div class="direction-indicator"></div>
100 <div v-if="!fairwayData"> 100 <div v-if="!fairwayData">
101 <translate>No data available.</translate> 101 <translate>No data available.</translate>
462 ); 462 );
463 }, 463 },
464 addDiagram(position, offset, width, height) { 464 addDiagram(position, offset, width, height) {
465 let x = offset.x, 465 let x = offset.x,
466 y = offset.y; 466 y = offset.y;
467 var svg = this.$refs.diagramContainer.innerHTML; 467 let svg = document.querySelector("#pdfContainer>svg").outerHTML;
468 if (svg) { 468
469 svg = svg.replace(/\r?\n|\r/g, "").trim();
470 }
471 // use default width,height if they are missing in the template definition 469 // use default width,height if they are missing in the template definition
472 if (!width) { 470 if (!width) {
473 width = this.templateData.properties.paperSize === "a3" ? 380 : 290; 471 width = this.templateData.properties.paperSize === "a3" ? 380 : 290;
474 } 472 }
475 if (!height) { 473 if (!height) {