Skip to main content

Search and Top Navigation

#6909 open feature ()

Opened January 28, 2011 12:41PM UTC

Last modified October 16, 2012 01:08PM UTC

Mouse: dragging on right click

Reported by: timur.junussov@bee.kz Owned by: timur.junussov@bee.kz
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)
Attachments (0)
Change History (12)

Changed January 28, 2011 01:11PM UTC by timur.junussov@bee.kz comment:1

_comment0: 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; \ } \ \ 1349214479517898

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;
		}

Changed January 28, 2011 01:43PM UTC by timur.junussov@bee.kz comment:2

_comment0: I made some changes, and it started working! \ \ in widget '''"ui.mouse"''' i added deafult option "which:1" \ \ {{{ \ options:{cancel:":input,option",distance:1,delay:0,which:1} \ }}} \ \ and in '''_mouseDown''' changed to read this option \ {{ \ btnIsLeft = (event.which == this.options.which) // instead of this (event.which == 1) \ }} \ \ 1296222316801038

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)

Changed June 26, 2012 01:22AM UTC by scottgonzalez comment:3

type: enhancementfeature

Changed September 01, 2012 09:48PM UTC by Ev_genus comment:4

_comment0: 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 monkey patch that either because of `mouseHandled` variable. Fix it ASAP. This ticket is `blocker` for me.1346538828398314

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.

Changed October 02, 2012 09:56PM UTC by timur.junussov@bee.kz comment:5

reopened new ticket http://bugs.jqueryui.com/ticket/8617

p.s dont know how to move tickets, sorry

Changed October 02, 2012 10:16PM UTC by scottgonzalez comment:6

#8617 is a duplicate of this ticket.

Changed October 02, 2012 10:16PM UTC by scottgonzalez comment:7

component: ui.draggableui.mouse
owner: → timur.junussov@bee.kz
status: newpending

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

Changed October 02, 2012 10:53PM UTC by timur.junussov@bee.kz comment:8

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

Changed October 02, 2012 11:01PM UTC by scottgonzalez comment:9

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.

Changed October 02, 2012 11:16PM UTC by timur.junussov@bee.kz comment:10

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

[[Image(http://farm9.staticflickr.com/8173/8048732311_82b56c953b_o.png)]]

Changed October 11, 2012 02:49PM UTC by scottgonzalez comment:11

milestone: 1.9.02.0.0

Changed October 16, 2012 01:08PM UTC by petersendidit comment:12

status: newopen
summary: dragging on right clickMouse: dragging on right click