Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Timeline: Mousedown and mouseup events #3032

Closed
danny-larsen opened this issue May 4, 2017 · 5 comments
Closed

Timeline: Mousedown and mouseup events #3032

danny-larsen opened this issue May 4, 2017 · 5 comments

Comments

@danny-larsen
Copy link
Contributor

Is is possible to add in the mousedown and mouseup events again?

I can see that it was in this pull request: #2473 but was removed again.

We are trying to make it so that on mousedown we start a new event. The user then drags over some days and on mouseup we want to create an event for the selected days.

@yotamberk
Copy link
Contributor

It's a very simple addition. Can you please submit a PR with this?

@danny-larsen
Copy link
Contributor Author

I will give it a go :)

@danny-larsen
Copy link
Contributor Author

I tried to make it work, but for some reason it does not capture the mousedown on the left mouse button. Any ideas?

Here is the code i tried in Timeline.js:
this.dom.root.onmousedown = function (event) {
console.log('mousedown');
me.emit('mouseDown', me.getEventProperties(event))
};

@danny-larsen
Copy link
Contributor Author

danny-larsen commented May 9, 2017

I made it work with this:

if(window.PointerEvent) {
        this.dom.root.onpointerdown = function (event) {
            me.emit('mouseDown', me.getEventProperties(event))
        };

        this.dom.root.onpointerup = function (event) {
            me.emit('mouseUp', me.getEventProperties(event))
        };
    } else {
        this.dom.root.onmousedown = function (event) {
            me.emit('mouseDown', me.getEventProperties(event))
        };

        this.dom.root.onmouseup = function (event) {
            me.emit('mouseUp', me.getEventProperties(event))
        };
    }

Does that look right @yotamberk ?

@yotamberk
Copy link
Contributor

Looks fine to me! Please submit the PR so I can test it out.

yotamberk pushed a commit that referenced this issue May 19, 2017
* mouseup and mousedown events

* Fix error
@mojoaxel mojoaxel added this to the Minor Release v4.20 milestone May 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants