|
@@ -34,6 +34,9 @@
|
34
|
34
|
// than this?
|
35
|
35
|
var MIN_PENCIL_INTERVAL_MS = Tools.server_config.MAX_EMIT_COUNT_PERIOD / Tools.server_config.MAX_EMIT_COUNT;
|
36
|
36
|
|
|
37
|
+ var AUTO_FINGER_WHITEOUT = Tools.server_config.AUTO_FINGER_WHITEOUT;
|
|
38
|
+ var hasUsedStylus = false;
|
|
39
|
+
|
37
|
40
|
//Indicates the id of the line the user is currently drawing or an empty string while the user is not drawing
|
38
|
41
|
var curLineId = "",
|
39
|
42
|
lastTime = performance.now(); //The time at which the last point was drawn
|
|
@@ -46,11 +49,30 @@
|
46
|
49
|
this.y = y;
|
47
|
50
|
}
|
48
|
51
|
|
|
52
|
+ function handleAutoWhiteOut(evt) {
|
|
53
|
+ if (evt.touches && evt.touches[0] && evt.touches[0].touchType == "stylus") {
|
|
54
|
+ //When using stylus, switch back to the primary
|
|
55
|
+ if (hasUsedStylus && Tools.curTool.secondary.active) {
|
|
56
|
+ Tools.change("Pencil");
|
|
57
|
+ }
|
|
58
|
+ //Remember if starting a line with a stylus
|
|
59
|
+ hasUsedStylus = true;
|
|
60
|
+ }
|
|
61
|
+ if (evt.touches && evt.touches[0] && evt.touches[0].touchType == "direct") {
|
|
62
|
+ //When used stylus and touched with a finger, switch to secondary
|
|
63
|
+ if (hasUsedStylus && !Tools.curTool.secondary.active) {
|
|
64
|
+ Tools.change("Pencil");
|
|
65
|
+ }
|
|
66
|
+ }
|
|
67
|
+ }
|
|
68
|
+
|
49
|
69
|
function startLine(x, y, evt) {
|
50
|
70
|
|
51
|
71
|
//Prevent the press from being interpreted by the browser
|
52
|
72
|
evt.preventDefault();
|
53
|
73
|
|
|
74
|
+ if (AUTO_FINGER_WHITEOUT) handleAutoWhiteOut(evt);
|
|
75
|
+
|
54
|
76
|
curLineId = Tools.generateUID("l"); //"l" for line
|
55
|
77
|
|
56
|
78
|
Tools.drawAndSend({
|
|
@@ -149,6 +171,10 @@
|
149
|
171
|
"release": stopLineAt,
|
150
|
172
|
},
|
151
|
173
|
"draw": draw,
|
|
174
|
+ "onstart": function(oldTool) {
|
|
175
|
+ //Reset stylus
|
|
176
|
+ hasUsedStylus = false;
|
|
177
|
+ },
|
152
|
178
|
"secondary": {
|
153
|
179
|
"name": "White-out",
|
154
|
180
|
"icon": "tools/pencil/whiteout_tape.svg",
|