Mouse interactions
349839
function onButtonEvent(e) {
      var target = e.target;
      var confirmButton = domCache.confirmButton,
          cancelButton = domCache.cancelButton;
      var targetedConfirm = confirmButton && (confirmButton === target || confirmButton.contains(target));
      var targetedCancel = cancelButton && (cancelButton === target || cancelButton.contains(target));

      switch (e.type) {
        case 'click':
          // Clicked 'confirm'
          if (targetedConfirm && constructor.isVisible()) {
            _this.disableButtons();

            if (innerParams.input) {
              var inputValue = getInputValue();

              if (innerParams.inputValidator) {
                _this.disableInput();

                var validationPromise = Promise.resolve().then(function () {
                  return innerParams.inputValidator(inputValue, innerParams.extraParams);
                });

                if (innerParams.expectRejections) {
                  validationPromise.then(function () {
                    _this.enableButtons();

                    _this.enableInput();

                    confirm(inputValue);
                  }, function (validationMessage) {
                    _this.enableButtons();

                    _this.enableInput();

                    if (validationMessage) {
                      _this.showValidationMessage(validationMessage);
                    }
                  });
                } else {
                  validationPromise.then(function (validationMessage) {
                    _this.enableButtons();

                    _this.enableInput();

                    if (validationMessage) {
                      _this.showValidationMessage(validationMessage);
                    } else {
                      confirm(inputValue);
                    }
                  }, function (error$$1) {
                    return errorWith(error$$1);
                  });
                }
              } else {
                confirm(inputValue);
              }
            } else {
              confirm(true);
            } // Clicked 'cancel'

          } else if (targetedCancel && constructor.isVisible()) {
            _this.disableButtons();

            dismissWith(constructor.DismissReason.cancel);
          }

          break;

        default:
      }
    }
666503
def move_mouse_relative(self, x, y):
        
        _libxdo.xdo_move_mouse_relative(self._xdo, x, y)
1230680
def mouse_release_event(self, event):
        
        # Support left and right mouse button for now
        if event.button() not in [1, 2]:
            return

        self.example.mouse_release_event(event.x(), event.y(), event.button())
844611
function mouseup(inEvent) {
  if (!this.isEventSimulatedFromTouch_(inEvent)) {
    const p = this.pointerMap[POINTER_ID.toString()];

    if (p && p.button === inEvent.button) {
      const e = prepareEvent(inEvent, this.dispatcher);
      this.dispatcher.up(e, inEvent);
      this.cleanupMouse();
    }
  }
}
1236485
def on_mouse(self, event):
        ''''''
        state = self.state
        pos = event.GetPosition()
        if event.Leaving():
            self.mouse_pos = None
        else:
            self.mouse_pos = pos
        self.update_position()

        if hasattr(event, 'ButtonIsDown'):
            any_button_down = event.ButtonIsDown(wx.MOUSE_BTN_ANY)
            left_button_down = event.ButtonIsDown(wx.MOUSE_BTN_LEFT)
            right_button_down = event.ButtonIsDown(wx.MOUSE_BTN_RIGHT)
        else:
            left_button_down = event.leftIsDown
            right_button_down = event.rightIsDown
            any_button_down = left_button_down or right_button_down

        if any_button_down or event.ButtonUp():
            # send any event with a mouse button to the parent
            latlon = self.coordinates(pos.x, pos.y)
            selected = self.selected_objects(pos)
            state.event_queue.put(SlipMouseEvent(latlon, event, selected))
            if event.RightDown():
                state.popup_object = None
                state.popup_latlon = None
                if len(selected) > 0:
                    obj = state.layers[selected[0].layer][selected[0].objkey]
                    if obj.popup_menu is not None:
                        state.popup_object = obj
                        state.popup_latlon = latlon
                        self.show_popup(obj, pos)
                        state.popup_started = True
                if not state.popup_started and state.default_popup is not None:
                    state.popup_latlon = latlon
                    self.show_default_popup(pos)
                    state.popup_started = True

        if not right_button_down:
            state.popup_started = False

        if event.LeftDown() or event.RightDown():
            self.mouse_down = pos
            self.last_click_pos = self.click_pos
            self.click_pos = self.coordinates(pos.x, pos.y)

        if event.Dragging() and left_button_down:
            # drag map to new position
            newpos = pos
            if self.mouse_down and newpos:
                dx = (self.mouse_down.x - newpos.x)
                dy = -(self.mouse_down.y - newpos.y)
                pdist = math.sqrt(dx**2 + dy**2)
                if pdist > state.drag_step:
                    bearing = math.degrees(math.atan2(dx, dy))
                    distance = (state.ground_width/float(state.width)) * pdist
                    newlatlon = mp_util.gps_newpos(state.lat, state.lon, bearing, distance)
                    (state.lat, state.lon) = newlatlon
                    self.mouse_down = newpos
                    self.redraw_map()
