Skip to content

Commit

Permalink
Add configuration option to block specific selection buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
sents committed Jun 2, 2021
1 parent 5086d9a commit 3e2db5c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
18 changes: 13 additions & 5 deletions client-data/tools/hand/hand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -58,16 +60,22 @@
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;
me.x.baseVal.value = bbox.r[0] + bbox.a[0] - me.origWidth/(2*s);
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;

Expand Down
1 change: 1 addition & 0 deletions server/client_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
3 changes: 3 additions & 0 deletions server/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 3e2db5c

Please sign in to comment.