Mousedown or touchstart
518826
function mousedown(e, space) {
            var offset = plate.offset(),
                isTouch = /^touch/.test(e.type),
                x0 = offset.left + dialRadius,
                y0 = offset.top + dialRadius,
                dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
                dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
                z = Math.sqrt(dx * dx + dy * dy),
                moved = false;

            // When clicking on minutes view space, check the mouse position
            if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius))
                return;
            e.preventDefault();

            // Set cursor style of body after 200ms
            var movingTimer = setTimeout(function(){
                self.popover.addClass('clockpicker-moving');
            }, 200);

            // Place the canvas to top
            if (svgSupported)
                plate.append(self.canvas);

            // Clock
            self.setHand(dx, dy, !space, true);

            // Mousemove on document
            $doc.off(mousemoveEvent).on(mousemoveEvent, function(e){
                e.preventDefault();
                var isTouch = /^touch/.test(e.type),
                    x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
                    y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
                if (! moved && x === dx && y === dy)
                // Clicking in chrome on windows will trigger a mousemove event
                    return;
                moved = true;
                self.setHand(x, y, false, true);
            });

            // Mouseup on document
            $doc.off(mouseupEvent).on(mouseupEvent, function(e) {
                $doc.off(mouseupEvent);
                e.preventDefault();
                var isTouch = /^touch/.test(e.type),
                    x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
                    y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
                if ((space || moved) && x === dx && y === dy)
                    self.setHand(x, y);
                if (self.currentView === 'hours')
                    self.toggleView('minutes', duration / 2);
                else
                if (options.autoclose) {
                    self.minutesView.addClass('clockpicker-dial-out');
                    setTimeout(function(){
                        self.done();
                    }, duration / 2);
                }
                plate.prepend(canvas);

                // Reset cursor style of body
                clearTimeout(movingTimer);
                self.popover.removeClass('clockpicker-moving');

                // Unbind mousemove event
                $doc.off(mousemoveEvent);
            });
        }
242621
function() {
        if (!this.touch) {
            this.touch = true;
            var events = [
                "mousedown", "mouseup", "mousemove", "click", "dblclick",
                "mouseout"
            ];
            for (var i=0, len=events.length; i<len; i++) {
                if (this[events[i]]) {
                    this.unregister(events[i], this[events[i]]); 
                }
            } 
        }
    }
1026782
function stopTouchAndScrollEventPropagation(element, eventList) {
    var eventList = [ 'touchstart', 'touchmove', 'touchend', 'touchcancel',
                      'wheel', 'mousewheel' ];
    for (var i = 0; i < eventList.length; i++) {
      element.addEventListener(eventList[i], function(event) {
        event.stopPropagation();
      });
    }
  }
29120
function getActiveTouches(mouseEv, eventName) {
        // empty list
        if (mouseEv.type == 'mouseup') {
            return new TouchList();
        }

        var touchList = createTouchList(mouseEv);
        if(isMultiTouch && mouseEv.type != 'mouseup' && eventName == 'touchend') {
            touchList.splice(1, 1);
        }
        return touchList;
    }
982214
function TouchEmulator() {
  fakeTouchSupport();

  window.addEventListener('mousedown', onMouse('touchstart'), true);
  window.addEventListener('mousemove', onMouse('touchmove'), true);
  window.addEventListener('mouseup', onMouse('touchend'), true);
}
1177246
function (event) {

        event = normalizeEvent(this.dom, event);

        // Mark touch, which is useful in distinguish touch and
        // mouse event in upper applicatoin.
        event.zrByTouch = true;

        this.handler.processGesture(this, event, 'end');

        domHandlers.mouseup.call(this, event);

        // Do not trigger `mouseout` here, in spite of `mousemove`(`mouseover`) is
        // triggered in `touchstart`. This seems to be illogical, but by this mechanism,
        // we can conveniently implement "hover style" in both PC and touch device just
        // by listening to `mouseover` to add "hover style" and listening to `mouseout`
        // to remove "hover style" on an element, without any additional code for
        // compatibility. (`mouseout` will not be triggered in `touchend`, so "hover
        // style" will remain for user view)

        // click event should always be triggered no matter whether
        // there is gestrue event. System click can not be prevented.
        if (+new Date() - this._lastTouchMoment < TOUCH_CLICK_DELAY) {
            domHandlers.click.call(this, event);
        }

        setTouchTimer(this);
    }
