Customized mouse dragging, where the right drag is bounding box zoom
        
        :param ev: event object containing drag state info
        :type ev: :py:class:`MouseDragEvent<pyqtgraph:pyqtgraph.GraphicsScene.mouseEvents.MouseDragEvent>`
348613
def mouseDragEvent(self, ev, axis=None):
        
        if self._customMouse and ev.button() == QtCore.Qt.RightButton:
            ev.accept()  ## we accept all buttons

            # directly copy-pasted from ViewBox for ViewBox.RectMode
            if ev.isFinish():  ## This is the final move in the drag; change the view scale now
                #print "finish"
                pos = ev.pos()

                self.rbScaleBox.hide()
                #ax = QtCore.QRectF(Point(self.pressPos), Point(self.mousePos))
                ax = QtCore.QRectF(Point(ev.buttonDownPos(ev.button())), Point(pos))
                ax = self.childGroup.mapRectFromParent(ax)
                self.showAxRect(ax)
                self.axHistoryPointer += 1
                self.axHistory = self.axHistory[:self.axHistoryPointer] + [ax]
            else:
                ## update shape of scale box
                self.updateScaleBox(ev.buttonDownPos(), ev.pos())
        else:
            state = None
            # ctrl reverses mouse operation axis
            if ev.modifiers() == QtCore.Qt.ControlModifier:
                state = self.mouseEnabled()
                self.setMouseEnabled(not state[0], not state[1])
            super(SpikeyViewBox, self).mouseDragEvent(ev, axis)
            if state is not None:
                self.setMouseEnabled(*state)
1204644
function(e) {
        if (this._dragging) return;
        this._dragging = true;

        // TODO: remove this and instead lock on pointer control events in future
        Crafty.s("Mouse").bind("MouseMove", this._ondrag);
        Crafty.s("Mouse").bind("MouseUp", this._onup);

        // if event undefined, use the last known position of the mouse
        this.trigger("StartDrag", e || Crafty.s("Mouse").lastMouseEvent);
        return this;
    }
1083061
def on_drag_motion(self, widget, context, x, y, time):
        
        hovered_item = ItemFinder(self.view.editor).get_item_at_point((x, y))
        if isinstance(hovered_item, NameView):
            hovered_item = hovered_item.parent
        if hovered_item is None:
            self.view.editor.unselect_all()
        elif isinstance(hovered_item.model, ContainerStateModel):
            if len(self.view.editor.selected_items) == 1 and hovered_item in self.view.editor.selected_items:
                return
            if len(self.view.editor.selected_items) > 0:
                self.view.editor.unselect_all()

            if not rafcon.gui.singleton.global_gui_config.get_config_value('DRAG_N_DROP_WITH_FOCUS'):
                self.view.editor.handler_block(self.focus_changed_handler_id)
            self.view.editor.focused_item = hovered_item
            if not rafcon.gui.singleton.global_gui_config.get_config_value('DRAG_N_DROP_WITH_FOCUS'):
                self.view.editor.handler_unblock(self.focus_changed_handler_id)
553759
def _on_wheel_event(self, event):
        
        try:
            delta = event.angleDelta().y()
        except AttributeError:
            # PyQt4/PySide
            delta = event.delta()
        if int(event.modifiers()) & QtCore.Qt.ControlModifier > 0:
            if delta < self.prev_delta:
                self.editor.zoom_out()
                event.accept()
            else:
                self.editor.zoom_in()
                event.accept()
324003
def wheelEvent(self, ev, axis=None):
        """"""
        state = None
        # ctrl reverses mouse operation axis
        if ev.modifiers() == QtCore.Qt.ControlModifier:
            state = self.mouseEnabled()
            self.setMouseEnabled(not state[0], not state[1])
        if self._zeroWheel:
            ev.pos = lambda : self.mapViewToScene(QtCore.QPoint(0,0))
        super(SpikeyViewBox, self).wheelEvent(ev, axis)
        if state is not None:
            self.setMouseEnabled(*state)
72487
function(evt) {
        if (!OpenLayers.Event.isLeftClick(evt) && evt.type !== "touchend") {
            return;
        }
        if (this.mouseDragStart) {
            this.div.style.cursor="";
            this.map.events.un({
                "touchmove": this.passEventToSlider,
                "mouseup": this.passEventToSlider,
                "mousemove": this.passEventToSlider,
                scope: this
            });
            var zoomLevel = this.map.zoom;
            if (!this.forceFixedZoomLevel && this.map.fractionalZoom) {
                zoomLevel += this.deltaY/this.zoomStopHeight;
                zoomLevel = Math.min(Math.max(zoomLevel, 0), 
                                     this.map.getNumZoomLevels() - 1);
            } else {
                zoomLevel += this.deltaY/this.zoomStopHeight;
                zoomLevel = Math.max(Math.round(zoomLevel), 0);      
            }
            this.map.zoomTo(zoomLevel);
            this.mouseDragStart = null;
            this.zoomStart = null;
            this.deltaY = 0;
            OpenLayers.Event.stop(evt);
        }
    }