317735
def interaction(
            self,
            frame,
            tb=None,
            exception='Wdb',
            exception_description='Stepping',
            init=None,
            shell=False,
            shell_vars=None,
            source=None,
            iframe_mode=False,
            timeout=None,
            post_mortem=False
    ):
        """"""
        log.info(
            'Interaction %r %r %r %r' %
            (frame, tb, exception, exception_description)
        )
        self.reconnect_if_needed()
        self.stepping = not shell

        if not iframe_mode:
            opts = {}
            if shell:
                opts['type_'] = 'shell'
            if post_mortem:
                opts['type_'] = 'pm'
            self.open_browser(**opts)

        lvl = len(self.interaction_stack)
        if lvl:
            exception_description += ' [recursive%s]' % (
                '^%d' % lvl if lvl > 1 else ''
            )

        interaction = Interaction(
            self,
            frame,
            tb,
            exception,
            exception_description,
            init=init,
            shell=shell,
            shell_vars=shell_vars,
            source=source,
            timeout=timeout
        )

        self.interaction_stack.append(interaction)

        # For meta debugging purpose
        self._ui = interaction

        if self.begun:
            # Each new state sends the trace and selects a frame
            interaction.init()
        else:
            self.begun = True

        interaction.loop()
        self.interaction_stack.pop()
        if lvl:
            self.interaction_stack[-1].init()
1331369
def mouseReleaseEvent(self, event):
        """"""
        QTreeView.mouseReleaseEvent(self, event)
        if self.single_click_to_open:
            self.clicked()
380985
function onMouseMove(event, env, isSideEffectsDisabled) {
    event.preventDefault();
    mouse.move(event, env ? env.camera : null);

    if (!env || isSideEffectsDisabled) {
        return;
    }

    if(mouse.keys[1] && !mouse.keys[3]) {
        moveObject(env.library, env.camera, env.selector);
    } else {
        focusObject(env.library, env.camera, env.selector);
    }
}
1207653
def mouse_out(self):
        
        self.scroll_to()
        ActionChains(self.parent.driver).move_by_offset(0, 0).click().perform()
5423
function TouchMouseInput() {
  Input.apply(this, arguments);

  var handler = this.handler.bind(this);
  this.touch = new TouchInput(this.manager, handler);
  this.mouse = new MouseInput(this.manager, handler);
}
10309
function updateMouse(e) {
  input.mouse.clientX = e.clientX;
  input.mouse.clientY = e.clientY;
  input.mouse.buttons = e.buttons;
  if (e.type === 'mouseleave') input.mouse.mouseOnDocument = false;
  else input.mouse.mouseOnDocument = true;
}
1323281
public void addMouseEventCallback(MouseEventCallback callback) {
		if (mouseEventCallbacks == null) {
			mouseEventCallbacks = new ArrayList<MouseEventCallback>();
		}
		mouseEventCallbacks.add(callback);
	}
152501
private void addDeviceMouse()
    {
        final MouseAwt mouse = new MouseAwt();
        addMouseListener(mouse);
        devices.put(Mouse.class, mouse);
        devices.put(InputDevicePointer.class, mouse);
    }
