瀏覽代碼

Add configuration option to block specific selection buttons

dev_h
Finn Krein 3 年之前
父節點
當前提交
3e2db5c424
共有 3 個文件被更改,包括 17 次插入5 次删除
  1. 13
    5
      client-data/tools/hand/hand.js
  2. 1
    0
      server/client_configuration.js
  3. 3
    0
      server/configuration.js

+ 13
- 5
client-data/tools/hand/hand.js 查看文件

@@ -38,8 +38,10 @@
38 38
 	var transform_elements = [];
39 39
 	var selectorState = selectorStates.pointing;
40 40
 	var last_sent = 0;
41
+	var blockedSelectionButtons = Tools.server_config.BLOCKED_SELECTION_BUTTONS;
42
+	var selectionButtons = {};
41 43
 
42
-	var deleteButton = createButton("delete", "delete", 22, 22,
44
+	selectionButtons["delete"] = createButton("delete", "delete", 22, 22,
43 45
 		function(me, bbox, s) {
44 46
 			me.width.baseVal.value = me.origWidth / s;
45 47
 			me.height.baseVal.value = me.origHeight / s;
@@ -49,7 +51,7 @@
49 51
 		},
50 52
 									deleteSelection);
51 53
 
52
-	var duplicateButton = createButton("duplicate", "duplicate", 22, 22,
54
+	selectionButtons["duplicate"] = createButton("duplicate", "duplicate", 22, 22,
53 55
 		function(me, bbox, s) {
54 56
 			me.width.baseVal.value = me.origWidth / s;
55 57
 			me.height.baseVal.value = me.origHeight / s;
@@ -58,7 +60,7 @@
58 60
 			me.style.display = "";
59 61
 		},
60 62
 									   duplicateSelection);
61
-	var scaleHandle = createButton("scaleHandle", "handle", 14, 14,
63
+	selectionButtons["scale"] = createButton("scaleHandle", "handle", 14, 14,
62 64
 		function(me, bbox, s) {
63 65
 			me.width.baseVal.value = me.origWidth / s;
64 66
 			me.height.baseVal.value = me.origHeight / s;
@@ -66,8 +68,14 @@
66 68
 			me.y.baseVal.value = bbox.r[1] + bbox.b[1] - me.origHeight/(2*s);
67 69
 			me.style.display = "";
68 70
 		},
69
-								   startScalingTransform);
70
-	var selectionButtons = [deleteButton, duplicateButton, scaleHandle];
71
+								startScalingTransform);
72
+
73
+	for (i in blockedSelectionButtons) {
74
+		delete selectionButtons[blockedSelectionButtons[i]];
75
+	}
76
+	selectionButtons = Object.keys(selectionButtons).map(function(k) {
77
+			return selectionButtons[k];
78
+		});
71 79
 
72 80
 	var getScale = Tools.getScale;
73 81
 

+ 1
- 0
server/client_configuration.js 查看文件

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

+ 3
- 0
server/configuration.js 查看文件

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

Loading…
取消
儲存