Skip to content
Snippets Groups Projects
Commit 5345e638 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Rotate signature block around the center

Fixes #24
parent 7cfcac7a
No related branches found
No related tags found
No related merge requests found
Pipeline #11841 passed with warnings
...@@ -109,7 +109,7 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) { ...@@ -109,7 +109,7 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
// add signature image // add signature image
fabric.Image.fromURL(this.placeholder, function(image) { fabric.Image.fromURL(this.placeholder, function(image) {
// add a red border around the signature placeholder // add a red border around the signature placeholder
image.set({stroke: "#e4154b", strokeWidth: that.border_width, strokeUniform: true}); image.set({stroke: "#e4154b", strokeWidth: that.border_width, strokeUniform: true, centeredRotation: true});
// disable controls, we currently don't want resizing and do rotation with a button // disable controls, we currently don't want resizing and do rotation with a button
image.hasControls = false; image.hasControls = false;
...@@ -400,13 +400,8 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) { ...@@ -400,13 +400,8 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
*/ */
async rotateSignature() { async rotateSignature() {
let signature = this.getSignatureRect(); let signature = this.getSignatureRect();
let angel = signature.get("angle") + 90; let angle = (signature.get("angle") + 90) % 360;
signature.rotate(angle);
if (angel >= 360) {
angel = 0;
}
signature.set({ angle: angel });
signature.setCoords(); signature.setCoords();
this.enforceCanvasBoundaries(signature); this.enforceCanvasBoundaries(signature);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment