Hook mouseup so we can unbind our event listeners When they stop dragging
961744
function onMouseUp(e) {
    // Cancel the timeout preventing the click event from triggering
    clearTimeout(preventClickTimeout);

    let eventType = EVENTS.MOUSE_UP;

    if (isClickEvent) {
      eventType = EVENTS.MOUSE_CLICK;
    }

    // Calculate our current points in page and image coordinates
    const currentPoints = {
      page: external.cornerstoneMath.point.pageToPoint(e),
      image: external.cornerstone.pageToPixel(element, e.pageX, e.pageY),
      client: {
        x: e.clientX,
        y: e.clientY,
      },
    };

    currentPoints.canvas = external.cornerstone.pixelToCanvas(
      element,
      currentPoints.image
    );

    // Calculate delta values in page and image coordinates
    const deltaPoints = {
      page: external.cornerstoneMath.point.subtract(
        currentPoints.page,
        lastPoints.page
      ),
      image: external.cornerstoneMath.point.subtract(
        currentPoints.image,
        lastPoints.image
      ),
      client: external.cornerstoneMath.point.subtract(
        currentPoints.client,
        lastPoints.client
      ),
      canvas: external.cornerstoneMath.point.subtract(
        currentPoints.canvas,
        lastPoints.canvas
      ),
    };

    logger.log('mouseup: %o', getEventButtons(e));
    const eventData = {
      event: e,
      buttons: getEventButtons(e),
      viewport: external.cornerstone.getViewport(element),
      image: enabledElement.image,
      element,
      startPoints,
      lastPoints,
      currentPoints,
      deltaPoints,
      type: eventType,
    };

    triggerEvent(eventData.element, eventType, eventData);

    document.removeEventListener('mousemove', onMouseMove);
    document.removeEventListener('mouseup', onMouseUp);

    element.addEventListener('mousemove', mouseMove);

    isClickEvent = true;
  }
188738
function () {
      this.clear();
      if (this.interactive) {
        removeListener(this.upperCanvasEl, 'mousedown', this._onMouseDown);
        removeListener(this.upperCanvasEl, 'mousemove', this._onMouseMove);
        removeListener(fabric.window, 'resize', this._onResize);
      }
      return this;
    }
657042
function(e) {
            if (this.dragCurrent) {
                clearTimeout(this.clickTimeout);

                if (this.dragThreshMet) {
                    YAHOO.log("mouseup detected - completing drag", "info", "DragDropMgr");
                    if (this.fromTimeout) {
                        YAHOO.log('fromTimeout is true (mouse didn\'t move), call handleMouseMove so we can get the dragOver event', 'info', 'DragDropMgr');
                        this.fromTimeout = false;
                        this.handleMouseMove(e);
                    }
                    this.fromTimeout = false;
                    this.fireEvents(e, true);
                } else {
                    YAHOO.log("drag threshold not met", "info", "DragDropMgr");
                }

                this.stopDrag(e);

                this.stopEvent(e);
            }
        }
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');
                }
            }
        }
612707
function checkAndClearTapHandlers( mouseUpEvent ) {
					// if the mouseup event occurs out of the origin target of the mousedown event,
					// unbind all of the listeners
					if (mouseUpEvent.target !== mouseDownTarget && !$.contains(mouseDownTarget, mouseUpEvent.target) && !buttonTappedInEdgeBrowser( mouseUpEvent )) {
						clearTapHandlers();
					}
				}
1332337
def unhook_drop(self):
        
        widget = self.widget
        widget.setAcceptDrops(False)
        del widget.dragEnterEvent
        del widget.dragMoveEvent
        del widget.dragLeaveEvent
        del widget.dropEvent
949680
function() {
		this.element.off( 'mousedown touchstart', this._onTabClickFn );
		this.closeElement.off( 'click touchstart', this._onCloseClickFn );
		if( this._dragListener ) {
			this.contentItem.off( 'destroy', this._dragListener.destroy, this._dragListener );
			this._dragListener.off( 'dragStart', this._onDragStart );
			this._dragListener = null;
		}
		this.element.remove();
	}
944890
function(element, selector, event, callback, capturePhase) {

    unbind($(element).array[0], event, callback, capturePhase)
  }
