Skip to content

Commit faa6422

Browse files
Merge pull request #67 from KevinBusch/issue-66
Removed e.preventDefault() from window object touchEnd event. Added …
2 parents 680812a + 8132828 commit faa6422

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/atoms/forms/canvas-sketch/tools/line-canvas-draw-tool.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,6 @@ class LineCanvasDrawTool extends BaseCanvasDrawTool implements CanvasDrawTool {
269269

270270
private _onTouchEndWindow(e: TouchEvent): void {
271271
this._finishStroke();
272-
273-
// Don't allow touch events to be called
274-
e.preventDefault();
275272
}
276273

277274
private _onTouchMoveCanvas(e: TouchEvent): void {
@@ -283,7 +280,7 @@ class LineCanvasDrawTool extends BaseCanvasDrawTool implements CanvasDrawTool {
283280
this._move(touchPosition);
284281
}
285282

286-
// Don't allow touch events to be called
283+
// prevents scrolling screen (if inside scrollable content)
287284
e.preventDefault();
288285
}
289286

@@ -296,7 +293,8 @@ class LineCanvasDrawTool extends BaseCanvasDrawTool implements CanvasDrawTool {
296293
this._startStroke(touchPosition);
297294
}
298295

299-
// Don't allow touch events to be called
296+
// prevents click event from firing when not moving / gesturing with touch
297+
// effectively duplicating drawing stroke
300298
e.preventDefault();
301299
}
302300

src/atoms/forms/canvas-sketch/tools/pan-canvas-tool.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ class PanCanvasTool {
178178

179179
private _onTouchEndWindow(e: TouchEvent): void {
180180
this._finishPan();
181-
182-
// Don't allow touch events to be called
183-
e.preventDefault();
184181
}
185182

186183
private _onTouchMoveCanvas(e: TouchEvent): void {
@@ -192,7 +189,7 @@ class PanCanvasTool {
192189
this._pan(touchPosition);
193190
}
194191

195-
// Don't allow touch events to be called
192+
// prevents scrolling screen (if inside scrollable content)
196193
e.preventDefault();
197194
}
198195

@@ -205,7 +202,7 @@ class PanCanvasTool {
205202
this._startPan(touchPosition);
206203
}
207204

208-
// Don't allow touch events to be called
205+
// prevents click event from firing when not moving / gesturing with touch
209206
e.preventDefault();
210207
}
211208

src/atoms/forms/canvas-sketch/tools/pencil-canvas-draw-tool.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,6 @@ class PencilCanvasDrawTool extends BaseCanvasDrawTool
344344

345345
private _onTouchEndWindow(e: TouchEvent): void {
346346
this._finishStroke();
347-
348-
// Don't allow touch events to be called
349-
e.preventDefault();
350347
}
351348

352349
private _onTouchMoveCanvas(e: TouchEvent): void {
@@ -358,7 +355,7 @@ class PencilCanvasDrawTool extends BaseCanvasDrawTool
358355
this._move(touchPosition);
359356
}
360357

361-
// Don't allow touch events to be called
358+
// prevents scrolling screen (if inside scrollable content)
362359
e.preventDefault();
363360
}
364361

@@ -371,7 +368,8 @@ class PencilCanvasDrawTool extends BaseCanvasDrawTool
371368
this._startStroke(touchPosition);
372369
}
373370

374-
// Don't allow touch events to be called
371+
// prevents click event from firing when not moving / gesturing with touch
372+
// effectively duplicating drawing stroke
375373
e.preventDefault();
376374
}
377375

0 commit comments

Comments
 (0)