Method: removeDocumentEvents
Stops observing document events when documentDrag is true and the mouse
cursor re-enters the map viewport while dragging.
964894
function() {
        OpenLayers.Element.removeClass(document.body, "olDragDown");
        this.documentEvents = false;
        OpenLayers.Event.stopObserving(document, "mousemove", this._docMove);
        OpenLayers.Event.stopObserving(document, "mouseup", this._docUp);
    }
768972
protected void endDragging(MouseUpEvent event) {

        m_dragging = false;
        DOM.releaseCapture(getElement());
        removeStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().dragging());
    }
575435
function handleDocumentMousedown() {
  path = null;
  lines = [];

  document.addEventListener('mousemove', handleDocumentMousemove);
  document.addEventListener('mouseup', handleDocumentMouseup);
}
215287
public EventHandler<MouseEvent> getDefaultOnDragDetectedEventHandler() {
		return e -> {
			if (isPannable() && e.getButton() == getPanButton() && !e.isPopupTrigger()) {
				this.dragDetected = true;
				if (this.savedCursor == null) {
					final ZoomableCanvas<T> canvas0 = getDocumentCanvas();
					this.savedCursor = canvas0.getCursor();
					if (this.savedCursor == null) {
						this.savedCursor = Cursor.DEFAULT;
					}
					canvas0.setCursor(Cursor.MOVE);
					requestLayout();
				}
			}
		};
	}
919681
public void mouseExited (MouseEvent e)
    {
        // clear the highlight tracking data
        _hcoords.setLocation(-1, -1);
        changeHoverObject(null);
        _remgr.invalidateRegion(_vbounds);
    }
855863
def dragEnterEvent(self, event):
        """"""
        if mimedata2url(event.mimeData()):
            event.accept()
        else:
            event.ignore()
624959
private void stopDragging() {
		if (dragging) {
			dragging = false;
			getContainer().remove(circle);
			getContainer().remove(line);
		}
	}
1289771
def dragEnterEvent(self, event):
        """"""
        source = event.mimeData()
        if source.hasUrls():
            if mimedata2url(source):
                event.acceptProposedAction()
            else:
                event.ignore()
        elif source.hasText():
            event.acceptProposedAction()
1266114
@Override
	public void onBrowserEvent(Event event) {
		super.onBrowserEvent(event);
		if (enabled) {
			switch (DOM.eventGetType(event)) {
			// Unhighlight and cancel keyboard events
				case Event.ONBLUR:
					keyTimer.cancel();
					if (slidingMouse) {
						DOM.releaseCapture(getElement());
						slidingMouse = false;
						slideKnob(event);
						stopSliding(true, true);
					} else if (slidingKeyboard) {
						slidingKeyboard = false;
						stopSliding(true, true);
					}
					unhighlight();
					break;

				// Highlight on focus
				case Event.ONFOCUS:
					highlight();
					break;

				// Mousewheel events
				case Event.ONMOUSEWHEEL:
					int velocityY = DOM.eventGetMouseWheelVelocityY(event);
					DOM.eventPreventDefault(event);
					if (velocityY > 0) {
						shiftRight(1);
					} else {
						shiftLeft(1);
					}
					break;

				// Shift left or right on key press
				case Event.ONKEYDOWN:
					if (!slidingKeyboard) {
						int multiplier = 1;
						if (DOM.eventGetCtrlKey(event)) {
							multiplier = (int) (getTotalRange() / stepSize / 10);
						}

						switch (DOM.eventGetKeyCode(event)) {
							case KeyCodes.KEY_HOME:
								DOM.eventPreventDefault(event);
								setCurrentValue(minValue);
								break;
							case KeyCodes.KEY_END:
								DOM.eventPreventDefault(event);
								setCurrentValue(maxValue);
								break;
							case KeyCodes.KEY_LEFT:
								DOM.eventPreventDefault(event);
								slidingKeyboard = true;
								startSliding(false, true);
								shiftLeft(multiplier);
								keyTimer.schedule(400, false, multiplier);
								break;
							case KeyCodes.KEY_RIGHT:
								DOM.eventPreventDefault(event);
								slidingKeyboard = true;
								startSliding(false, true);
								shiftRight(multiplier);
								keyTimer.schedule(400, true, multiplier);
								break;
							case 32:
								DOM.eventPreventDefault(event);
								setCurrentValue(minValue + getTotalRange() / 2);
								break;
						}
					}
					break;
				// Stop shifting on key up
				case Event.ONKEYUP:
					keyTimer.cancel();
					if (slidingKeyboard) {
						slidingKeyboard = false;
						stopSliding(true, true);
					}
					break;

				// Mouse Events
				case Event.ONMOUSEDOWN:
					setFocus(true);
					slidingMouse = true;
					DOM.setCapture(getElement());
					startSliding(true, true);
					DOM.eventPreventDefault(event);
					slideKnob(event);
					break;
				case Event.ONMOUSEUP:
					if (slidingMouse) {
						DOM.releaseCapture(getElement());
						slidingMouse = false;
						slideKnob(event);
						stopSliding(true, true);
					}
					break;
				case Event.ONMOUSEMOVE:
					if (slidingMouse) {
						slideKnob(event);
					}
					break;
			}
		}
	}