66536
function handleMouseDown (e) {
                    if(enabled){
                        for (var i= 0; i<excludedClasses.length; i++) {
                            if (angular.element(e.target).hasClass(excludedClasses[i])) {
                                return false;
                            }
                        }

                        $scope.$apply(function() {
                            onDragStart($scope);
                        });

                        // Set mouse drag listeners
                        setDragListeners();

                        // Set 'pushed' state
                        pushed = true;
                        lastClientX = startClientX = e.clientX;
                        lastClientY = startClientY = e.clientY;

                        clearSelection();

                        e.preventDefault();
                        e.stopPropagation();
                    }

                }
931093
function () {
		Crafty.removeEvent(this, Crafty.stage.elem, "mousemove", this._ondrag);
		Crafty.removeEvent(this, Crafty.stage.elem, "mouseup", this._onup);

		this._dragging = false;
		this.trigger("StopDrag");
		return this;
	}
855863
def dragEnterEvent(self, event):
        """"""
        if mimedata2url(event.mimeData()):
            event.accept()
        else:
            event.ignore()
1261786
function eventEnd ( event, data ) {

            // The handle is no longer active, so remove the class.
            if ( scope_ActiveHandle ) {
                removeClass(scope_ActiveHandle, options.cssClasses.active);
                scope_ActiveHandle = false;
            }

            // Remove cursor styles and text-selection events bound to the body.
            if ( event.cursor ) {
                document.body.style.cursor = '';
                document.body.removeEventListener('selectstart', document.body.noUiListener);
            }

            // Unbind the move and end events, which are added on 'start'.
            document.documentElement.noUiListeners.forEach(function( c ) {
                document.documentElement.removeEventListener(c[0], c[1]);
            });

            // Remove dragging class.
            removeClass(scope_Target, options.cssClasses.drag);

            setZindex();

            data.handleNumbers.forEach(function(handleNumber){
                fireEvent('set', handleNumber);
                fireEvent('change', handleNumber);
                fireEvent('end', handleNumber);
            });
        }
806782
function unbindEvent(element, type, handler) {
    const events = safeEvent(element, type);
    const items = events.get(handler);

    if (!items) {
        return;
    }

    forgetHandler(element, type, handler);

    util.forEach(items, func => {
        if ('removeEventListener' in element) {
            element.removeEventListener(type, func);
        } else if ('detachEvent' in element) {
            element.detachEvent(`on${type}`, func);
        }
    });
}
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]]); 
                }
            } 
        }
    }
517573
function mouseout(inEvent) {
  if (!this.isEventSimulatedFromTouch_(inEvent)) {
    const e = prepareEvent(inEvent, this.dispatcher);
    this.dispatcher.leaveOut(e, inEvent);
  }
}
357784
public void mouseReleased (MouseEvent event)
    {
        if (_activeItem == null) {
            long when = RunAnywhere.getWhen(event);
            if (!_msMode && (when < _poptime + DRAGMODE_DELAY)) {
                // if the dragmode delay time hasn't passed, then we're going to leave the menu up
                // because the user wants it to behave like a MS Windows menu.
                _msMode = true;
                return;

            // if they've double clicked, then activate the default item
            } else if (_msMode && (when < _poptime + DOUBLECLICK_DELAY)) {
                _activeItem = _defaultItem;
            }
        }

        // deactivate the active item and post a command for it
        if (_activeItem != null) {
            // only process the selection if the item is enabled
            if (!_activeItem.isEnabled(this)) {
                return;
            }

            // if the item has an overriding argument, use that
            if (_activeItem.command != null) {
                Object itemArg = _activeItem.argument;
                Object arg = (itemArg == null) ? _argument : itemArg;

                // notify our listeners that the action is posted
                final CommandEvent evt = new CommandEvent(
                    _host.getComponent(), _activeItem.command, arg);
                _actlist.apply(new ObserverList.ObserverOp<ActionListener>() {
                    public boolean apply (ActionListener obs) {
                        obs.actionPerformed(evt);
                        return true;
                    }
                });
            }

            _activeItem.setActive(false);
            _activeItem = null;
        }

        // deactive ourselves
        deactivate();
    }
841679
function() {
            this.element.off( "." + this.widgetName );
            if ( this._mouseMoveDelegate ) {
                this.document
                    .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
                    .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
            }
        }