From d802d006e70d918e9012d65f18cfcd96980c2e21 Mon Sep 17 00:00:00 2001 From: raphael Date: Fri, 8 May 2020 15:10:41 +0200 Subject: [PATCH] add rotation things --- package-lock.json | 5 +++++ package.json | 1 + src/js/index.js | 1 + src/js/whiteboard.js | 21 +++++++++++++++++++++ 4 files changed, 28 insertions(+) diff --git a/package-lock.json b/package-lock.json index 12d94db..9382288 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5294,6 +5294,11 @@ "integrity": "sha1-vLQEXI3QU5wTS8FIjN0+dop6nlE=", "dev": true }, + "jquery-ui-rotatable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jquery-ui-rotatable/-/jquery-ui-rotatable-1.1.0.tgz", + "integrity": "sha512-ThzjlshKMOiof4YtYvIgUnYcBtEZeGwdsIPNKUpamHnFQFGG/YfaeyzSkPCcYHXrJQopGsmEdahmrZ6P7CFNlg==" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/package.json b/package.json index 97a4131..016b747 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "express": "4.*", "formidable": "1.*", "fs-extra": "7.*", + "jquery-ui-rotatable": "^1.1.0", "jsdom": "^14.0.0", "pdfjs-dist": "^2.3.200", "socket.io": "2.*", diff --git a/src/js/index.js b/src/js/index.js index d9b980a..b087a60 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1,6 +1,7 @@ import "jquery-ui/ui/core"; import "jquery-ui/ui/widgets/draggable"; import "jquery-ui/ui/widgets/resizable"; +import "jquery-ui-rotatable/jquery.ui.rotatable" import "jquery-ui/themes/base/resizable.css"; import "../css/main.css"; diff --git a/src/js/whiteboard.js b/src/js/whiteboard.js index 735a516..e003546 100644 --- a/src/js/whiteboard.js +++ b/src/js/whiteboard.js @@ -607,6 +607,27 @@ const whiteboard = { _this.mouseOverlay.append(imgDiv); imgDiv.draggable(); imgDiv.resizable(); + var params = { + // Callback fired on rotation start. + start: function (event, ui) { + }, + // Callback fired during rotation. + rotate: function (event, ui) { + }, + // Callback fired on rotation end. + stop: function (event, ui) { + }, + // Set the rotation center + rotationCenterOffset: { + top: 20, + left: 20 + }, + transforms: { + translate: '(50%, 50%)', + scale: '(2)' + } + }; + imgDiv.rotatable(); // render newly added icons dom.i2svg();