620977
function preDropCleanup() {
                window.onmousewheel = window.document.onmousewheel = null;
                $(window).off(".wsvdragging");
                if (dragged) {
                    $workingFilesContainer.removeClass("dragging");
                    $workingFilesContainer.find(".drag-show-as-selected").removeClass("drag-show-as-selected");
                    endScroll($el);
                    // re-activate the views (adds the "active" class to the view that was previously active)
                    _deactivateAllViews(false);
                    // turn scroll wheel back on
                    $ghost.remove();
                    $el.css("opacity", "");

                    if ($el.next().length === 0) {
                        scrollCurrentViewToBottom();
                    }
                }
            }
541508
function () {
            Event.unsubscribe(Event.POINTERMOVE, this.dragMove);
            Event.unsubscribe(Event.DRAGSTART, this.dragStart);
            Event.unsubscribe(Event.DRAGEND, this.dragEnd);
            this.removePointerEvent("pointerdown", this);
            this.removePointerEvent("pointerup", this);
        }
39277
function() {
        if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)) {
            this.dragPan.deactivate();
            this.handlers.click.deactivate();
            this.pinchZoom.deactivate();
            return true;
        }
        return false;
    }
134904
function handleDocumentKeyup(e) {
  // Cancel rect if Esc is pressed
  if (e.keyCode === 27) {
    let selection = window.getSelection();
    selection.removeAllRanges();
    if (overlay && overlay.parentNode) {
      overlay.parentNode.removeChild(overlay);
      overlay = null;
      document.removeEventListener('mousemove', handleDocumentMousemove);
    }
  }
}
933630
function setDOMEvents() {
			var lastWasOutsidePlot = true;
			/*
			 * Record the starting position of a dragoperation
			 */
			container.onmousedown = function (e) {
				e = normalizeMouseEvent(e);

				// issue #295, dragging not always working in Firefox
				if (!hasTouch && e.preventDefault) {
					e.preventDefault();
				}

				// record the start position
				chart.mouseIsDown = mouseIsDown = true;
				mouseDownX = e.chartX;
				mouseDownY = e.chartY;

				addEvent(doc, hasTouch ? 'touchend' : 'mouseup', drop);
			};

			// The mousemove, touchmove and touchstart event handler
			var mouseMove = function (e) {

				// let the system handle multitouch operations like two finger scroll
				// and pinching
				if (e && e.touches && e.touches.length > 1) {
					return;
				}

				// normalize
				e = normalizeMouseEvent(e);
				if (!hasTouch) { // not for touch devices
					e.returnValue = false;
				}

				var chartX = e.chartX,
					chartY = e.chartY,
					isOutsidePlot = !isInsidePlot(chartX - plotLeft, chartY - plotTop);

				// cache chart position for issue #149 fix
				if (!chartPosition) {
					chartPosition = getPosition(container);
				}

				// on touch devices, only trigger click if a handler is defined
				if (hasTouch && e.type === 'touchstart') {
					if (attr(e.target, 'isTracker')) {
						if (!chart.runTrackerClick) {
							e.preventDefault();
						}
					} else if (!runChartClick && !isOutsidePlot) {
						e.preventDefault();
					}
				}

				// cancel on mouse outside
				if (isOutsidePlot) {

					/*if (!lastWasOutsidePlot) {
						// reset the tracker
						resetTracker();
					}*/

					// drop the selection if any and reset mouseIsDown and hasDragged
					//drop();
					if (chartX < plotLeft) {
						chartX = plotLeft;
					} else if (chartX > plotLeft + plotWidth) {
						chartX = plotLeft + plotWidth;
					}

					if (chartY < plotTop) {
						chartY = plotTop;
					} else if (chartY > plotTop + plotHeight) {
						chartY = plotTop + plotHeight;
					}

				}

				if (mouseIsDown && e.type !== 'touchstart') { // make selection

					// determine if the mouse has moved more than 10px
					hasDragged = Math.sqrt(
						Math.pow(mouseDownX - chartX, 2) +
						Math.pow(mouseDownY - chartY, 2)
					);
					if (hasDragged > 10) {

						// make a selection
						if (hasCartesianSeries && (zoomX || zoomY) &&
								isInsidePlot(mouseDownX - plotLeft, mouseDownY - plotTop)) {
							if (!selectionMarker) {
								selectionMarker = renderer.rect(
									plotLeft,
									plotTop,
									zoomHor ? 1 : plotWidth,
									zoomVert ? 1 : plotHeight,
									0
								)
								.attr({
									fill: optionsChart.selectionMarkerFill || 'rgba(69,114,167,0.25)',
									zIndex: 7
								})
								.add();
							}
						}

						// adjust the width of the selection marker
						if (selectionMarker && zoomHor) {
							var xSize = chartX - mouseDownX;
							selectionMarker.attr({
								width: mathAbs(xSize),
								x: (xSize > 0 ? 0 : xSize) + mouseDownX
							});
						}
						// adjust the height of the selection marker
						if (selectionMarker && zoomVert) {
							var ySize = chartY - mouseDownY;
							selectionMarker.attr({
								height: mathAbs(ySize),
								y: (ySize > 0 ? 0 : ySize) + mouseDownY
							});
						}
					}

				} else if (!isOutsidePlot) {
					// show the tooltip
					onmousemove(e);
				}

				lastWasOutsidePlot = isOutsidePlot;

				// when outside plot, allow touch-drag by returning true
				return isOutsidePlot || !hasCartesianSeries;
			};

			/*
			 * When the mouse enters the container, run mouseMove
			 */
			container.onmousemove = mouseMove;

			/*
			 * When the mouse leaves the container, hide the tracking (tooltip).
			 */
			addEvent(container, 'mouseleave', resetTracker);

			// issue #149 workaround
			// The mouseleave event above does not always fire. Whenever the mouse is moving
			// outside the plotarea, hide the tooltip
			addEvent(doc, 'mousemove', hideTooltipOnMouseMove);

			container.ontouchstart = function (e) {
				// For touch devices, use touchmove to zoom
				if (zoomX || zoomY) {
					container.onmousedown(e);
				}
				// Show tooltip and prevent the lower mouse pseudo event
				mouseMove(e);
			};

			/*
			 * Allow dragging the finger over the chart to read the values on touch
			 * devices
			 */
			container.ontouchmove = mouseMove;

			/*
			 * Allow dragging the finger over the chart to read the values on touch
			 * devices
			 */
			container.ontouchend = function () {
				if (hasDragged) {
					resetTracker();
				}
			};


			// MooTools 1.2.3 doesn't fire this in IE when using addEvent
			container.onclick = function (e) {
				var hoverPoint = chart.hoverPoint;
				e = normalizeMouseEvent(e);

				e.cancelBubble = true; // IE specific


				if (!hasDragged) {
					if (hoverPoint && attr(e.target, 'isTracker')) {
						var plotX = hoverPoint.plotX,
							plotY = hoverPoint.plotY;

						// add page position info
						extend(hoverPoint, {
							pageX: chartPosition.left + plotLeft +
								(inverted ? plotWidth - plotY : plotX),
							pageY: chartPosition.top + plotTop +
								(inverted ? plotHeight - plotX : plotY)
						});

						// the series click event
						fireEvent(hoverPoint.series, 'click', extend(e, {
							point: hoverPoint
						}));

						// the point click event
						hoverPoint.firePointEvent('click', e);

					} else {
						extend(e, getMouseCoordinates(e));

						// fire a click event in the chart
						if (isInsidePlot(e.chartX - plotLeft, e.chartY - plotTop)) {
							fireEvent(chart, 'click', e);
						}
					}


				}
				// reset mouseIsDown and hasDragged
				hasDragged = false;
			};

		}
