@mml-io/mml-web-playcanvas-standalone 0.19.7 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,6 +9,7 @@ export declare enum StandalonePlayCanvasAdapterControlsType {
|
|
|
9
9
|
}
|
|
10
10
|
export type StandalonePlayCanvasAdapterOptions = {
|
|
11
11
|
controlsType?: StandalonePlayCanvasAdapterControlsType;
|
|
12
|
+
autoConnectRoot?: boolean;
|
|
12
13
|
};
|
|
13
14
|
export declare class StandalonePlayCanvasAdapter implements PlayCanvasGraphicsAdapter, StandaloneGraphicsAdapter {
|
|
14
15
|
private element;
|
|
@@ -19,6 +20,7 @@ export declare class StandalonePlayCanvasAdapter implements PlayCanvasGraphicsAd
|
|
|
19
20
|
controls: PlayCanvasControls | null;
|
|
20
21
|
private camera;
|
|
21
22
|
private canvas;
|
|
23
|
+
private contentRoot;
|
|
22
24
|
private clickTrigger;
|
|
23
25
|
private constructor();
|
|
24
26
|
getPlayCanvasApp(): playcanvas.AppBase;
|
|
@@ -44,6 +46,8 @@ export declare class StandalonePlayCanvasAdapter implements PlayCanvasGraphicsAd
|
|
|
44
46
|
};
|
|
45
47
|
resize(width: number, height: number): void;
|
|
46
48
|
dispose(): void;
|
|
49
|
+
disconnectRoot(): void;
|
|
50
|
+
connectRoot(): void;
|
|
47
51
|
getRootContainer(): playcanvas.Entity;
|
|
48
52
|
getBoundingBoxForElement(element: HTMLElement): {
|
|
49
53
|
x: number;
|
package/build/index.js
CHANGED
|
@@ -472,7 +472,11 @@ var StandalonePlayCanvasAdapter = class _StandalonePlayCanvasAdapter {
|
|
|
472
472
|
clearColor: new playcanvas.Color(1, 1, 1, 1)
|
|
473
473
|
});
|
|
474
474
|
this.camera.setPosition(0, 5, 10);
|
|
475
|
-
this.
|
|
475
|
+
this.contentRoot = new playcanvas.Entity("contentRoot", this.playcanvasApp);
|
|
476
|
+
this.contentRoot.addChild(this.camera);
|
|
477
|
+
if (this.options.autoConnectRoot === void 0 || this.options.autoConnectRoot) {
|
|
478
|
+
this.playcanvasApp.root.addChild(this.contentRoot);
|
|
479
|
+
}
|
|
476
480
|
this.setControlsType(this.options.controlsType);
|
|
477
481
|
this.clickTrigger = PlayCanvasClickTrigger.init(this.playcanvasApp, this.element, this.camera);
|
|
478
482
|
this.playcanvasApp.on("update", (delta) => {
|
|
@@ -543,8 +547,18 @@ var StandalonePlayCanvasAdapter = class _StandalonePlayCanvasAdapter {
|
|
|
543
547
|
}
|
|
544
548
|
this.clickTrigger.dispose();
|
|
545
549
|
}
|
|
550
|
+
disconnectRoot() {
|
|
551
|
+
if (this.contentRoot.parent) {
|
|
552
|
+
this.contentRoot.parent.removeChild(this.contentRoot);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
connectRoot() {
|
|
556
|
+
if (!this.contentRoot.parent) {
|
|
557
|
+
this.playcanvasApp.root.addChild(this.contentRoot);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
546
560
|
getRootContainer() {
|
|
547
|
-
return this.
|
|
561
|
+
return this.contentRoot;
|
|
548
562
|
}
|
|
549
563
|
getBoundingBoxForElement(element) {
|
|
550
564
|
if (!TransformableElement.isTransformableElement(element)) {
|