530057
function() {
				// Remove keydown event listeners
				this.handle1.removeEventListener("keydown", this.handle1Keydown, false);
				this.handle2.removeEventListener("keydown", this.handle2Keydown, false);

				if (this.showTooltip) {
					this.handle1.removeEventListener("focus", this.showTooltip, false);
					this.handle2.removeEventListener("focus", this.showTooltip, false);
				}
				if (this.hideTooltip) {
					this.handle1.removeEventListener("blur", this.hideTooltip, false);
					this.handle2.removeEventListener("blur", this.hideTooltip, false);
				}

				// Remove event listeners from sliderElem
				if (this.showTooltip) {
					this.sliderElem.removeEventListener("mouseenter", this.showTooltip, false);
				}
				if (this.hideTooltip) {
					this.sliderElem.removeEventListener("mouseleave", this.hideTooltip, false);
				}
				this.sliderElem.removeEventListener("touchstart", this.mousedown, false);
				this.sliderElem.removeEventListener("mousedown", this.mousedown, false);
			}
166060
function(oEvent) {
			var oTouches = oEvent.touches,
				oTouch;

			bHandleEvent = (oTouches.length == 1 && !isInputField(oEvent));

			bIsMoved = false;
			if (bHandleEvent) {
				oTouch = oTouches[0];

				// As we are only interested in the first touch target, we remember it
				oTarget = oTouch.target;
				if (oTarget.nodeType === 3) {

					// no text node
					oTarget = oTarget.parentNode;
				}

				// Remember the start position of the first touch to determine if a click was performed or not.
				iStartX = oTouch.clientX;
				iStartY = oTouch.clientY;
				fireMouseEvent("mousedown", oEvent);
			}
		}
312049
def on_touch_down(self, touch):
        """"""
        if hasattr(self, '_lasttouch') and self._lasttouch == touch:
            return
        if not self.collide_point(*touch.pos):
            return
        touch.push()
        touch.apply_transform_2d(self.to_local)
        if self.app.selection:
            if self.app.selection.collide_point(*touch.pos):
                Logger.debug("Board: hit selection")
                touch.grab(self.app.selection)
        pawns = list(self.pawns_at(*touch.pos))
        if pawns:
            Logger.debug("Board: hit {} pawns".format(len(pawns)))
            self.selection_candidates = pawns
            if self.app.selection in self.selection_candidates:
                self.selection_candidates.remove(self.app.selection)
            touch.pop()
            return True
        spots = list(self.spots_at(*touch.pos))
        if spots:
            Logger.debug("Board: hit {} spots".format(len(spots)))
            self.selection_candidates = spots
            if self.adding_portal:
                self.origspot = self.selection_candidates.pop(0)
                self.protodest = Dummy(
                    name='protodest',
                    pos=touch.pos,
                    size=(0, 0)
                )
                self.add_widget(self.protodest)
                self.protodest.on_touch_down(touch)
                self.protoportal = self.proto_arrow_cls(
                    origin=self.origspot,
                    destination=self.protodest
                )
                self.add_widget(self.protoportal)
                if self.reciprocal_portal:
                    self.protoportal2 = self.proto_arrow_cls(
                        destination=self.origspot,
                        origin=self.protodest
                    )
                    self.add_widget(self.protoportal2)
            touch.pop()
            return True
        arrows = list(self.arrows_at(*touch.pos))
        if arrows:
            Logger.debug("Board: hit {} arrows".format(len(arrows)))
            self.selection_candidates = arrows
            if self.app.selection in self.selection_candidates:
                self.selection_candidates.remove(self.app.selection)
            touch.pop()
            return True
        touch.pop()
1092843
def click(self, x=-1, y=-1, selector=None):
        

        self.touch(x=x, y=y, selector=selector)
