From 8117be3f52d06ddf4b9e9dfcdea89d7ec65402c6 Mon Sep 17 00:00:00 2001 From: Florent Chehab Date: Sat, 2 May 2020 13:09:36 +0200 Subject: [PATCH] feat(frontend): add read-only mode and default to it --- src/index.html | 18 ++++++++++++------ src/js/icons.js | 6 +++++- src/js/main.js | 21 +++++++++++++++++++++ src/js/whiteboard.js | 36 ++++++++++++++++++++++++++++++++---- 4 files changed, 70 insertions(+), 11 deletions(-) diff --git a/src/index.html b/src/index.html index fe75bc7..5ee8c33 100644 --- a/src/index.html +++ b/src/index.html @@ -14,22 +14,28 @@
- - -
+ + @@ -96,14 +102,14 @@
-
'); } }, + setViewOnly: function(what) { + var _this = this; + _this.viewOnly = what; + + if (what === true){ + $(".whiteboardTool[tool=mouse]").click(); // reset tool to prevent use of text + $(".whiteboardTool").prop("disabled", true); + $(".whiteboardEditBtn").prop("disabled", true); + $("#whiteboardUnlockBtn").hide(); + $("#whiteboardLockBtn").show(); + + } else { + $(".whiteboardTool").prop("disabled", false); + $(".whiteboardEditBtn").prop("disabled", false); + $("#whiteboardUnlockBtn").show(); + $("#whiteboardLockBtn").hide(); + } + }, handleEventsAndData: function (content, isNewData, doneCallback) { var _this = this; var tool = content["t"]; @@ -1029,4 +1057,4 @@ function lanczosInterpolate(xm1, ym1, x0, y0, x1, y1, x2, y2, a) { return [cm1 * xm1 + c0 * x0 + c1 * x1 + c2 * x2, cm1 * ym1 + c0 * y0 + c1 * y1 + c2 * y2]; } -export default whiteboard; \ No newline at end of file +export default whiteboard;