@babylonjs/viewer 7.22.2-alpha → 7.22.2
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.
- package/configuration/configuration.d.ts +107 -0
- package/configuration/configuration.js +16 -0
- package/configuration/configuration.js.map +1 -0
- package/configuration/configurationCompatibility.d.ts +8 -0
- package/configuration/configurationCompatibility.js +66 -0
- package/configuration/configurationCompatibility.js.map +1 -0
- package/configuration/configurationContainer.d.ts +10 -0
- package/configuration/configurationContainer.js +10 -0
- package/configuration/configurationContainer.js.map +1 -0
- package/configuration/globals.d.ts +6 -0
- package/configuration/globals.js +18 -0
- package/configuration/globals.js.map +1 -0
- package/configuration/index.d.ts +2 -0
- package/configuration/index.js +4 -0
- package/configuration/index.js.map +1 -0
- package/configuration/interfaces/cameraConfiguration.d.ts +31 -0
- package/configuration/interfaces/cameraConfiguration.js +2 -0
- package/configuration/interfaces/cameraConfiguration.js.map +1 -0
- package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -0
- package/configuration/interfaces/colorGradingConfiguration.js +2 -0
- package/configuration/interfaces/colorGradingConfiguration.js.map +1 -0
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -0
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +2 -0
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -0
- package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -0
- package/configuration/interfaces/environmentMapConfiguration.js +2 -0
- package/configuration/interfaces/environmentMapConfiguration.js.map +1 -0
- package/configuration/interfaces/groundConfiguration.d.ts +24 -0
- package/configuration/interfaces/groundConfiguration.js +2 -0
- package/configuration/interfaces/groundConfiguration.js.map +1 -0
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +45 -0
- package/configuration/interfaces/imageProcessingConfiguration.js +2 -0
- package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -0
- package/configuration/interfaces/index.d.ts +15 -0
- package/configuration/interfaces/index.js +16 -0
- package/configuration/interfaces/index.js.map +1 -0
- package/configuration/interfaces/lightConfiguration.d.ts +60 -0
- package/configuration/interfaces/lightConfiguration.js +2 -0
- package/configuration/interfaces/lightConfiguration.js.map +1 -0
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -0
- package/configuration/interfaces/modelAnimationConfiguration.js +2 -0
- package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -0
- package/configuration/interfaces/modelConfiguration.d.ts +65 -0
- package/configuration/interfaces/modelConfiguration.js +2 -0
- package/configuration/interfaces/modelConfiguration.js.map +1 -0
- package/configuration/interfaces/observersConfiguration.d.ts +5 -0
- package/configuration/interfaces/observersConfiguration.js +2 -0
- package/configuration/interfaces/observersConfiguration.js.map +1 -0
- package/configuration/interfaces/sceneConfiguration.d.ts +48 -0
- package/configuration/interfaces/sceneConfiguration.js +2 -0
- package/configuration/interfaces/sceneConfiguration.js.map +1 -0
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -0
- package/configuration/interfaces/sceneOptimizerConfiguration.js +2 -0
- package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -0
- package/configuration/interfaces/skyboxConfiguration.d.ts +21 -0
- package/configuration/interfaces/skyboxConfiguration.js +2 -0
- package/configuration/interfaces/skyboxConfiguration.js.map +1 -0
- package/configuration/interfaces/templateConfiguration.d.ts +67 -0
- package/configuration/interfaces/templateConfiguration.js +2 -0
- package/configuration/interfaces/templateConfiguration.js.map +1 -0
- package/configuration/interfaces/vrConfiguration.d.ts +16 -0
- package/configuration/interfaces/vrConfiguration.js +2 -0
- package/configuration/interfaces/vrConfiguration.js.map +1 -0
- package/configuration/loader.d.ts +4 -0
- package/configuration/loader.js +17 -0
- package/configuration/loader.js.map +1 -0
- package/configuration/mappers.d.ts +43 -0
- package/configuration/mappers.js +192 -0
- package/configuration/mappers.js.map +1 -0
- package/configuration/renderOnlyLoader.d.ts +33 -0
- package/configuration/renderOnlyLoader.js +162 -0
- package/configuration/renderOnlyLoader.js.map +1 -0
- package/configuration/types/default.d.ts +6 -0
- package/configuration/types/default.js +121 -0
- package/configuration/types/default.js.map +1 -0
- package/configuration/types/environmentMap.d.ts +5 -0
- package/configuration/types/environmentMap.js +14 -0
- package/configuration/types/environmentMap.js.map +1 -0
- package/configuration/types/extended.d.ts +6 -0
- package/configuration/types/extended.js +317 -0
- package/configuration/types/extended.js.map +1 -0
- package/configuration/types/index.d.ts +14 -0
- package/configuration/types/index.js +51 -0
- package/configuration/types/index.js.map +1 -0
- package/configuration/types/minimal.d.ts +6 -0
- package/configuration/types/minimal.js +43 -0
- package/configuration/types/minimal.js.map +1 -0
- package/configuration/types/renderOnlyDefault.d.ts +30 -0
- package/configuration/types/renderOnlyDefault.js +31 -0
- package/configuration/types/renderOnlyDefault.js.map +1 -0
- package/configuration/types/shadowLight.d.ts +9 -0
- package/configuration/types/shadowLight.js +64 -0
- package/configuration/types/shadowLight.js.map +1 -0
- package/helper/index.d.ts +29 -0
- package/helper/index.js +66 -0
- package/helper/index.js.map +1 -0
- package/index.d.ts +30 -0
- package/index.js +46 -0
- package/index.js.map +1 -0
- package/initializer.d.ts +11 -0
- package/initializer.js +35 -0
- package/initializer.js.map +1 -0
- package/interfaces.d.ts +5 -0
- package/interfaces.js +7 -0
- package/interfaces.js.map +1 -0
- package/labs/environmentSerializer.d.ts +126 -0
- package/labs/environmentSerializer.js +191 -0
- package/labs/environmentSerializer.js.map +1 -0
- package/labs/texture.d.ts +183 -0
- package/labs/texture.js +351 -0
- package/labs/texture.js.map +1 -0
- package/labs/viewerLabs.d.ts +51 -0
- package/labs/viewerLabs.js +134 -0
- package/labs/viewerLabs.js.map +1 -0
- package/loader/modelLoader.d.ts +56 -0
- package/loader/modelLoader.js +199 -0
- package/loader/modelLoader.js.map +1 -0
- package/loader/plugins/applyMaterialConfig.d.ts +12 -0
- package/loader/plugins/applyMaterialConfig.js +16 -0
- package/loader/plugins/applyMaterialConfig.js.map +1 -0
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -0
- package/loader/plugins/extendedMaterialLoaderPlugin.js +16 -0
- package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -0
- package/loader/plugins/index.d.ts +19 -0
- package/loader/plugins/index.js +44 -0
- package/loader/plugins/index.js.map +1 -0
- package/loader/plugins/loaderPlugin.d.ts +24 -0
- package/loader/plugins/loaderPlugin.js +2 -0
- package/loader/plugins/loaderPlugin.js.map +1 -0
- package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -0
- package/loader/plugins/msftLodLoaderPlugin.js +21 -0
- package/loader/plugins/msftLodLoaderPlugin.js.map +1 -0
- package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -0
- package/loader/plugins/telemetryLoaderPlugin.js +36 -0
- package/loader/plugins/telemetryLoaderPlugin.js.map +1 -0
- package/managers/observablesManager.d.ts +66 -0
- package/managers/observablesManager.js +35 -0
- package/managers/observablesManager.js.map +1 -0
- package/managers/sceneManager.d.ts +245 -0
- package/managers/sceneManager.js +1375 -0
- package/managers/sceneManager.js.map +1 -0
- package/managers/telemetryManager.d.ts +78 -0
- package/managers/telemetryManager.js +117 -0
- package/managers/telemetryManager.js.map +1 -0
- package/model/modelAnimation.d.ts +215 -0
- package/model/modelAnimation.js +237 -0
- package/model/modelAnimation.js.map +1 -0
- package/model/viewerModel.d.ts +233 -0
- package/model/viewerModel.js +673 -0
- package/model/viewerModel.js.map +1 -0
- package/optimizer/custom/extended.d.ts +13 -0
- package/optimizer/custom/extended.js +101 -0
- package/optimizer/custom/extended.js.map +1 -0
- package/optimizer/custom/index.d.ts +9 -0
- package/optimizer/custom/index.js +26 -0
- package/optimizer/custom/index.js.map +1 -0
- package/package.json +29 -16
- package/readme.md +21 -35
- package/renderOnlyIndex.d.ts +11 -0
- package/renderOnlyIndex.js +18 -0
- package/renderOnlyIndex.js.map +1 -0
- package/templating/eventManager.d.ts +35 -0
- package/templating/eventManager.js +66 -0
- package/templating/eventManager.js.map +1 -0
- package/templating/plugins/hdButtonPlugin.d.ts +9 -0
- package/templating/plugins/hdButtonPlugin.js +21 -0
- package/templating/plugins/hdButtonPlugin.js.map +1 -0
- package/templating/plugins/printButton.d.ts +9 -0
- package/templating/plugins/printButton.js +40 -0
- package/templating/plugins/printButton.js.map +1 -0
- package/templating/templateManager.d.ts +197 -0
- package/templating/templateManager.js +561 -0
- package/templating/templateManager.js.map +1 -0
- package/templating/viewerTemplatePlugin.d.ts +21 -0
- package/templating/viewerTemplatePlugin.js +69 -0
- package/templating/viewerTemplatePlugin.js.map +1 -0
- package/viewer/defaultViewer.d.ts +130 -0
- package/viewer/defaultViewer.js +675 -0
- package/viewer/defaultViewer.js.map +1 -0
- package/viewer/renderOnlyViewer.d.ts +9 -0
- package/viewer/renderOnlyViewer.js +46 -0
- package/viewer/renderOnlyViewer.js.map +1 -0
- package/viewer/viewer.d.ts +258 -0
- package/viewer/viewer.js +783 -0
- package/viewer/viewer.js.map +1 -0
- package/viewer/viewerManager.d.ts +58 -0
- package/viewer/viewerManager.js +91 -0
- package/viewer/viewerManager.js.map +1 -0
- package/viewer/viewerWithTemplate.d.ts +9 -0
- package/viewer/viewerWithTemplate.js +20 -0
- package/viewer/viewerWithTemplate.js.map +1 -0
- package/dist/babylon-viewer.esm.js +0 -116321
- package/dist/babylon-viewer.esm.js.map +0 -1
- package/dist/babylon-viewer.esm.min.js +0 -2
- package/dist/babylon-viewer.esm.min.js.map +0 -1
- package/lib/index.d.ts +0 -132
- package/lib/index.js +0 -369
- package/lib/index.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EventCallback, Template } from "./templateManager";
|
|
2
|
+
export interface IViewerTemplatePlugin {
|
|
3
|
+
readonly templateName: string;
|
|
4
|
+
readonly eventsToAttach?: Array<string>;
|
|
5
|
+
interactionPredicate(event: EventCallback): boolean;
|
|
6
|
+
onEvent?(event: EventCallback): void;
|
|
7
|
+
addHTMLTemplate?(template: Template): void;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class AbstractViewerNavbarButton implements IViewerTemplatePlugin {
|
|
10
|
+
readonly templateName: string;
|
|
11
|
+
readonly eventsToAttach: Array<string>;
|
|
12
|
+
protected _prepend: boolean;
|
|
13
|
+
protected _buttonName: string;
|
|
14
|
+
protected _buttonClass: string;
|
|
15
|
+
protected _htmlTemplate: string;
|
|
16
|
+
constructor(buttonName: string, buttonClass?: string, htmlTemplate?: string);
|
|
17
|
+
interactionPredicate(event: EventCallback): boolean;
|
|
18
|
+
abstract onEvent(event: EventCallback): void;
|
|
19
|
+
addHTMLTemplate(template: Template): void;
|
|
20
|
+
protected _generateHTMLElement(template: Template): Element | DocumentFragment;
|
|
21
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as Handlebars from "handlebars";
|
|
2
|
+
var AbstractViewerNavbarButton = /** @class */ (function () {
|
|
3
|
+
function AbstractViewerNavbarButton(buttonName, buttonClass, htmlTemplate) {
|
|
4
|
+
this.templateName = "navBar";
|
|
5
|
+
this.eventsToAttach = ["pointerdown"];
|
|
6
|
+
this._prepend = true;
|
|
7
|
+
this._buttonName = buttonName;
|
|
8
|
+
if (buttonClass) {
|
|
9
|
+
this._buttonClass = buttonClass;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
this._buttonClass = buttonName + "-button";
|
|
13
|
+
}
|
|
14
|
+
if (htmlTemplate) {
|
|
15
|
+
this._htmlTemplate = htmlTemplate;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this._htmlTemplate = "\n<button class=\"".concat(this._buttonClass, "\">\n <span class=\"icon ").concat(this._buttonName, "-icon\"></span>\n</button>\n");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
AbstractViewerNavbarButton.prototype.interactionPredicate = function (event) {
|
|
22
|
+
var pointerDown = event.event;
|
|
23
|
+
if (pointerDown.button !== 0) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
var element = event.event.target;
|
|
27
|
+
if (!element) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
var elementClasses = element.classList;
|
|
31
|
+
for (var i = 0; i < elementClasses.length; ++i) {
|
|
32
|
+
var className = elementClasses[i];
|
|
33
|
+
if (className.indexOf(this._buttonClass) !== -1) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
AbstractViewerNavbarButton.prototype.addHTMLTemplate = function (template) {
|
|
40
|
+
var element = this._generateHTMLElement(template);
|
|
41
|
+
var container = template.parent.querySelector("div.default-control");
|
|
42
|
+
if (container) {
|
|
43
|
+
if (this._prepend) {
|
|
44
|
+
container.insertBefore(element, container.firstChild);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
container.appendChild(element);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
AbstractViewerNavbarButton.prototype._generateHTMLElement = function (template) {
|
|
52
|
+
var compiledTemplate = Handlebars.compile(this._htmlTemplate, { noEscape: template.configuration.params && !!template.configuration.params.noEscape });
|
|
53
|
+
var config = template.configuration.params || {};
|
|
54
|
+
var rawHtml = compiledTemplate(config);
|
|
55
|
+
var fragment;
|
|
56
|
+
try {
|
|
57
|
+
fragment = document.createRange().createContextualFragment(rawHtml);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
var test_1 = document.createElement(this._buttonClass);
|
|
61
|
+
test_1.innerHTML = rawHtml;
|
|
62
|
+
fragment = test_1;
|
|
63
|
+
}
|
|
64
|
+
return fragment;
|
|
65
|
+
};
|
|
66
|
+
return AbstractViewerNavbarButton;
|
|
67
|
+
}());
|
|
68
|
+
export { AbstractViewerNavbarButton };
|
|
69
|
+
//# sourceMappingURL=viewerTemplatePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewerTemplatePlugin.js","sourceRoot":"","sources":["../../../../tools/viewer/src/templating/viewerTemplatePlugin.ts"],"names":[],"mappings":"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","sourcesContent":["import type { EventCallback, Template } from \"./templateManager\";\r\nimport * as Handlebars from \"handlebars\";\r\n\r\nexport interface IViewerTemplatePlugin {\r\n readonly templateName: string;\r\n readonly eventsToAttach?: Array<string>;\r\n\r\n interactionPredicate(event: EventCallback): boolean;\r\n onEvent?(event: EventCallback): void;\r\n addHTMLTemplate?(template: Template): void;\r\n}\r\n\r\nexport abstract class AbstractViewerNavbarButton implements IViewerTemplatePlugin {\r\n public readonly templateName: string = \"navBar\";\r\n public readonly eventsToAttach: Array<string> = [\"pointerdown\"];\r\n protected _prepend: boolean = true;\r\n protected _buttonName: string;\r\n protected _buttonClass: string;\r\n protected _htmlTemplate: string;\r\n\r\n constructor(buttonName: string, buttonClass?: string, htmlTemplate?: string) {\r\n this._buttonName = buttonName;\r\n if (buttonClass) {\r\n this._buttonClass = buttonClass;\r\n } else {\r\n this._buttonClass = buttonName + \"-button\";\r\n }\r\n if (htmlTemplate) {\r\n this._htmlTemplate = htmlTemplate;\r\n } else {\r\n this._htmlTemplate = `\r\n<button class=\"${this._buttonClass}\">\r\n <span class=\"icon ${this._buttonName}-icon\"></span>\r\n</button>\r\n`;\r\n }\r\n }\r\n\r\n interactionPredicate(event: EventCallback): boolean {\r\n const pointerDown = <PointerEvent>event.event;\r\n if (pointerDown.button !== 0) {\r\n return false;\r\n }\r\n const element = <HTMLElement>event.event.target;\r\n\r\n if (!element) {\r\n return false;\r\n }\r\n\r\n const elementClasses = element.classList;\r\n\r\n for (let i = 0; i < elementClasses.length; ++i) {\r\n const className = elementClasses[i];\r\n if (className.indexOf(this._buttonClass) !== -1) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n abstract onEvent(event: EventCallback): void;\r\n\r\n public addHTMLTemplate(template: Template): void {\r\n const element = this._generateHTMLElement(template);\r\n const container = template.parent.querySelector(\"div.default-control\");\r\n if (container) {\r\n if (this._prepend) {\r\n container.insertBefore(element, container.firstChild);\r\n } else {\r\n container.appendChild(element);\r\n }\r\n }\r\n }\r\n\r\n protected _generateHTMLElement(template: Template): Element | DocumentFragment {\r\n const compiledTemplate = Handlebars.compile(this._htmlTemplate, { noEscape: template.configuration.params && !!template.configuration.params.noEscape });\r\n const config = template.configuration.params || {};\r\n const rawHtml = compiledTemplate(config);\r\n let fragment: Element | DocumentFragment;\r\n try {\r\n fragment = document.createRange().createContextualFragment(rawHtml);\r\n } catch (e) {\r\n const test = document.createElement(this._buttonClass);\r\n test.innerHTML = rawHtml;\r\n fragment = test;\r\n }\r\n return fragment;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Template } from "../templating/templateManager";
|
|
2
|
+
import { TemplateManager } from "../templating/templateManager";
|
|
3
|
+
import { AbstractViewerWithTemplate } from "./viewerWithTemplate";
|
|
4
|
+
import type { ViewerModel } from "../model/viewerModel";
|
|
5
|
+
import type { IViewerTemplatePlugin } from "../templating/viewerTemplatePlugin";
|
|
6
|
+
import type { ViewerConfiguration } from "../configuration/configuration";
|
|
7
|
+
import type { IModelConfiguration } from "../configuration/interfaces/modelConfiguration";
|
|
8
|
+
import "@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent.js";
|
|
9
|
+
/**
|
|
10
|
+
* The Default viewer is the default implementation of the AbstractViewer.
|
|
11
|
+
* It uses the templating system to render a new canvas and controls.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DefaultViewer extends AbstractViewerWithTemplate {
|
|
14
|
+
containerElement: Element;
|
|
15
|
+
/**
|
|
16
|
+
* The corresponsing template manager of this viewer.
|
|
17
|
+
*/
|
|
18
|
+
templateManager: TemplateManager;
|
|
19
|
+
fullscreenElement?: Element;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new default viewer
|
|
22
|
+
* @param containerElement the element in which the templates will be rendered
|
|
23
|
+
* @param initialConfiguration the initial configuration. Defaults to extending the default configuration
|
|
24
|
+
*/
|
|
25
|
+
constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
|
|
26
|
+
private _registeredPlugins;
|
|
27
|
+
registerTemplatePlugin(plugin: IViewerTemplatePlugin): void;
|
|
28
|
+
/**
|
|
29
|
+
* This will be executed when the templates initialize.
|
|
30
|
+
* @returns a promise that will be resolved when the templates are loaded
|
|
31
|
+
*/
|
|
32
|
+
protected _onTemplatesLoaded(): Promise<import("./viewer").AbstractViewer>;
|
|
33
|
+
private _initNavbar;
|
|
34
|
+
private _animationList;
|
|
35
|
+
private _currentAnimation;
|
|
36
|
+
private _isAnimationPaused;
|
|
37
|
+
private _resumePlay;
|
|
38
|
+
private _handlePointerClick;
|
|
39
|
+
/**
|
|
40
|
+
* Plays or Pauses animation
|
|
41
|
+
* @param noUiUpdate
|
|
42
|
+
*/
|
|
43
|
+
private _togglePlayPause;
|
|
44
|
+
private _oldIdleRotationValue;
|
|
45
|
+
/**
|
|
46
|
+
* Control progress bar position based on animation current frame
|
|
47
|
+
*/
|
|
48
|
+
private _updateProgressBar;
|
|
49
|
+
/**
|
|
50
|
+
* Update Current Animation Speed
|
|
51
|
+
* @param speed
|
|
52
|
+
* @param paramsObject
|
|
53
|
+
*/
|
|
54
|
+
private _updateAnimationSpeed;
|
|
55
|
+
/**
|
|
56
|
+
* Update Current Animation Type
|
|
57
|
+
* @param data
|
|
58
|
+
* @param data.label
|
|
59
|
+
* @param data.value
|
|
60
|
+
* @param paramsObject
|
|
61
|
+
*/
|
|
62
|
+
private _updateAnimationType;
|
|
63
|
+
protected _initVR(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Toggle fullscreen of the entire viewer
|
|
66
|
+
*/
|
|
67
|
+
toggleFullscreen: () => void;
|
|
68
|
+
/**
|
|
69
|
+
* Preparing the container element to present the viewer
|
|
70
|
+
*/
|
|
71
|
+
protected _prepareContainerElement(): void;
|
|
72
|
+
/**
|
|
73
|
+
* This function will configure the templates and update them after a model was loaded
|
|
74
|
+
* It is mainly responsible to changing the title and subtitle etc'.
|
|
75
|
+
* @param model the model to be used to configure the templates by
|
|
76
|
+
*/
|
|
77
|
+
protected _configureTemplate(model?: ViewerModel): void;
|
|
78
|
+
/**
|
|
79
|
+
* This will load a new model to the default viewer
|
|
80
|
+
* overriding the AbstractViewer's loadModel.
|
|
81
|
+
* The scene will automatically be cleared of the old models, if exist.
|
|
82
|
+
* @param model the configuration object (or URL) to load.
|
|
83
|
+
* @returns a promise that will be resolved when the model is loaded
|
|
84
|
+
*/
|
|
85
|
+
loadModel(model?: string | File | IModelConfiguration): Promise<ViewerModel>;
|
|
86
|
+
private _onModelLoaded;
|
|
87
|
+
/**
|
|
88
|
+
* Show the overlay and the defined sub-screen.
|
|
89
|
+
* Mainly used for help and errors
|
|
90
|
+
* @param subScreen the name of the subScreen. Those can be defined in the configuration object
|
|
91
|
+
* @returns a promise that will be resolved when the overlay is shown
|
|
92
|
+
*/
|
|
93
|
+
showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
|
|
94
|
+
/**
|
|
95
|
+
* Hide the overlay screen.
|
|
96
|
+
* @returns a promise that will be resolved when the overlay is hidden
|
|
97
|
+
*/
|
|
98
|
+
hideOverlayScreen(): Promise<string> | Promise<Template>;
|
|
99
|
+
/**
|
|
100
|
+
* show the viewer (in case it was hidden)
|
|
101
|
+
*
|
|
102
|
+
* @param visibilityFunction an optional function to execute in order to show the container
|
|
103
|
+
* @returns a promise that will be resolved when the viewer is shown
|
|
104
|
+
*/
|
|
105
|
+
show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
|
|
106
|
+
/**
|
|
107
|
+
* hide the viewer (in case it is visible)
|
|
108
|
+
*
|
|
109
|
+
* @param visibilityFunction an optional function to execute in order to hide the container
|
|
110
|
+
* @returns a promise that will be resolved when the viewer is hidden
|
|
111
|
+
*/
|
|
112
|
+
hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
|
|
113
|
+
/**
|
|
114
|
+
* Show the loading screen.
|
|
115
|
+
* The loading screen can be configured using the configuration object
|
|
116
|
+
* @returns a promise that will be resolved when the loading screen is shown
|
|
117
|
+
*/
|
|
118
|
+
showLoadingScreen(): Promise<string> | Promise<Template>;
|
|
119
|
+
/**
|
|
120
|
+
* Hide the loading screen
|
|
121
|
+
* @returns a promise that will be resolved when the loading screen is hidden
|
|
122
|
+
*/
|
|
123
|
+
hideLoadingScreen(): Promise<string> | Promise<Template>;
|
|
124
|
+
dispose(): void;
|
|
125
|
+
protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
|
|
126
|
+
/**
|
|
127
|
+
* An extension of the light configuration of the abstract viewer.
|
|
128
|
+
*/
|
|
129
|
+
private _configureLights;
|
|
130
|
+
}
|