1090561
function startDrag(e) {
      // Preventing the event's default action stops text being
      // selectable during the drag.
      e.preventDefault();

      var self = $(this);
      self.trigger('startDrag');

      // Measure how far the user's mouse is from the top of the scrollbar drag handle.
      var eventOffset = e.pageY;
      if (scrollDirection === 'horiz') {
        eventOffset = e.pageX;
      }
      dragOffset = eventOffset - $dragHandleEl.offset()[offsetAttr];

      $(document).on('mousemove', drag);
      $(document).on('mouseup', function() {
        endDrag.call(self);
      });
    }
98472
function dragHandler(event) {
            dragging.released = event.type === 'mouseup' || event.type === 'touchend';
            dragging.path     = within(
                (dragging.touch ? event.originalEvent[dragging.released ? 'changedTouches' : 'touches'][0] : event)[o.horizontal ? 'pageX' : 'pageY'] - dragging.initLoc,
                dragging.pathMin, dragging.pathMax
            );

            // Initialization
            if (!dragging.init && (Math.abs(dragging.path) > (dragging.touch ? 50 : 10) || dragging.source === 'handle')) {
                dragging.init = 1;
                if (dragging.source === 'slidee') {
                    ignoreNextClick = 1;
                }

                // Pause ongoing cycle
                self.pause(1);

                // Disable click actions on source element, as they are unwelcome when dragging
                dragging.$source.on('click', function disableAction(event) {
                    stopDefault(event, 1);
                    if (dragging.source === 'slidee') {
                        ignoreNextClick = 0;
                    }
                    dragging.$source.off('click', disableAction);
                });

                // Trigger moveStart event
                trigger('moveStart');
            }

            // Proceed when initialized
            if (dragging.init) {
                stopDefault(event);

                // Adjust path with a swing on mouse release
                if (dragging.released && dragging.source === 'slidee' && o.speed > 33) {
                    dragging.path += dragging.path * 200 / (+new Date() - dragging.start);
                }

                slideTo(dragging.source === 'slidee' ? Math.round(dragging.initPos - dragging.path) : handleToSlidee(dragging.initPos + dragging.path));
            }

            // Cleanup and trigger :moveEnd event on release
            if (dragging.released) {
                $doc.off(dragging.touch ? dragTouchEvents : dragMouseEvents, dragHandler);
                (dragging.source === 'slidee' ? $slidee : $handle).removeClass(o.draggedClass);

                // Account for item snapping position adjustment.
                if (pos.cur === pos.dest) {
                    trigger('moveEnd');
                }
            }
        }
1085715
function(feature) {
        if(!this.handlers.drag.dragging) {
            this.over = false;
            this.handlers.drag.deactivate();
            OpenLayers.Element.removeClass(
                this.map.viewPortDiv, this.displayClass + "Over"
            );
            this.onLeave(feature);
            this.feature = null;
        } else {
            if(this.feature.id == feature.id) {
                this.over = false;
            }
        }
    }