pickFromEvent

Given an event, return all intersected items from the given clientX and clientY coordinates. By default, it returns all intersected points, but you can turn off recursive mode to return only the first intersected item.

Source:
Example
const event = { clientX: 500, clientY: 500 }; // sample event

$$$.pickFromEvent(event); // returns an array of intersected points

// a useful debugging tool of using events and picking to grab intersected items
window.addEventListener('mousemove', (event) => {
  console.log($$$.pickFromEvent(event)); // logs all intersected items on `mousemove`
});
Parameters:
Name Type Attributes Default Description
event object

A mouse event that is used for picking.

Properties
Name Type Description
clientX object

The screen space x-coordinate.

clientY object

The screen space y-coordinate.

debug boolean <optional>
false

Allows to turn on the cusrsor visuals.

recursive boolean <optional>
true

Whether to intersect all intersected items.

Returns:
  • An array of intersected items.
Type
Array.<object>