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

Programmatically click on object #21

Open
ernistkg opened this issue May 10, 2016 · 5 comments
Open

Programmatically click on object #21

ernistkg opened this issue May 10, 2016 · 5 comments

Comments

@ernistkg
Copy link

Is there any way to programmatically click object with domEvent plugin or pure THREEjs?

@weiserhei
Copy link
Contributor

mesh._3xDomEvent.clickHandlers[ 0 ].callback();

@jeromeetienne
Copy link
Owner

this may work... but wow this is kludgy :)

@jpdesignerrio
Copy link

jpdesignerrio commented Feb 1, 2019

Hey there! EventListener not working on mobile only (Android and Chrome for Windows using mobile view [developer tools]). Curiously, when I change from 'click' to 'mouseover', and I click and drag, it recognizes the "mouse over"

@jpdesignerrio
Copy link

jpdesignerrio commented Feb 1, 2019

I saw in threex.domevents.js the code:

this._domElement.addEventListener( 'touchmove'	, this._$onTouchMove	, false );
this._domElement.addEventListener( 'touchstart'	, this._$onTouchStart	, false );
this._domElement.addEventListener( 'touchend'	, this._$onTouchEnd	, false );

this is not in README ...

So I change 'click' to 'touchstart' and it works. 👍

@jpdesignerrio
Copy link

In web and mobile handle click and touch are different. So, I do that:

var mouseEventHandle = 'click';
if('ontouchstart' in document.documentElement === true)
	mouseEventHandle = 'touchstart';

domEvents.addEventListener(meshObject, mouseEventHandle, callbackFunction());

Hope help someone!

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

4 participants