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) {
// add signature image
fabric.Image.fromURL(this.placeholder, function(image) {
// 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
image.hasControls = false;
......@@ -400,13 +400,8 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
*/
async rotateSignature() {
let signature = this.getSignatureRect();
let angel = signature.get("angle") + 90;
if (angel >= 360) {
angel = 0;
}
signature.set({ angle: angel });
let angle = (signature.get("angle") + 90) % 360;
signature.rotate(angle);
signature.setCoords();
this.enforceCanvasBoundaries(signature);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment