Opened 12 years ago

Last modified 10 years ago

#6909 open feature

Mouse: dragging on right click

Reported by: [email protected] Owned by: [email protected]
Priority: minor Milestone: 2.0.0
Component: ui.mouse Version: 1.8.9
Keywords: Cc:
Blocked by: Blocking:


Using the "which" option to target a specific mouse button. like in this example

$(myDIv).draggable({distance: 5, zIndex: 2700,which:3});

which (Number) Default: 1
A number that matches the "which" event property to indicate the mousebutton that is pressed. (0 = Any Button, 1 = Left Button, 2 = Middle Button, 3 = Right Button)

Change History (12)

comment:1 Changed 12 years ago by [email protected]

maybe it is related to this jquery.ui.mouse.js

_mouseDown: function(event) {
		// don't let more than one widget handle mouseStart
		// TODO: figure out why we have to use originalEvent
		event.originalEvent = event.originalEvent || {};
		if (event.originalEvent.mouseHandled) { return; }

		// we may have missed mouseup (out of window)
		(this._mouseStarted && this._mouseUp(event));

		this._mouseDownEvent = event;

		var self = this,
			btnIsLeft = (event.which == 1), '''<--- Add support to specify this'''
			elIsCancel = (typeof this.options.cancel == "string" ? $( : false);
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
			return true;

comment:2 Changed 12 years ago by [email protected]

I made some changes, and it started working!

in widget "ui.mouse"in deafult options i added option "which:1"


and in function _mouseDown changed to read this option

btnIsLeft = (event.which == this.options.which) // instead of this (event.which == 1)

comment:3 Changed 11 years ago by Scott González

Type: enhancementfeature

comment:4 Changed 11 years ago by Ev_genus

Please move this ticket to ui.mouse and add callback invocation to check if widget should capture. In my project I have like 3 different drag-n-drops and many status depend selections. I can't make it without shift/ctrl/alt and both buttons. I can't monkey patch that either because of mouseHandled variable. Fix it ASAP. This ticket is blocker for me.

Last edited 11 years ago by Ev_genus (previous) (diff)

comment:5 Changed 10 years ago by [email protected]

reopened new ticket p.s dont know how to move tickets, sorry

comment:6 Changed 10 years ago by Scott González

#8617 is a duplicate of this ticket.

comment:7 Changed 10 years ago by Scott González

Component: ui.draggableui.mouse
Owner: set to [email protected]
Status: newpending

What is the use case for this? This is extremely uncommon and confusing to users.

comment:8 Changed 10 years ago by [email protected]

Status: pendingnew

I developing Diagram Builder, with nodes and transitions between them. When you dragging node by pressing left key - it's normal dragging of the node. When you dragging node by pressing right key - you are starting drawing transition from current node to next node.

It is very comfortable to draw diagrams with both keys. p.s i could atatch some examples, if it is not clear

comment:9 Changed 10 years ago by Scott González

You'll be able to cleanly hook into this in the rewrite, but for now, I'd suggest hacking around it. Perhaps listen for mousedown on the right button and retrigger the event with the which property changed.

comment:10 Changed 10 years ago by [email protected]

I see, thnx
For now I'am using modified(patched) version of jquery-ui ( changed 2 lines like in 1st comment above )
p.s hope this will work without patching in next release of jquery-ui :)

Diagram Builder

comment:11 Changed 10 years ago by Scott González


comment:12 Changed 10 years ago by petersendidit

Status: newopen
Summary: dragging on right clickMouse: dragging on right click
Note: See TracTickets for help on using tickets.