triggerClickHoverEvent should pass the original event through #31

Open
wants to merge 1 commit into
from

Projects

None yet

3 participants

@campbell
campbell commented Dec 2, 2011

There currently is no way to get information about whether the shift, meta or command keys were pressed when a plotclick event is triggered. This is because the original event object is not used when triggering the new event.

The triggerClickHoverEvent function triggers a new event by calling jQuery.trigger() with a string (e.g. 'plotclick') instead of the event object. Because the original event is not being used, we lose all information about the event (eg. which modifier keys were pressed).

This patch uses the original event object but replaces the TYPE attribute with the new event name.

event.type = eventname;
placeholder.trigger(event, [ pos, item ]);
@sumirolabs sumirolabs Changed #triggerClickHoverEvent to pass through the original event ob…
…ject but with the new event type (so we have access to shiftKey, etc.)
faa169e
@DanielHoffmann

I just want to post a little workaronud I found for this problem:

       var clickMouseEvent= null;
       var clickDeferred= $.Deferred();
        $placeHolder.bind("click", function(event) {
            clickMouseEvent= event;
            clickDeferred.resolve();
        });
        $placeHolder.bind("plotclick", function(ev, pos, item) {
            var that= this;
            $.when(clickDeferred.promise()).then(function() {
                clickEvent.apply(that, [clickMouseEvent, pos, item]);
            });
        });

Very ugly, but it does work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment