Add configuration option to block specific selection buttons

This commit is contained in:
Finn Krein 2021-06-02 12:26:42 +02:00
parent 5086d9a81d
commit 3e2db5c424
3 changed files with 17 additions and 5 deletions

View file

@ -38,8 +38,10 @@
var transform_elements = [];
var selectorState = selectorStates.pointing;
var last_sent = 0;
var blockedSelectionButtons = Tools.server_config.BLOCKED_SELECTION_BUTTONS;
var selectionButtons = {};
var deleteButton = createButton("delete", "delete", 22, 22,
selectionButtons["delete"] = createButton("delete", "delete", 22, 22,
function(me, bbox, s) {
me.width.baseVal.value = me.origWidth / s;
me.height.baseVal.value = me.origHeight / s;
@ -49,7 +51,7 @@
},
deleteSelection);
var duplicateButton = createButton("duplicate", "duplicate", 22, 22,
selectionButtons["duplicate"] = createButton("duplicate", "duplicate", 22, 22,
function(me, bbox, s) {
me.width.baseVal.value = me.origWidth / s;
me.height.baseVal.value = me.origHeight / s;
@ -58,7 +60,7 @@
me.style.display = "";
},
duplicateSelection);
var scaleHandle = createButton("scaleHandle", "handle", 14, 14,
selectionButtons["scale"] = createButton("scaleHandle", "handle", 14, 14,
function(me, bbox, s) {
me.width.baseVal.value = me.origWidth / s;
me.height.baseVal.value = me.origHeight / s;
@ -66,8 +68,14 @@
me.y.baseVal.value = bbox.r[1] + bbox.b[1] - me.origHeight/(2*s);
me.style.display = "";
},
startScalingTransform);
var selectionButtons = [deleteButton, duplicateButton, scaleHandle];
startScalingTransform);
for (i in blockedSelectionButtons) {
delete selectionButtons[blockedSelectionButtons[i]];
}
selectionButtons = Object.keys(selectionButtons).map(function(k) {
return selectionButtons[k];
});
var getScale = Tools.getScale;

View file

@ -6,5 +6,6 @@ module.exports = {
MAX_EMIT_COUNT: config.MAX_EMIT_COUNT,
MAX_EMIT_COUNT_PERIOD: config.MAX_EMIT_COUNT_PERIOD,
BLOCKED_TOOLS: config.BLOCKED_TOOLS,
BLOCKED_SELECTION_BUTTONS: config.BLOCKED_SELECTION_BUTTONS,
AUTO_FINGER_WHITEOUT: config.AUTO_FINGER_WHITEOUT,
};

View file

@ -42,6 +42,9 @@ module.exports = {
/** Blocked Tools. A comma-separated list of tools that should not appear on boards. */
BLOCKED_TOOLS: (process.env["WBO_BLOCKED_TOOLS"] || "").split(","),
/** Selection Buttons. A comma-separated list of selection buttons that should not be available. */
BLOCKED_SELECTION_BUTTONS: (process.env["WBO_BLOCKED_SELECTION_BUTTONS"] || "").split(","),
/** Automatically switch to White-out on finger touch after drawing
with Pencil using a stylus. Only supported on iPad with Apple Pencil. */
AUTO_FINGER_WHITEOUT: process.env['AUTO_FINGER_WHITEOUT'] !== "disabled",