565164
function createTouchList(mouseEv) {
        var touchList = new TouchList();

        if (isMultiTouch) {
            var f = TouchEmulator.multiTouchOffset;
            var deltaX = multiTouchStartPos.pageX - mouseEv.pageX;
            var deltaY = multiTouchStartPos.pageY - mouseEv.pageY;

            touchList.push(new Touch(eventTarget, 1, multiTouchStartPos, (deltaX*-1) - f, (deltaY*-1) + f));
            touchList.push(new Touch(eventTarget, 2, multiTouchStartPos, deltaX+f, deltaY-f));
        } else {
            touchList.push(new Touch(eventTarget, 1, mouseEv, 0, 0));
        }

        return touchList;
    }
393931
function (e) {

		var self = this,
			chart = self.chart,
			pinchDown = self.pinchDown,
			followTouchMove = chart.tooltip && chart.tooltip.options.followTouchMove,
			touches = e.touches,
			touchesLength = touches.length,
			lastValidTouch = self.lastValidTouch,
			zoomHor = self.zoomHor || self.pinchHor,
			zoomVert = self.zoomVert || self.pinchVert,
			hasZoom = zoomHor || zoomVert,
			selectionMarker = self.selectionMarker,
			transform = {},
			fireClickEvent = touchesLength === 1 && ((self.inClass(e.target, PREFIX + 'tracker') && 
				chart.runTrackerClick) || chart.runChartClick),
			clip = {};

		// On touch devices, only proceed to trigger click if a handler is defined
		if ((hasZoom || followTouchMove) && !fireClickEvent) {
			e.preventDefault();
		}
		
		// Normalize each touch
		map(touches, function (e) {
			return self.normalize(e);
		});
			
		// Register the touch start position
		if (e.type === 'touchstart') {
			each(touches, function (e, i) {
				pinchDown[i] = { chartX: e.chartX, chartY: e.chartY };
			});
			lastValidTouch.x = [pinchDown[0].chartX, pinchDown[1] && pinchDown[1].chartX];
			lastValidTouch.y = [pinchDown[0].chartY, pinchDown[1] && pinchDown[1].chartY];

			// Identify the data bounds in pixels
			each(chart.axes, function (axis) {
				if (axis.zoomEnabled) {
					var bounds = chart.bounds[axis.horiz ? 'h' : 'v'],
						minPixelPadding = axis.minPixelPadding,
						min = axis.toPixels(axis.dataMin),
						max = axis.toPixels(axis.dataMax),
						absMin = mathMin(min, max),
						absMax = mathMax(min, max);

					// Store the bounds for use in the touchmove handler
					bounds.min = mathMin(axis.pos, absMin - minPixelPadding);
					bounds.max = mathMax(axis.pos + axis.len, absMax + minPixelPadding);
				}
			});
		
		// Event type is touchmove, handle panning and pinching
		} else if (pinchDown.length) { // can be 0 when releasing, if touchend fires first
			

			// Set the marker
			if (!selectionMarker) {
				self.selectionMarker = selectionMarker = extend({
					destroy: noop
				}, chart.plotBox);
			}

			

			if (zoomHor) {
				self.pinchTranslateDirection(true, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch);
			}
			if (zoomVert) {
				self.pinchTranslateDirection(false, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch);
			}

			self.hasPinched = hasZoom;

			// Scale and translate the groups to provide visual feedback during pinching
			self.scaleGroups(transform, clip);
			
			// Optionally move the tooltip on touchmove
			if (!hasZoom && followTouchMove && touchesLength === 1) {
				this.runPointActions(self.normalize(e));
			}
		}
	}