538046
function onDragEnd(evt) {
    this._dragging = false;

    const
        rect = this._rect,
        x = valueToX.call(this, this._value),
        min = -x,
        max = rect.width - x,
        tx = clamp(evt.x - evt.x0, min, max);
    Dom.css(this.$elements.button, { transform: `translateX(0px)` });
    this.value = xToValue.call(this, x + tx);
}
284024
function DragAndScale(element, skip_events) {
        this.offset = new Float32Array([0, 0]);
        this.scale = 1;
        this.max_scale = 10;
        this.min_scale = 0.1;
        this.onredraw = null;
        this.enabled = true;
        this.last_mouse = [0, 0];
        this.element = null;
        this.visible_area = new Float32Array(4);

        if (element) {
            this.element = element;
            if (!skip_events) {
                this.bindEvents(element);
            }
        }
    }
1093811
function eventElementHandlers(event, eventElement) {
		eventElement
			.click(function(ev) {
				if (!eventElement.hasClass('ui-draggable-dragging') &&
					!eventElement.hasClass('ui-resizable-resizing')) {
						return trigger('eventClick', this, event, ev);
					}
			})
			.hover(
				function(ev) {
					trigger('eventMouseover', this, event, ev);
				},
				function(ev) {
					trigger('eventMouseout', this, event, ev);
				}
			);
		// TODO: don't fire eventMouseover/eventMouseout *while* dragging is occuring (on subject element)
		// TODO: same for resizing
	}
723601
function sendButton(ev) {
    var button
      , pos;

    // get the xterm-style button
    button = getButton(ev);

    // get mouse coordinates
    pos = getCoords(ev);
    if (!pos) return;

    sendEvent(button, pos);

    switch (ev.type) {
      case 'mousedown':
        pressed = button;
        break;
      case 'mouseup':
        // keep it at the left
        // button, just in case.
        pressed = 32;
        break;
      case wheelEvent:
        // nothing. don't
        // interfere with
        // `pressed`.
        break;
    }
  }
1125942
function mouseMove_(ev) {
    var e=ev||event;
    currentX_ = formerX_+((e.pageX||(e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft))-formerMouseX_);
    currentY_ = formerY_+((e.pageY||(e.clientY+document.body.scrollTop+document.documentElement.scrollTop))-formerMouseY_);
    formerX_ = currentX_;
    formerY_ = currentY_;
    formerMouseX_ = e.pageX||(e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft);
    formerMouseY_ = e.pageY||(e.clientY+document.body.scrollTop+document.documentElement.scrollTop);
    if (moving_) {
      moveTo_(currentX_,currentY_, preventDefault_);
      event_.trigger(me, "drag", {mouseX: formerMouseX_, mouseY: formerMouseY_, startLeft: originalX_, startTop: originalY_, event:e});
    }
  }
891277
def mousePressEvent(self, event):
        
        if event.button() == Qt.LeftButton:
            self._drag_origin = event.pos()
        widget = self.widget
        type(widget).mousePressEvent(widget, event)
833331
def mouseMoveEvent(self, event):
        
        #if event.buttons() & Qt.LeftButton and self._drag_origin is not None:
            #dist = (event.pos() - self._drag_origin).manhattanLength()
            #if dist >= QApplication.startDragDistance():
                #self.do_drag(event.widget())
                #self._drag_origin = None
                #return # Don't returns
        widget = self.widget
        type(widget).mouseMoveEvent(widget, event)
761604
def configure_widget_for_editing(self, widget):
        
        
        if not 'editor_varname' in widget.attributes:
            return
        widget.onclick.do(self.on_widget_selection)
        
        #setup of the on_dropped function of the widget in order to manage the dragNdrop 
        widget.__class__.on_dropped = on_dropped

        #drag properties
        #widget.style['resize'] = 'both'
        widget.style['overflow'] = 'auto'
        widget.attributes['draggable'] = 'true'
                
        widget.attributes['tabindex']=str(self.tabindex)
        #if not 'position' in widget.style.keys():
        #    widget.style['position'] = 'absolute'
        #if not 'left' in widget.style.keys():
        #    widget.style['left'] = '1px'
        #if not 'top' in widget.style.keys():
        #    widget.style['top'] = '1px'
        self.tabindex += 1
671622
def mouseMoveEvent(self, event):
        
        self.declaration.mouse_move_event(event)
        super(QtGraphicsView, self).mouseMoveEvent(event)
1110429
def dragMoveEvent( self, event ):
        
        tags = nativestring(event.mimeData().text())
        
        if ( event.source() == self ):
            event.acceptProposedAction()
        elif ( tags ):
            event.acceptProposedAction()
        else:
            super(XMultiTagEdit, self).dragMoveEvent(event)
330972
def wheelEvent(self, event):
        

        if event.modifiers() == Qt.ControlModifier:
            if event.delta() == 120:
                self.zoom_in()
            elif event.delta() == -120:
                self.zoom_out()
            event.ignore()
        else:
            QPlainTextEdit.wheelEvent(self, event)