babylonjs-addons 7.32.4 → 7.34.0
Sign up to get free protection for your applications and to get access to all the features.
- package/babylonjs.addons.d.ts +281 -1
- package/babylonjs.addons.js +1839 -8
- package/babylonjs.addons.min.js +1 -1
- package/babylonjs.addons.min.js.map +1 -1
- package/babylonjs.addons.module.d.ts +585 -2
- package/package.json +2 -2
@@ -1,6 +1,309 @@
|
|
1
1
|
|
2
2
|
declare module "babylonjs-addons/index" {
|
3
|
-
export
|
3
|
+
export * from "babylonjs-addons/htmlMesh";
|
4
|
+
|
5
|
+
}
|
6
|
+
declare module "babylonjs-addons/htmlMesh/pointerEventsCaptureBehavior" {
|
7
|
+
import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
|
8
|
+
import { Behavior } from "babylonjs/Behaviors/behavior";
|
9
|
+
/**
|
10
|
+
* Behavior for any content that can capture pointer events, i.e. bypass the Babylon pointer event handling
|
11
|
+
* and receive pointer events directly. It will register the capture triggers and negotiate the capture and
|
12
|
+
* release of pointer events. Curerntly this applies only to HtmlMesh
|
13
|
+
*/
|
14
|
+
export class PointerEventsCaptureBehavior implements Behavior<AbstractMesh> {
|
15
|
+
private _captureCallback;
|
16
|
+
private _releaseCallback;
|
17
|
+
/** gets or sets behavior's name */
|
18
|
+
name: string;
|
19
|
+
private _attachedMesh;
|
20
|
+
/** @internal */
|
21
|
+
_captureOnPointerEnter: boolean;
|
22
|
+
/**
|
23
|
+
* Gets or sets the mesh that the behavior is attached to
|
24
|
+
*/
|
25
|
+
get attachedMesh(): AbstractMesh | null;
|
26
|
+
set attachedMesh(value: AbstractMesh | null);
|
27
|
+
constructor(_captureCallback: () => void, _releaseCallback: () => void, { captureOnPointerEnter }?: {
|
28
|
+
captureOnPointerEnter?: boolean | undefined;
|
29
|
+
});
|
30
|
+
/**
|
31
|
+
* Set if the behavior should capture pointer events when the pointer enters the mesh
|
32
|
+
*/
|
33
|
+
set captureOnPointerEnter(captureOnPointerEnter: boolean);
|
34
|
+
/**
|
35
|
+
* Function called when the behavior needs to be initialized (before attaching it to a target)
|
36
|
+
*/
|
37
|
+
init(): void;
|
38
|
+
/**
|
39
|
+
* Called when the behavior is attached to a target
|
40
|
+
* @param mesh defines the target where the behavior is attached to
|
41
|
+
*/
|
42
|
+
attach(mesh: AbstractMesh): void;
|
43
|
+
/**
|
44
|
+
* Called when the behavior is detached from its target
|
45
|
+
*/
|
46
|
+
detach(): void;
|
47
|
+
/**
|
48
|
+
* Dispose the behavior
|
49
|
+
*/
|
50
|
+
dispose(): void;
|
51
|
+
releasePointerEvents(): void;
|
52
|
+
capturePointerEvents(): void;
|
53
|
+
}
|
54
|
+
|
55
|
+
}
|
56
|
+
declare module "babylonjs-addons/htmlMesh/pointerEventsCapture" {
|
57
|
+
type CaptureReleaseCallback = () => void;
|
58
|
+
/**
|
59
|
+
* Get the id of the object currently capturing pointer events
|
60
|
+
* @returns The id of the object currently capturing pointer events
|
61
|
+
* or null if no object is capturing pointer events
|
62
|
+
*/
|
63
|
+
export const getCapturingId: () => string | null;
|
64
|
+
/**
|
65
|
+
* Request that the object with the given id capture pointer events. If there is no current
|
66
|
+
* owner, then the request is granted immediately. If there is a current owner, then the request
|
67
|
+
* is queued until the current owner releases pointer events.
|
68
|
+
* @param requestId An id to identify the request. This id will be used to match the capture
|
69
|
+
* request with the release request.
|
70
|
+
* @param captureCallback The callback to call when the request is granted and the object is capturing
|
71
|
+
* @param releaseCallback The callback to call when the object is no longer capturing pointer events
|
72
|
+
*/
|
73
|
+
export const requestCapture: (requestId: string, captureCallback: CaptureReleaseCallback, releaseCallback: CaptureReleaseCallback) => void;
|
74
|
+
/**
|
75
|
+
* Release pointer events from the object with the given id. If the object is the current owner
|
76
|
+
* then pointer events are released immediately. If the object is not the current owner, then the
|
77
|
+
* associated capture request is removed from the queue. If there is no matching capture request
|
78
|
+
* in the queue, then the release request is added to a list of unmatched release requests and will
|
79
|
+
* negate the next capture request with the same id. This is to guard against the possibility that
|
80
|
+
* the release request arrived before the capture request.
|
81
|
+
* @param requestId The id which should match the id of the capture request
|
82
|
+
*/
|
83
|
+
export const requestRelease: (requestId: string | null) => void;
|
84
|
+
/**
|
85
|
+
* Relase pointer events from the current owner
|
86
|
+
*/
|
87
|
+
export const releaseCurrent: () => void;
|
88
|
+
global {
|
89
|
+
interface Window {
|
90
|
+
"pointer-events-capture-debug": boolean | null;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
export {};
|
94
|
+
|
95
|
+
}
|
96
|
+
declare module "babylonjs-addons/htmlMesh/index" {
|
97
|
+
import { HtmlMeshRenderer } from "babylonjs-addons/htmlMesh/htmlMeshRenderer";
|
98
|
+
import { HtmlMesh } from "babylonjs-addons/htmlMesh/htmlMesh";
|
99
|
+
import { PointerEventsCaptureBehavior } from "babylonjs-addons/htmlMesh/pointerEventsCaptureBehavior";
|
100
|
+
import { FitStrategy } from "babylonjs-addons/htmlMesh/fitStrategy";
|
101
|
+
export { HtmlMeshRenderer, HtmlMesh, PointerEventsCaptureBehavior, FitStrategy };
|
102
|
+
|
103
|
+
}
|
104
|
+
declare module "babylonjs-addons/htmlMesh/htmlMeshRenderer" {
|
105
|
+
import { Scene } from "babylonjs/scene";
|
106
|
+
import { Matrix } from "babylonjs/Maths/math";
|
107
|
+
import { HtmlMesh } from "babylonjs-addons/htmlMesh/htmlMesh";
|
108
|
+
import { Camera } from "babylonjs/Cameras/camera";
|
109
|
+
import { SubMesh } from "babylonjs/Meshes/subMesh";
|
110
|
+
/**
|
111
|
+
* A function that compares two submeshes and returns a number indicating which
|
112
|
+
* should be rendered first.
|
113
|
+
*/
|
114
|
+
type RenderOrderFunction = (subMeshA: SubMesh, subMeshB: SubMesh) => number;
|
115
|
+
/**
|
116
|
+
* An instance of this is required to render HtmlMeshes in the scene.
|
117
|
+
* if using HtmlMeshes, you must not set render order for group 0 using
|
118
|
+
* scene.setRenderingOrder. You must instead pass the compare functions
|
119
|
+
* to the HtmlMeshRenderer constructor. If you do not, then your render
|
120
|
+
* order will be overwritten if the HtmlMeshRenderer is created after and
|
121
|
+
* the HtmlMeshes will not render correctly (they will appear in front of
|
122
|
+
* meshes that are actually in front of them) if the HtmlMeshRenderer is
|
123
|
+
* created before.
|
124
|
+
*/
|
125
|
+
export class HtmlMeshRenderer {
|
126
|
+
private _containerId?;
|
127
|
+
private _inSceneElements?;
|
128
|
+
private _overlayElements?;
|
129
|
+
private _engine;
|
130
|
+
private _cache;
|
131
|
+
private _width;
|
132
|
+
private _height;
|
133
|
+
private _heightHalf;
|
134
|
+
private _cameraWorldMatrix?;
|
135
|
+
private _temp;
|
136
|
+
private _lastDevicePixelRatio;
|
137
|
+
private _cameraMatrixUpdated;
|
138
|
+
private _previousCanvasDocumentPosition;
|
139
|
+
private _renderObserver;
|
140
|
+
/**
|
141
|
+
* Contruct an instance of HtmlMeshRenderer
|
142
|
+
* @param scene
|
143
|
+
* @param options object containing the following optional properties:
|
144
|
+
* @returns
|
145
|
+
*/
|
146
|
+
constructor(scene: Scene, { parentContainerId, _containerId, enableOverlayRender, defaultOpaqueRenderOrder, defaultAlphaTestRenderOrder, defaultTransparentRenderOrder, }?: {
|
147
|
+
parentContainerId?: string | null;
|
148
|
+
_containerId?: string;
|
149
|
+
defaultOpaqueRenderOrder?: RenderOrderFunction;
|
150
|
+
defaultAlphaTestRenderOrder?: RenderOrderFunction;
|
151
|
+
defaultTransparentRenderOrder?: RenderOrderFunction;
|
152
|
+
enableOverlayRender?: boolean;
|
153
|
+
});
|
154
|
+
/**
|
155
|
+
* Dispose of the HtmlMeshRenderer
|
156
|
+
*/
|
157
|
+
dispose(): void;
|
158
|
+
protected _init(scene: Scene, parentContainerId: string | null, enableOverlayRender: boolean, defaultOpaqueRenderOrder: RenderOrderFunction, defaultAlphaTestRenderOrder: RenderOrderFunction, defaultTransparentRenderOrder: RenderOrderFunction): void;
|
159
|
+
private _createRenderLayerElements;
|
160
|
+
protected _getSize(): {
|
161
|
+
width: number;
|
162
|
+
height: number;
|
163
|
+
};
|
164
|
+
protected _setSize(width: number, height: number): void;
|
165
|
+
protected _getCameraCSSMatrix(matrix: Matrix): string;
|
166
|
+
protected _getHtmlContentCSSMatrix(matrix: Matrix, useRightHandedSystem: boolean): string;
|
167
|
+
protected _getTransformationMatrix(htmlMesh: HtmlMesh, useRightHandedSystem: boolean): Matrix;
|
168
|
+
protected _renderHtmlMesh(htmlMesh: HtmlMesh, useRightHandedSystem: boolean): void;
|
169
|
+
protected _render(scene: Scene, camera: Camera): void;
|
170
|
+
protected _updateBaseScaleFactor(htmlMesh: HtmlMesh): void;
|
171
|
+
protected _updateContainerPositionIfNeeded(): void;
|
172
|
+
protected _onCameraMatrixChanged: (camera: Camera) => void;
|
173
|
+
private _epsilon;
|
174
|
+
private _getAncestorMarginsAndPadding;
|
175
|
+
}
|
176
|
+
export {};
|
177
|
+
|
178
|
+
}
|
179
|
+
declare module "babylonjs-addons/htmlMesh/htmlMesh" {
|
180
|
+
import { Mesh } from "babylonjs/Meshes/mesh";
|
181
|
+
import { Scene } from "babylonjs/scene";
|
182
|
+
import { FitStrategyType } from "babylonjs-addons/htmlMesh/fitStrategy";
|
183
|
+
/**
|
184
|
+
* This class represents HTML content that we want to render as though it is part of the scene. The HTML content is actually
|
185
|
+
* rendered below the canvas, but a depth mask is created by this class that writes to the depth buffer but does not
|
186
|
+
* write to the color buffer, effectively punching a hole in the canvas. CSS transforms are used to scale, translate, and rotate
|
187
|
+
* the HTML content so that it matches the camera and mesh orientation. The class supports interactions in editable and non-editable mode.
|
188
|
+
* In non-editable mode (the default), events are passed to the HTML content when the pointer is over the mask (and not occluded by other meshes
|
189
|
+
* in the scene).
|
190
|
+
* #HVHYJC#5
|
191
|
+
* #B17TC7#112
|
192
|
+
*/
|
193
|
+
export class HtmlMesh extends Mesh {
|
194
|
+
/**
|
195
|
+
* Helps identifying a html mesh from a regular mesh
|
196
|
+
*/
|
197
|
+
get isHtmlMesh(): boolean;
|
198
|
+
private _enabled;
|
199
|
+
private _ready;
|
200
|
+
/**
|
201
|
+
* @internal
|
202
|
+
*/
|
203
|
+
_isCanvasOverlay: boolean;
|
204
|
+
private _requiresUpdate;
|
205
|
+
private _element?;
|
206
|
+
private _width?;
|
207
|
+
private _height?;
|
208
|
+
private _inverseScaleMatrix;
|
209
|
+
private _captureOnPointerEnter;
|
210
|
+
private _pointerEventCaptureBehavior;
|
211
|
+
private _sourceWidth;
|
212
|
+
private _sourceHeight;
|
213
|
+
/**
|
214
|
+
* Return the source width of the content in pixels
|
215
|
+
*/
|
216
|
+
get sourceWidth(): number | null;
|
217
|
+
/**
|
218
|
+
* Return the source height of the content in pixels
|
219
|
+
*/
|
220
|
+
get sourceHeight(): number | null;
|
221
|
+
private _worldMatrixUpdateObserver;
|
222
|
+
private _fitStrategy;
|
223
|
+
/**
|
224
|
+
* Contruct an instance of HtmlMesh
|
225
|
+
* @param scene
|
226
|
+
* @param id The id of the mesh. Will be used as the id of the HTML element as well.
|
227
|
+
* @param options object with optional parameters
|
228
|
+
*/
|
229
|
+
constructor(scene: Scene, id: string, { captureOnPointerEnter, isCanvasOverlay, fitStrategy }?: {
|
230
|
+
captureOnPointerEnter?: boolean | undefined;
|
231
|
+
isCanvasOverlay?: boolean | undefined;
|
232
|
+
fitStrategy?: FitStrategyType | undefined;
|
233
|
+
});
|
234
|
+
/**
|
235
|
+
* The width of the content in pixels
|
236
|
+
*/
|
237
|
+
get width(): number | undefined;
|
238
|
+
/**
|
239
|
+
* The height of the content in pixels
|
240
|
+
*/
|
241
|
+
get height(): number | undefined;
|
242
|
+
/**
|
243
|
+
* The HTML element that is being rendered as a mesh
|
244
|
+
*/
|
245
|
+
get element(): HTMLElement | undefined;
|
246
|
+
/**
|
247
|
+
* True if the mesh has been moved, rotated, or scaled since the last time this
|
248
|
+
* property was read. This property is reset to false after reading.
|
249
|
+
*/
|
250
|
+
get requiresUpdate(): boolean;
|
251
|
+
/**
|
252
|
+
* Enable capture for the pointer when entering the mesh area
|
253
|
+
*/
|
254
|
+
set captureOnPointerEnter(captureOnPointerEnter: boolean);
|
255
|
+
/**
|
256
|
+
* Disposes of the mesh and the HTML element
|
257
|
+
*/
|
258
|
+
dispose(): void;
|
259
|
+
/**
|
260
|
+
* @internal
|
261
|
+
*/
|
262
|
+
_markAsUpdated(): void;
|
263
|
+
/**
|
264
|
+
* Sets the content of the element to the specified content adjusting the mesh scale to match and making it visible.
|
265
|
+
* If the the specified content is undefined, then it will make the mesh invisible. In either case it will clear the
|
266
|
+
* element content first.
|
267
|
+
* @param element The element to render as a mesh
|
268
|
+
* @param width The width of the mesh in Babylon units
|
269
|
+
* @param height The height of the mesh in Babylon units
|
270
|
+
*/
|
271
|
+
setContent(element: HTMLElement, width: number, height: number): void;
|
272
|
+
setEnabled(enabled: boolean): void;
|
273
|
+
/**
|
274
|
+
* Sets the content size in pixels
|
275
|
+
* @param width width of the source
|
276
|
+
* @param height height of the source
|
277
|
+
*/
|
278
|
+
setContentSizePx(width: number, height: number): void;
|
279
|
+
protected _setAsReady(ready: boolean): void;
|
280
|
+
protected _doSetEnabled(enabled: boolean): void;
|
281
|
+
protected _updateScaleIfNecessary(): void;
|
282
|
+
protected _createMask(): void;
|
283
|
+
protected _setElementZIndex(zIndex: number): void;
|
284
|
+
/**
|
285
|
+
* Callback used by the PointerEventsCaptureBehavior to capture pointer events
|
286
|
+
*/
|
287
|
+
capturePointerEvents(): void;
|
288
|
+
/**
|
289
|
+
* Callback used by the PointerEventsCaptureBehavior to release pointer events
|
290
|
+
*/
|
291
|
+
releasePointerEvents(): void;
|
292
|
+
protected _createElement(): HTMLDivElement | undefined;
|
293
|
+
}
|
294
|
+
|
295
|
+
}
|
296
|
+
declare module "babylonjs-addons/htmlMesh/fitStrategy" {
|
297
|
+
export type FitStrategyType = {
|
298
|
+
wrapElement(element: HTMLElement): HTMLElement;
|
299
|
+
updateSize(sizingElement: HTMLElement, width: number, height: number): void;
|
300
|
+
};
|
301
|
+
export const FitStrategy: {
|
302
|
+
CONTAIN: FitStrategyType;
|
303
|
+
COVER: FitStrategyType;
|
304
|
+
STRETCH: FitStrategyType;
|
305
|
+
NONE: FitStrategyType;
|
306
|
+
};
|
4
307
|
|
5
308
|
}
|
6
309
|
|
@@ -10,7 +313,287 @@ declare module "babylonjs-addons" {
|
|
10
313
|
|
11
314
|
|
12
315
|
declare module ADDONS {
|
13
|
-
|
316
|
+
|
317
|
+
|
318
|
+
/**
|
319
|
+
* BABYLON.Behavior for any content that can capture pointer events, i.e. bypass the Babylon pointer event handling
|
320
|
+
* and receive pointer events directly. It will register the capture triggers and negotiate the capture and
|
321
|
+
* release of pointer events. Curerntly this applies only to HtmlMesh
|
322
|
+
*/
|
323
|
+
export class PointerEventsCaptureBehavior implements BABYLON.Behavior<BABYLON.AbstractMesh> {
|
324
|
+
private _captureCallback;
|
325
|
+
private _releaseCallback;
|
326
|
+
/** gets or sets behavior's name */
|
327
|
+
name: string;
|
328
|
+
private _attachedMesh;
|
329
|
+
/** @internal */
|
330
|
+
_captureOnPointerEnter: boolean;
|
331
|
+
/**
|
332
|
+
* Gets or sets the mesh that the behavior is attached to
|
333
|
+
*/
|
334
|
+
get attachedMesh(): BABYLON.AbstractMesh | null;
|
335
|
+
set attachedMesh(value: BABYLON.AbstractMesh | null);
|
336
|
+
constructor(_captureCallback: () => void, _releaseCallback: () => void, { captureOnPointerEnter }?: {
|
337
|
+
captureOnPointerEnter?: boolean | undefined;
|
338
|
+
});
|
339
|
+
/**
|
340
|
+
* Set if the behavior should capture pointer events when the pointer enters the mesh
|
341
|
+
*/
|
342
|
+
set captureOnPointerEnter(captureOnPointerEnter: boolean);
|
343
|
+
/**
|
344
|
+
* Function called when the behavior needs to be initialized (before attaching it to a target)
|
345
|
+
*/
|
346
|
+
init(): void;
|
347
|
+
/**
|
348
|
+
* Called when the behavior is attached to a target
|
349
|
+
* @param mesh defines the target where the behavior is attached to
|
350
|
+
*/
|
351
|
+
attach(mesh: BABYLON.AbstractMesh): void;
|
352
|
+
/**
|
353
|
+
* Called when the behavior is detached from its target
|
354
|
+
*/
|
355
|
+
detach(): void;
|
356
|
+
/**
|
357
|
+
* Dispose the behavior
|
358
|
+
*/
|
359
|
+
dispose(): void;
|
360
|
+
releasePointerEvents(): void;
|
361
|
+
capturePointerEvents(): void;
|
362
|
+
}
|
363
|
+
|
364
|
+
|
365
|
+
type CaptureReleaseCallback = () => void;
|
366
|
+
/**
|
367
|
+
* Get the id of the object currently capturing pointer events
|
368
|
+
* @returns The id of the object currently capturing pointer events
|
369
|
+
* or null if no object is capturing pointer events
|
370
|
+
*/
|
371
|
+
export const getCapturingId: () => string | null;
|
372
|
+
/**
|
373
|
+
* Request that the object with the given id capture pointer events. If there is no current
|
374
|
+
* owner, then the request is granted immediately. If there is a current owner, then the request
|
375
|
+
* is queued until the current owner releases pointer events.
|
376
|
+
* @param requestId An id to identify the request. This id will be used to match the capture
|
377
|
+
* request with the release request.
|
378
|
+
* @param captureCallback The callback to call when the request is granted and the object is capturing
|
379
|
+
* @param releaseCallback The callback to call when the object is no longer capturing pointer events
|
380
|
+
*/
|
381
|
+
export const requestCapture: (requestId: string, captureCallback: CaptureReleaseCallback, releaseCallback: CaptureReleaseCallback) => void;
|
382
|
+
/**
|
383
|
+
* Release pointer events from the object with the given id. If the object is the current owner
|
384
|
+
* then pointer events are released immediately. If the object is not the current owner, then the
|
385
|
+
* associated capture request is removed from the queue. If there is no matching capture request
|
386
|
+
* in the queue, then the release request is added to a list of unmatched release requests and will
|
387
|
+
* negate the next capture request with the same id. This is to guard against the possibility that
|
388
|
+
* the release request arrived before the capture request.
|
389
|
+
* @param requestId The id which should match the id of the capture request
|
390
|
+
*/
|
391
|
+
export const requestRelease: (requestId: string | null) => void;
|
392
|
+
/**
|
393
|
+
* Relase pointer events from the current owner
|
394
|
+
*/
|
395
|
+
export const releaseCurrent: () => void;
|
396
|
+
}
|
397
|
+
|
398
|
+
interface Window {
|
399
|
+
"pointer-events-capture-debug": boolean | null;
|
400
|
+
}
|
401
|
+
declare module ADDONS {
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
/**
|
407
|
+
* A function that compares two submeshes and returns a number indicating which
|
408
|
+
* should be rendered first.
|
409
|
+
*/
|
410
|
+
type RenderOrderFunction = (subMeshA: BABYLON.SubMesh, subMeshB: BABYLON.SubMesh) => number;
|
411
|
+
/**
|
412
|
+
* An instance of this is required to render HtmlMeshes in the scene.
|
413
|
+
* if using HtmlMeshes, you must not set render order for group 0 using
|
414
|
+
* scene.setRenderingOrder. You must instead pass the compare functions
|
415
|
+
* to the HtmlMeshRenderer constructor. If you do not, then your render
|
416
|
+
* order will be overwritten if the HtmlMeshRenderer is created after and
|
417
|
+
* the HtmlMeshes will not render correctly (they will appear in front of
|
418
|
+
* meshes that are actually in front of them) if the HtmlMeshRenderer is
|
419
|
+
* created before.
|
420
|
+
*/
|
421
|
+
export class HtmlMeshRenderer {
|
422
|
+
private _containerId?;
|
423
|
+
private _inSceneElements?;
|
424
|
+
private _overlayElements?;
|
425
|
+
private _engine;
|
426
|
+
private _cache;
|
427
|
+
private _width;
|
428
|
+
private _height;
|
429
|
+
private _heightHalf;
|
430
|
+
private _cameraWorldMatrix?;
|
431
|
+
private _temp;
|
432
|
+
private _lastDevicePixelRatio;
|
433
|
+
private _cameraMatrixUpdated;
|
434
|
+
private _previousCanvasDocumentPosition;
|
435
|
+
private _renderObserver;
|
436
|
+
/**
|
437
|
+
* Contruct an instance of HtmlMeshRenderer
|
438
|
+
* @param scene
|
439
|
+
* @param options object containing the following optional properties:
|
440
|
+
* @returns
|
441
|
+
*/
|
442
|
+
constructor(scene: BABYLON.Scene, { parentContainerId, _containerId, enableOverlayRender, defaultOpaqueRenderOrder, defaultAlphaTestRenderOrder, defaultTransparentRenderOrder, }?: {
|
443
|
+
parentContainerId?: string | null;
|
444
|
+
_containerId?: string;
|
445
|
+
defaultOpaqueRenderOrder?: RenderOrderFunction;
|
446
|
+
defaultAlphaTestRenderOrder?: RenderOrderFunction;
|
447
|
+
defaultTransparentRenderOrder?: RenderOrderFunction;
|
448
|
+
enableOverlayRender?: boolean;
|
449
|
+
});
|
450
|
+
/**
|
451
|
+
* Dispose of the HtmlMeshRenderer
|
452
|
+
*/
|
453
|
+
dispose(): void;
|
454
|
+
protected _init(scene: BABYLON.Scene, parentContainerId: string | null, enableOverlayRender: boolean, defaultOpaqueRenderOrder: RenderOrderFunction, defaultAlphaTestRenderOrder: RenderOrderFunction, defaultTransparentRenderOrder: RenderOrderFunction): void;
|
455
|
+
private _createRenderLayerElements;
|
456
|
+
protected _getSize(): {
|
457
|
+
width: number;
|
458
|
+
height: number;
|
459
|
+
};
|
460
|
+
protected _setSize(width: number, height: number): void;
|
461
|
+
protected _getCameraCSSMatrix(matrix: BABYLON.Matrix): string;
|
462
|
+
protected _getHtmlContentCSSMatrix(matrix: BABYLON.Matrix, useRightHandedSystem: boolean): string;
|
463
|
+
protected _getTransformationMatrix(htmlMesh: HtmlMesh, useRightHandedSystem: boolean): BABYLON.Matrix;
|
464
|
+
protected _renderHtmlMesh(htmlMesh: HtmlMesh, useRightHandedSystem: boolean): void;
|
465
|
+
protected _render(scene: BABYLON.Scene, camera: BABYLON.Camera): void;
|
466
|
+
protected _updateBaseScaleFactor(htmlMesh: HtmlMesh): void;
|
467
|
+
protected _updateContainerPositionIfNeeded(): void;
|
468
|
+
protected _onCameraMatrixChanged: (camera: BABYLON.Camera) => void;
|
469
|
+
private _epsilon;
|
470
|
+
private _getAncestorMarginsAndPadding;
|
471
|
+
}
|
472
|
+
|
473
|
+
|
474
|
+
/**
|
475
|
+
* This class represents HTML content that we want to render as though it is part of the scene. The HTML content is actually
|
476
|
+
* rendered below the canvas, but a depth mask is created by this class that writes to the depth buffer but does not
|
477
|
+
* write to the color buffer, effectively punching a hole in the canvas. CSS transforms are used to scale, translate, and rotate
|
478
|
+
* the HTML content so that it matches the camera and mesh orientation. The class supports interactions in editable and non-editable mode.
|
479
|
+
* In non-editable mode (the default), events are passed to the HTML content when the pointer is over the mask (and not occluded by other meshes
|
480
|
+
* in the scene).
|
481
|
+
* #HVHYJC#5
|
482
|
+
* #B17TC7#112
|
483
|
+
*/
|
484
|
+
export class HtmlMesh extends BABYLON.Mesh {
|
485
|
+
/**
|
486
|
+
* Helps identifying a html mesh from a regular mesh
|
487
|
+
*/
|
488
|
+
get isHtmlMesh(): boolean;
|
489
|
+
private _enabled;
|
490
|
+
private _ready;
|
491
|
+
/**
|
492
|
+
* @internal
|
493
|
+
*/
|
494
|
+
_isCanvasOverlay: boolean;
|
495
|
+
private _requiresUpdate;
|
496
|
+
private _element?;
|
497
|
+
private _width?;
|
498
|
+
private _height?;
|
499
|
+
private _inverseScaleMatrix;
|
500
|
+
private _captureOnPointerEnter;
|
501
|
+
private _pointerEventCaptureBehavior;
|
502
|
+
private _sourceWidth;
|
503
|
+
private _sourceHeight;
|
504
|
+
/**
|
505
|
+
* Return the source width of the content in pixels
|
506
|
+
*/
|
507
|
+
get sourceWidth(): number | null;
|
508
|
+
/**
|
509
|
+
* Return the source height of the content in pixels
|
510
|
+
*/
|
511
|
+
get sourceHeight(): number | null;
|
512
|
+
private _worldMatrixUpdateObserver;
|
513
|
+
private _fitStrategy;
|
514
|
+
/**
|
515
|
+
* Contruct an instance of HtmlMesh
|
516
|
+
* @param scene
|
517
|
+
* @param id The id of the mesh. Will be used as the id of the HTML element as well.
|
518
|
+
* @param options object with optional parameters
|
519
|
+
*/
|
520
|
+
constructor(scene: BABYLON.Scene, id: string, { captureOnPointerEnter, isCanvasOverlay, fitStrategy }?: {
|
521
|
+
captureOnPointerEnter?: boolean | undefined;
|
522
|
+
isCanvasOverlay?: boolean | undefined;
|
523
|
+
fitStrategy?: FitStrategyType | undefined;
|
524
|
+
});
|
525
|
+
/**
|
526
|
+
* The width of the content in pixels
|
527
|
+
*/
|
528
|
+
get width(): number | undefined;
|
529
|
+
/**
|
530
|
+
* The height of the content in pixels
|
531
|
+
*/
|
532
|
+
get height(): number | undefined;
|
533
|
+
/**
|
534
|
+
* The HTML element that is being rendered as a mesh
|
535
|
+
*/
|
536
|
+
get element(): HTMLElement | undefined;
|
537
|
+
/**
|
538
|
+
* True if the mesh has been moved, rotated, or scaled since the last time this
|
539
|
+
* property was read. This property is reset to false after reading.
|
540
|
+
*/
|
541
|
+
get requiresUpdate(): boolean;
|
542
|
+
/**
|
543
|
+
* Enable capture for the pointer when entering the mesh area
|
544
|
+
*/
|
545
|
+
set captureOnPointerEnter(captureOnPointerEnter: boolean);
|
546
|
+
/**
|
547
|
+
* Disposes of the mesh and the HTML element
|
548
|
+
*/
|
549
|
+
dispose(): void;
|
550
|
+
/**
|
551
|
+
* @internal
|
552
|
+
*/
|
553
|
+
_markAsUpdated(): void;
|
554
|
+
/**
|
555
|
+
* Sets the content of the element to the specified content adjusting the mesh scale to match and making it visible.
|
556
|
+
* If the the specified content is undefined, then it will make the mesh invisible. In either case it will clear the
|
557
|
+
* element content first.
|
558
|
+
* @param element The element to render as a mesh
|
559
|
+
* @param width The width of the mesh in Babylon units
|
560
|
+
* @param height The height of the mesh in Babylon units
|
561
|
+
*/
|
562
|
+
setContent(element: HTMLElement, width: number, height: number): void;
|
563
|
+
setEnabled(enabled: boolean): void;
|
564
|
+
/**
|
565
|
+
* Sets the content size in pixels
|
566
|
+
* @param width width of the source
|
567
|
+
* @param height height of the source
|
568
|
+
*/
|
569
|
+
setContentSizePx(width: number, height: number): void;
|
570
|
+
protected _setAsReady(ready: boolean): void;
|
571
|
+
protected _doSetEnabled(enabled: boolean): void;
|
572
|
+
protected _updateScaleIfNecessary(): void;
|
573
|
+
protected _createMask(): void;
|
574
|
+
protected _setElementZIndex(zIndex: number): void;
|
575
|
+
/**
|
576
|
+
* Callback used by the PointerEventsCaptureBehavior to capture pointer events
|
577
|
+
*/
|
578
|
+
capturePointerEvents(): void;
|
579
|
+
/**
|
580
|
+
* Callback used by the PointerEventsCaptureBehavior to release pointer events
|
581
|
+
*/
|
582
|
+
releasePointerEvents(): void;
|
583
|
+
protected _createElement(): HTMLDivElement | undefined;
|
584
|
+
}
|
585
|
+
|
586
|
+
|
587
|
+
export type FitStrategyType = {
|
588
|
+
wrapElement(element: HTMLElement): HTMLElement;
|
589
|
+
updateSize(sizingElement: HTMLElement, width: number, height: number): void;
|
590
|
+
};
|
591
|
+
export var FitStrategy: {
|
592
|
+
CONTAIN: FitStrategyType;
|
593
|
+
COVER: FitStrategyType;
|
594
|
+
STRETCH: FitStrategyType;
|
595
|
+
NONE: FitStrategyType;
|
596
|
+
};
|
14
597
|
|
15
598
|
|
16
599
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "babylonjs-addons",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.34.0",
|
4
4
|
"main": "babylonjs.addons.js",
|
5
5
|
"types": "babylonjs.addons.module.d.ts",
|
6
6
|
"files": [
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"test:escheck": "es-check es6 ./babylonjs.addons.js"
|
16
16
|
},
|
17
17
|
"dependencies": {
|
18
|
-
"babylonjs": "^7.
|
18
|
+
"babylonjs": "^7.34.0"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
21
|
"@dev/build-tools": "1.0.0",
|