1160772
def mouse_area(self, handler, group=0, ident=None):
        """"""
        key = ident or id(handler)
        if key not in self.mouse_proxies[group]:
            self.mouse_proxies[group][key] = MouseProxy(handler, ident)
        return self.mouse_proxies[group][key]
991512
def tick(self, events):
        
        self.add_new_threads()

        if self.drag_sprite:
            (mx, my) = self.screen.get_mouse_pos()
            (ox, oy) = self.drag_offset
            new_position = (mx + ox, my + oy)
            if self.drag_sprite.position != new_position:
                self.has_dragged = True
                self.drag_sprite.position = new_position

        for event in events:
            if event.kind == "key_pressed":
                assert event.value in kurt.Insert(None, "key").options()
                self.trigger_hats("whenKeyPressed", event.value)

            elif event.kind == "mouse_down":
                mouse_pos = self.screen.get_mouse_pos()
                for sprite in reversed(self.project.sprites):
                    rect = bounds(sprite)
                    if rect.collide_point(mouse_pos):
                        if self.screen.touching_mouse(sprite):
                            scriptable = sprite
                            break
                else:
                    scriptable = self.project.stage

                if scriptable.is_draggable:
                    (mx, my) = self.screen.get_mouse_pos()
                    (x, y) = scriptable.position
                    self.drag_offset = (x - mx, y - my)
                    self.drag_sprite = scriptable
                    self.has_dragged = False
                    go_to_front(scriptable)
                else:
                    self.trigger_scriptable_hats(scriptable, "whenClicked")

            elif event.kind == "mouse_up":
                if self.drag_sprite:
                    if not self.has_dragged:
                        self.trigger_scriptable_hats(self.drag_sprite,
                                                     "whenClicked")
                    self.drag_sprite = None

        remove_threads = []
        while 1:
            for (script, thread) in self.threads.items():
                modified = False
                for event in thread.tick():
                    if event.kind == "stop":
                        if event.value == "all":
                            self.stop()
                            return
                        elif event.value == "other scripts in sprite":
                            for (script, other) in self.threads.items():
                                if other.scriptable == thread.scriptable:
                                    other.finish()
                                    del self.threads[script]
                            modified = True
                            break
                        else:
                            thread.finish()
                            del self.threads[script]
                            modified = True
                            break
                    else: # Pass to Screen
                        yield event
                if modified:
                    break
            else:
                break

        self.add_new_threads()
101883
function(e) {
      var p = this._getMouseEvtPos(e);
		var lx = p[0], ly = p[1], n = this.wires.length, w;
		for(var i = 0 ; i < n ; i++) {
			w = this.wires[i];
			var elx = w.element.offsetLeft, ely = w.element.offsetTop;
			// Check if the mouse is within the canvas boundaries
			if( lx >= elx && lx < elx+w.element.width && ly >= ely && ly < ely+w.element.height ) {
				var rx = lx-elx, ry = ly-ely; // relative to the canvas
				w.onClick(rx,ry);
			}
		}
	}
339805
def mousePressEvent( self, event ):
        
        event.setAccepted(False)
        self._hotspotPressed = False
        # ignore events when the scene is in view mode
        scene = self.scene()
        if self.isLocked() or (scene and scene.inViewMode()):
            event.ignore()
            self._ignoreMouseEvents = True
            return
        
        self._ignoreMouseEvents = False
        
        # block the selection signals
        if scene:
            scene.blockSelectionSignals(True)
            
            # clear the selection
            if ( not (self.isSelected() or 
                      event.modifiers() == Qt.ControlModifier) ):
                for item in scene.selectedItems():
                    if ( item != self ):
                        item.setSelected(False)
        
        # determine if we need to start any connections
        hotspot = self.hotspotAt(event.pos())
        if hotspot and hotspot.isEnabled():
            hotspot.slot()(event)
        
            # check if the event is accepted
            if ( event.isAccepted() ):
                self._hotspotPressed = True
                return
        
        # try to start the connection
        event.accept()
        self._pressTime = datetime.datetime.now()
        super(XNode, self).mousePressEvent(event)