Opened 9 years ago

Last modified 7 years ago

#6909 open feature

Mouse: dragging on right click

Reported by: timur.junussov@… Owned by: timur.junussov@…
Priority: minor Milestone: 2.0.0
Component: ui.mouse Version: 1.8.9
Keywords: Cc:
Blocked by: Blocking:

Description

Using the "which" option to target a specific mouse button. like in this example http://threedubmedia.com/code/event/drag/demo/which

$(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 9 years ago by timur.junussov@…

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" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
			return true;
		}
Last edited 7 years ago by timur.junussov@… (previous) (diff)

comment:2 Changed 9 years ago by timur.junussov@…

I made some changes, and it started working!

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

options:{cancel:":input,option",distance:1,delay:0,which:1}

and in function _mouseDown changed to read this option

btnIsLeft = (event.which == this.options.which) // instead of this (event.which == 1)
Last edited 9 years ago by timur.junussov@… (previous) (diff)

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

Type: enhancementfeature

comment:4 Changed 7 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 7 years ago by Ev_genus (previous) (diff)

comment:5 Changed 7 years ago by timur.junussov@…

reopened new ticket http://bugs.jqueryui.com/ticket/8617 p.s dont know how to move tickets, sorry

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

#8617 is a duplicate of this ticket.

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

Component: ui.draggableui.mouse
Owner: set to timur.junussov@…
Status: newpending

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

comment:8 Changed 7 years ago by timur.junussov@…

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 7 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 7 years ago by timur.junussov@…

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

http://farm9.staticflickr.com/8173/8048732311_82b56c953b_o.png

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

Milestone: 1.9.02.0.0

comment:12 Changed 7 years ago by petersendidit

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