save thickness settings for each tool in localstorage

This commit is contained in:
Raphael 2022-05-15 14:40:38 +02:00
parent e383b61d6c
commit 1fe26f3103

View File

@ -321,6 +321,11 @@ function initWhiteboard() {
} else { } else {
$("#textboxBackgroundColorPickerBtn").hide(); $("#textboxBackgroundColorPickerBtn").hide();
} }
let savedThickness = localStorage.getItem("item_thickness_" + activeTool);
if (savedThickness) {
whiteboard.setStrokeThickness(savedThickness);
$("#whiteboardThicknessSlider").val(savedThickness);
}
}); });
// upload image button // upload image button
@ -584,8 +589,17 @@ function initWhiteboard() {
$("#whiteboardThicknessSlider").on("input", function () { $("#whiteboardThicknessSlider").on("input", function () {
if (ReadOnlyService.readOnlyActive) return; if (ReadOnlyService.readOnlyActive) return;
whiteboard.setStrokeThickness($(this).val()); whiteboard.setStrokeThickness($(this).val());
let activeTool = $(".whiteboard-tool.active").attr("tool");
localStorage.setItem("item_thickness_" + activeTool, $(this).val());
}); });
let activeTool = $(".whiteboard-tool.active").attr("tool");
let savedThickness = localStorage.getItem("item_thickness_" + activeTool);
if (savedThickness) {
whiteboard.setStrokeThickness(savedThickness);
$("#whiteboardThicknessSlider").val(savedThickness);
}
// handle drag&drop // handle drag&drop
var dragCounter = 0; var dragCounter = 0;
$("#whiteboardContainer").on("dragenter", function (e) { $("#whiteboardContainer").on("dragenter", function (e) {