MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / onTouchMoved

Method onTouchMoved

tools/xsbug/behaviors.js:436–465  ·  view source on GitHub ↗
(code, id, x, y, ticks)

Source from the content-addressed store, hash-verified

434 this.onSelected(code);
435 }
436 onTouchMoved(code, id, x, y, ticks) {
437 if ((this.x != x) || (this.y != y))
438 this.onTouchSelect(code, x, y);
439 this.x = x;
440 this.y = y;
441 var scroller = this.getScroller(code);
442 var dx = 0, dy = 0;
443 if (this.mode != LINE_MODE) {
444 if (x < scroller.x)
445 dx = -1;
446 else if (scroller.x + scroller.width < x)
447 dx = 1;
448 }
449 if (y < scroller.y)
450 dy = -1;
451 else if (scroller.y + scroller.height < y)
452 dy = 1;
453 if (this.dx != dx) {
454 this.dx = dx;
455 this.tx = Date.now();
456 }
457 if (this.dy != dy) {
458 this.dy = dy;
459 this.ty = Date.now();
460 }
461 if (dx || dy)
462 code.start();
463 else
464 code.stop();
465 }
466 onTouchSelect(code, x, y) {
467 var anchor = this.anchor;
468 var bounds = code.bounds;

Callers

nothing calls this directly

Calls 4

onTouchSelectMethod · 0.95
getScrollerMethod · 0.95
startMethod · 0.65
stopMethod · 0.65

Tested by

no test coverage detected