Skip to content

Commit e7aa3ce

Browse files
committed
Add class description for annotation script
1 parent 863d027 commit e7aa3ce

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

examples/assets/scripts/annotation.mjs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1-
import { CULLFACE_NONE, FILTER_LINEAR, PIXELFORMAT_RGBA8, BlendState, Color, Entity, Layer, Mesh, MeshInstance, PlaneGeometry, Script, StandardMaterial, Texture } from 'playcanvas';
1+
import {
2+
CULLFACE_NONE,
3+
FILTER_LINEAR,
4+
PIXELFORMAT_RGBA8,
5+
BlendState,
6+
Color,
7+
Entity,
8+
Layer,
9+
Mesh,
10+
MeshInstance,
11+
PlaneGeometry,
12+
Script,
13+
StandardMaterial,
14+
Texture
15+
} from 'playcanvas';
216

317
/** @import { Application, CameraComponent } from 'playcanvas' */
418

5-
/** @type {HTMLDivElement | null} */
19+
/**
20+
* A script for creating interactive 3D annotations in a scene. Each annotation consists of:
21+
*
22+
* - A 3D hotspot that maintains constant screen-space size. The hotspot is rendered with muted
23+
* appearance when obstructed by geometry but is still clickable. The hotspot relies on an
24+
* invisible DOM element that matches the hotspot's size and position to detect clicks.
25+
* - An annotation panel that shows title and description text.
26+
*/
627
export class Annotation extends Script {
728
/** @type {HTMLDivElement | null} */
829
static _activeTooltip = null;
@@ -299,7 +320,7 @@ export class Annotation extends Script {
299320
}, 200); // Match the transition duration
300321
}
301322

302-
update() {
323+
update(dt) {
303324
if (!this.camera) return;
304325

305326
// Convert world position to screen space

0 commit comments

Comments
 (0)