search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Right-click range select, on button release

Asked by Beyers
6 years ago.

Hi,

Which function fires when the right mouse button is released after selecting a date range.

"onTimeRangeRightClick" and "onTimeRangeRightClicked" fires on button down, not button up.

Thanks.

Comment posted by Beyers
6 years ago.

Update:

It appears "onTimeRangeSelected" fires on time range right mouse button release, but only if "allowMultiRange" is set to true.

Comment posted by Dan Letecky [DayPilot]
6 years ago.

There is a special event that is fired for selections made using a right mouse button:

https://api.daypilot.org/daypilot-scheduler-ontimerangerightclick/

It's also fired when you right-click an existing selection.

Comment posted by Beyers
6 years ago.

Thank you Dan

My issue is that that function, "onTimeRangeRightClick", fires on the mousedown event, not on the mouseup.

So what would happen is:
I right click on a date, the event fires, I select a range and then release.

Instead of:
I right click on a date, I select a range, release and then the event fires.

My hacky solution is to use "onTimeRangeSelected", which fires after mouseup, to detect if the last button press was "left" or "right".

Comment posted by Dan Letecky [DayPilot]
6 years ago.

You might be using an older version - the latest release fires onTimeRangeRightClick on mouseup, at least in my tests.

You can try it by opening the main demo (https://javascript.daypilot.org/demo/scheduler/) and running this in the console:

dp.onTimeRangeRightClick = function(args) { DayPilot.Modal.alert("onTimeRangeRightClick"); };

Let me know if it doesn't work as expected.

Comment posted by Beyers
6 years ago.

On the main demo, the alert shows the moment I press right mouse button on a date, instead of the moment I release.

Tested on:
Firefox 62.0.3
Brave 0.55.20
Chrome 70.0.3538.77
Safari 12.0

I am using:
macOS Mojave 10.14

Comment posted by Dan Letecky [DayPilot]
6 years ago.

Yes, you are right - it looks like on macOS the behavior is different for some reason. I'm checking the issue.

Answer posted by Dan Letecky [DayPilot]
6 years ago.

This issue should be fixed now in the latest sandbox build (2018.4.3470):

https://javascript.daypilot.org/sandbox/

Comment posted by Beyers
6 years ago.

Thanks Dan

It is confirmed as working.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.