Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on chrome browser #29

Open
spezialy opened this issue Mar 20, 2017 · 1 comment
Open

Doesn't work on chrome browser #29

spezialy opened this issue Mar 20, 2017 · 1 comment

Comments

@spezialy
Copy link

Hello,
i determine in my test with the propeller.js lib that it doesn't work on my chrome browser (Version 57.0.2987.110) under windows. On your example page (http://pixelscommander.com/polygon/propeller/example/jquerygrid.html) the behavior is the same, i can not grab and move the propeller.

@nameless0815
Copy link

nameless0815 commented Mar 20, 2017

Same problem here!

Chrome seems to register on touch events, caused by this code:

        if ('ontouchstart' in document.documentElement) {
            this.touchElement.addEventListener('touchstart', this.onRotationStart);
            this.touchElement.addEventListener('touchmove', this.onRotated);
            this.touchElement.addEventListener('touchend', this.onRotationStop);
            this.touchElement.addEventListener('touchcancel', this.onRotationStop);
            this.touchElement.addEventListener('dragstart', this.returnFalse);
        } else {
            this.touchElement.addEventListener('mousedown', this.onRotationStart);
            this.touchElement.addEventListener('mousemove', this.onRotated);
            this.touchElement.addEventListener('mouseup', this.onRotationStop);
            this.touchElement.addEventListener('mouseleave', this.onRotationStop);
            this.touchElement.addEventListener('dragstart', this.returnFalse);
        }

You can register both types of events (mouse and touch) without any if clause to get it working again:

        this.touchElement.addEventListener('touchstart', this.onRotationStart);
        this.touchElement.addEventListener('touchmove', this.onRotated);
        this.touchElement.addEventListener('touchend', this.onRotationStop);
        this.touchElement.addEventListener('touchcancel', this.onRotationStop);
        this.touchElement.addEventListener('mousedown', this.onRotationStart);
        this.touchElement.addEventListener('mousemove', this.onRotated);
        this.touchElement.addEventListener('mouseup', this.onRotationStop);
        this.touchElement.addEventListener('mouseleave', this.onRotationStop);
        this.touchElement.addEventListener('dragstart', this.returnFalse);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants