@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
33 lines (31 loc) • 952 B
text/typescript
import { Behaviour } from "./Component.js";
/**
* UsageMarker indicates an object is currently being interacted with.
* Components like {@link DragControls} add this to prevent accidental deletion
* by {@link DeleteBox} while the user is dragging.
*
* @example Check if object is in use
* ```ts
* const marker = object.getComponent(UsageMarker);
* if (marker?.isUsed) {
* console.log("Object is being used by:", marker.usedBy);
* }
* ```
*
* @summary Marks object as currently being interacted with
* @category Interactivity
* @group Components
* @see {@link DeleteBox} respects this marker
* @see {@link DragControls} adds this during drag
*/
export class UsageMarker extends Behaviour
{
public isUsed: boolean = true;
public usedBy: any = null;
}
/**
* An empty component that can be used to mark an object as interactable.
* @group Components
*/
/** @deprecated */
export class Interactable extends Behaviour {}