1199434
function iPadTouchStart(event) {
	var touches = event.changedTouches,
		first = touches[0],
		type = "mouseover",
		simulatedEvent = document.createEvent("MouseEvent");
	//
	// Mouse over first - I have live events attached on mouse over
	//
	simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
                            false, false, false, false, 0, null);
	first.target.dispatchEvent(simulatedEvent);

	type = "mousedown";
	simulatedEvent = document.createEvent("MouseEvent");

	simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
                            false, false, false, false, 0, null);
	first.target.dispatchEvent(simulatedEvent);


	if (!tapValid) {
		lastTap = first.target;
		tapValid = true;
		tapTimeout = window.setTimeout("cancelTap();", 600);
		startHold(event);
	}
	else {
		window.clearTimeout(tapTimeout);

		//
		// If a double tap is still a possibility and the elements are the same
		//	Then perform a double click
		//
		if (first.target == lastTap) {
			lastTap = null;
			tapValid = false;

			type = "click";
			simulatedEvent = document.createEvent("MouseEvent");

			simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
                         	false, false, false, false, 0/*left*/, null);
			first.target.dispatchEvent(simulatedEvent);

			type = "dblclick";
			simulatedEvent = document.createEvent("MouseEvent");

			simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
                         	false, false, false, false, 0/*left*/, null);
			first.target.dispatchEvent(simulatedEvent);
		}
		else {
			lastTap = first.target;
			tapValid = true;
			tapTimeout = window.setTimeout("cancelTap();", 600);
			startHold(event);
		}
	}
}
313364
function touchStart(e) {
                $this = $(e.currentTarget);
                $this.data('callee1', touchStart);
                originalCoord.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX;
                originalCoord.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY;
                finalCoord.x = originalCoord.x;
                finalCoord.y = originalCoord.y;
                started = true;
                var origEvent = e.originalEvent;
                // Read event data into our startEvt:
                startEvnt = {
                    'position': {
                        'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX,
                        'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY
                    },
                    'offset': {
                        'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)),
                        'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0))
                    },
                    'time': Date.now(),
                    'target': e.target
                };
            }
1214398
def on_touch_down(self, touch):
        """"""
        if self.parent is None:
            return
        if self.collide_point(*touch.pos):
            self.parent.bar_touched(self, touch)
