Mercurial > gemma
comparison client/src/lib/mixins.js @ 4000:c40f8b026de3
clinet: pdf-gen: fix positioning of text for template-textbox element
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Thu, 18 Jul 2019 12:50:33 +0200 |
parents | 6672b780722f |
children | bf86f9a08733 |
comparison
equal
deleted
inserted
replaced
3999:ffc822700056 | 4000:c40f8b026de3 |
---|---|
335 } | 335 } |
336 if (["topright", "bottomright"].indexOf(position) !== -1) { | 336 if (["topright", "bottomright"].indexOf(position) !== -1) { |
337 x = this.pdf.width - offset.x - width; | 337 x = this.pdf.width - offset.x - width; |
338 } | 338 } |
339 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { | 339 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { |
340 y = | 340 y = this.pdf.height - offset.y - this.getTextHeight(textLines.length); |
341 this.pdf.height - | |
342 offset.y * 0.3 - | |
343 this.getTextHeight(textLines.length); | |
344 } | 341 } |
345 this.pdf.doc.text(textLines, x, y, { baseline: "hanging" }); | 342 this.pdf.doc.text(textLines, x, y, { baseline: "hanging" }); |
346 }, | 343 }, |
347 replacePlaceholders(text) { | 344 replacePlaceholders(text) { |
348 if (text.includes("{date}")) { | 345 if (text.includes("{date}")) { |
466 height, | 463 height, |
467 rounding, | 464 rounding, |
468 background, | 465 background, |
469 brcolor | 466 brcolor |
470 ); | 467 ); |
471 this.addText( | 468 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { |
472 position, | 469 this.addText( |
473 { x: offset.x + padding, y: offset.y + padding * 2 }, | 470 position, |
474 textWidth, | 471 { x: offset.x + padding, y: offset.y - padding / 2 }, |
475 fontSize, | 472 textWidth, |
476 color, | 473 fontSize, |
477 text | 474 color, |
478 ); | 475 text |
476 ); | |
477 } else { | |
478 this.addText( | |
479 position, | |
480 { x: offset.x + padding, y: offset.y + padding * 2 }, | |
481 textWidth, | |
482 fontSize, | |
483 color, | |
484 text | |
485 ); | |
486 } | |
479 } | 487 } |
480 } | 488 } |
481 }; | 489 }; |