comparison client/src/lib/mixins.js @ 3344:107de6def0c3

client: diagram-template: cleanup * remove unwanted line
author Fadi Abbud <fadi.abbud@intevation.de>
date Tue, 21 May 2019 10:11:08 +0200
parents db1dc197dc43
children 8da2f7b9a04b
comparison
equal deleted inserted replaced
3343:13bb0ff62ac8 3344:107de6def0c3
107 return text; 107 return text;
108 }, 108 },
109 addImage(url, format, position, offset, width, height) { 109 addImage(url, format, position, offset, width, height) {
110 let x = offset.x; 110 let x = offset.x;
111 let y = offset.y; 111 let y = offset.y;
112 //roundup-intern.intevation.de/wamos/issue416
113 if (["topright", "bottomright"].indexOf(position) !== -1) { 112 if (["topright", "bottomright"].indexOf(position) !== -1) {
114 x = this.pdf.width - offset.x - width; 113 x = this.pdf.width - offset.x - width;
115 } 114 }
116 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { 115 if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
117 y = this.pdf.height - offset.y - height; 116 y = this.pdf.height - offset.y - height;
155 // title for diagram 154 // title for diagram
156 addDiagramTitle(position, offset, size, color, text) { 155 addDiagramTitle(position, offset, size, color, text) {
157 let x = offset.x, 156 let x = offset.x,
158 y = offset.y; 157 y = offset.y;
159 this.pdf.doc.setFontSize(size); 158 this.pdf.doc.setFontSize(size);
159 this.pdf.doc.setFontStyle("bold");
160 this.pdf.doc.setTextColor(color);
160 let width = 161 let width =
161 (this.pdf.doc.getStringUnitWidth(text) * size) / (72 / 25.6) + size / 2; 162 (this.pdf.doc.getStringUnitWidth(text) * size) / (72 / 25.6) + size / 2;
162 // if position is on the right, x needs to be calculate with pdf width and 163 // if position is on the right, x needs to be calculate with pdf width and
163 // the size of the element 164 // the size of the element
164 if (["topright", "bottomright"].indexOf(position) !== -1) { 165 if (["topright", "bottomright"].indexOf(position) !== -1) {
165 x = this.pdf.width - offset.x - width; 166 x = this.pdf.width - offset.x - width;
166 } 167 }
167 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { 168 if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
168 y = this.pdf.height - offset.y - this.getTextHeight(1); 169 y = this.pdf.height - offset.y - this.getTextHeight(1);
169 } 170 }
170 this.pdf.doc.setTextColor(color);
171 this.pdf.doc.setFontStyle("bold");
172 this.pdf.doc.text(text, x, y, { baseline: "hanging" }); 171 this.pdf.doc.text(text, x, y, { baseline: "hanging" });
173 }, 172 },
174 addRoundedBox(x, y, w, h, color, rounding, brcolor) { 173 addRoundedBox(x, y, w, h, color, rounding, brcolor) {
175 this.pdf.doc.setDrawColor(brcolor); 174 this.pdf.doc.setDrawColor(brcolor);
176 this.pdf.doc.setFillColor(color); 175 this.pdf.doc.setFillColor(color);