579711
function mouseover(inEvent) {
  if (!this.isEventSimulatedFromTouch_(inEvent)) {
    const e = prepareEvent(inEvent, this.dispatcher);
    this.dispatcher.enterOver(e, inEvent);
  }
}
1336051
function touchNavigation() {
    if (this.events.hasOwnProperty('touchStart')) {
        return false;
    }
    let index,
        hDistance,
        vDistance,
        hDistanceLast,
        vDistanceLast,
        hDistancePercent,
        vSwipe = false,
        hSwipe = false,
        hSwipMinDistance = 0,
        vSwipMinDistance = 0,
        doingPinch = false,
        pinchBigger = false,
        startCoords = { },
        endCoords = { },
        slider = this.slidesContainer,
        activeSlide = null,
        xDown = 0,
        yDown = 0,
        activeSlideImage = null,
        activeSlideMedia = null,
        activeSlideDesc = null;

    let winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
    let winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
    let body = document.body;

    this.events['doctouchmove'] = addEvent('touchmove', {
        onElement: document,
        withCallback: (e, target) => {
            if (hasClass(body, 'gdesc-open')) {
                e.preventDefault()
                return false
            }
        }, useCapture: { passive: false }
    })


    this.events['touchStart'] = addEvent('touchstart', {
        onElement: body,
        withCallback: (e, target) => {
            if (hasClass(body, 'gdesc-open')) {
                return;
            }
            addClass(body, 'touching');
            activeSlide = this.getActiveSlide()
            activeSlideImage = activeSlide.querySelector('.gslide-image')
            activeSlideMedia = activeSlide.querySelector('.gslide-media')
            activeSlideDesc = activeSlide.querySelector('.gslide-description')

            index = this.index;
            endCoords = e.targetTouches[0];
            startCoords.pageX = e.targetTouches[0].pageX;
            startCoords.pageY = e.targetTouches[0].pageY;
            xDown = e.targetTouches[0].clientX;
            yDown = e.targetTouches[0].clientY;
        }
    })

    this.events['gestureStart'] = addEvent('gesturestart', {
        onElement: body,
        withCallback: (e, target) => {
            if (activeSlideImage) {
                e.preventDefault()
                doingPinch = true
            }
        }
    })

    this.events['gestureChange'] = addEvent('gesturechange', {
        onElement: body,
        withCallback: (e, target) => {
            e.preventDefault()
            slideCSSTransform(activeSlideImage, `scale(${e.scale})`)
        }
    })

    this.events['gesturEend'] = addEvent('gestureend', {
        onElement: body,
        withCallback: (e, target) => {
            doingPinch = false
            if (e.scale < 1) {
                pinchBigger = false
                slideCSSTransform(activeSlideImage, `scale(1)`)
            } else{
                pinchBigger = true
            }
        }
    })

    this.events['touchMove'] = addEvent('touchmove', {
        onElement: body,
        withCallback: (e, target) => {
            if (!hasClass(body, 'touching')) {
                return;
            }
            if (hasClass(body, 'gdesc-open') || doingPinch || pinchBigger) {
                return;
            }
            e.preventDefault();
            endCoords = e.targetTouches[0];
            let slideHeight = activeSlide.querySelector('.gslide-inner-content').offsetHeight;
            let slideWidth = activeSlide.querySelector('.gslide-inner-content').offsetWidth;

            let xUp = e.targetTouches[0].clientX;
            let yUp = e.targetTouches[0].clientY;
            let xDiff = xDown - xUp;
            let yDiff = yDown - yUp;

            if (Math.abs(xDiff) > Math.abs(yDiff)) { /*most significant*/
                vSwipe = false
                hSwipe = true
            } else {
                hSwipe = false
                vSwipe = true
            }

            if (vSwipe) {
                vDistanceLast = vDistance;
                vDistance = endCoords.pageY - startCoords.pageY;
                if (Math.abs(vDistance) >= vSwipMinDistance || vSwipe) {
                    let opacity = 0.75 - Math.abs(vDistance) / slideHeight;
                    activeSlideMedia.style.opacity = opacity;
                    if (activeSlideDesc) {
                        activeSlideDesc.style.opacity = opacity;
                    }
                    slideCSSTransform(activeSlideMedia, `translate3d(0, ${vDistance}px, 0)`)
                }
                return;
            }

            hDistanceLast = hDistance;
            hDistance = endCoords.pageX - startCoords.pageX;
            hDistancePercent = hDistance * 100 / winWidth;

            if (hSwipe) {
                if (this.index + 1 == this.elements.length && hDistance < -60) {
                    resetSlideMove(activeSlide)
                    return false;
                }
                if (this.index - 1 < 0 && hDistance > 60) {
                    resetSlideMove(activeSlide)
                    return false;
                }

                let opacity = 0.75 - Math.abs(hDistance) / slideWidth;
                activeSlideMedia.style.opacity = opacity;
                if (activeSlideDesc) {
                    activeSlideDesc.style.opacity = opacity;
                }
                slideCSSTransform(activeSlideMedia, `translate3d(${hDistancePercent}%, 0, 0)`)
            }
        }, useCapture: { passive: false }
    })



    this.events['touchEnd'] = addEvent('touchend', {
        onElement: body,
        withCallback: (e, target) => {
            vDistance = endCoords.pageY - startCoords.pageY;
            hDistance = endCoords.pageX - startCoords.pageX;
            hDistancePercent = hDistance * 100 / winWidth;

            removeClass(body, 'touching')

            let slideHeight = activeSlide.querySelector('.gslide-inner-content').offsetHeight;
            let slideWidth = activeSlide.querySelector('.gslide-inner-content').offsetWidth;

            // Swipe to top/bottom to close
            if (vSwipe) {
                let onEnd = (slideHeight / 2)
                    vSwipe = false;
                if (Math.abs(vDistance) >= onEnd) {
                    this.close()
                    return;
                }
                resetSlideMove(activeSlide)
                return
            }

            if (hSwipe) {
                hSwipe = false;
                let where = 'prev'
                let asideExist = true
                if(hDistance < 0){
                    where = 'next'
                    hDistance = Math.abs(hDistance)
                }
                if (where == 'prev' && this.index - 1 < 0) {
                    asideExist = false
                }
                if (where == 'next' && this.index + 1 >= this.elements.length) {
                    asideExist = false
                }
                if (asideExist && hDistance >= (slideWidth / 2) - 90) {
                    if (where == 'next') {
                       this.nextSlide();
                    }
                    else{
                       this.prevSlide();
                    }
                    return;
                }
                resetSlideMove(activeSlide)
            }
        }
    })
}