initObjectPicking(callback, eventType, mouseDownUseTouchStartopt, allowedMouseButtonsopt)
Bind object picking functionality to the given mouse event, e.g. "mousemove",
"mousedown", "dblclick". An additional listener for a touch event
("touchstart" or "touchend") is also registered.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
callback |
pickObjectCallback | A callback function receiving the results of object picking. | ||
eventType |
string | The type of a MouseEvent, e.g. "mousemove", "mousedown", "dblclick". | ||
mouseDownUseTouchStart |
boolean |
<optional> |
false | Use the "touchstart" (if true) or the "touchend" (if false) touch event for object picking for touch devices. |
allowedMouseButtons |
Array.<number> |
<optional> |
null | The array representing mouse buttons allowed to trigger object picking. 0 - left mouse button, 1 - middle mouse button, 2 - right mouse button. "null" (by default) means that object picking will be triggered regardless of any mouse buttons pressed (useful for events that don't require button pressing, e.g. "mousemove"). [0, 1, 2] means that a mouse event caused by pressing any of those buttons will trigger object picking (useful for filtering out unwanted actions, e.g. usually clicking with the middle/right mouse buttons). |