|
@@ -74299,7 +74299,7 @@ var TemplateManager = (function () {
|
|
}
|
|
}
|
|
return template;
|
|
return template;
|
|
};
|
|
};
|
|
- var htmlTree = this.buildHTMLTree(templates).then(function (htmlTree) {
|
|
|
|
|
|
+ this.buildHTMLTree(templates).then(function (htmlTree) {
|
|
internalInit(htmlTree, 'main');
|
|
internalInit(htmlTree, 'main');
|
|
});
|
|
});
|
|
};
|
|
};
|
|
@@ -74308,6 +74308,7 @@ var TemplateManager = (function () {
|
|
var promises = Object.keys(templates).map(function (name) {
|
|
var promises = Object.keys(templates).map(function (name) {
|
|
var template = new Template(name, templates[name]);
|
|
var template = new Template(name, templates[name]);
|
|
_this.templates[name] = template;
|
|
_this.templates[name] = template;
|
|
|
|
+ return template.initPromise;
|
|
});
|
|
});
|
|
return Promise.all(promises).then(function () {
|
|
return Promise.all(promises).then(function () {
|
|
var templateStructure = {};
|
|
var templateStructure = {};
|
|
@@ -74375,8 +74376,12 @@ var Template = (function () {
|
|
});
|
|
});
|
|
Template.prototype.getChildElements = function () {
|
|
Template.prototype.getChildElements = function () {
|
|
var childrenArray = [];
|
|
var childrenArray = [];
|
|
- for (var i = 0; i < this.fragment.children.length; ++i) {
|
|
|
|
- childrenArray.push(helper_1.kebabToCamel(this.fragment.children.item(i).nodeName.toLowerCase()));
|
|
|
|
|
|
+ var children = this.fragment.children;
|
|
|
|
+ if (!children) {
|
|
|
|
+ children = this.fragment.querySelectorAll('*');
|
|
|
|
+ }
|
|
|
|
+ for (var i = 0; i < children.length; ++i) {
|
|
|
|
+ childrenArray.push(helper_1.kebabToCamel(children.item(i).nodeName.toLowerCase()));
|
|
}
|
|
}
|
|
return childrenArray;
|
|
return childrenArray;
|
|
};
|
|
};
|
|
@@ -74428,23 +74433,31 @@ var Template = (function () {
|
|
Template.prototype.registerEvents = function () {
|
|
Template.prototype.registerEvents = function () {
|
|
var _this = this;
|
|
var _this = this;
|
|
if (this._configuration.events) {
|
|
if (this._configuration.events) {
|
|
- Object.keys(this._configuration.events).forEach(function (eventName) {
|
|
|
|
- if (_this._configuration.events && _this._configuration.events[eventName]) {
|
|
|
|
|
|
+ var _loop_1 = function (eventName) {
|
|
|
|
+ if (this_1._configuration.events && this_1._configuration.events[eventName]) {
|
|
var functionToFire_1 = function (selector, event) {
|
|
var functionToFire_1 = function (selector, event) {
|
|
_this.onEventTriggered.notifyObservers({ event: event, template: _this, selector: selector });
|
|
_this.onEventTriggered.notifyObservers({ event: event, template: _this, selector: selector });
|
|
};
|
|
};
|
|
- if (typeof _this._configuration.events[eventName] === 'boolean') {
|
|
|
|
- _this.parent.addEventListener(eventName, functionToFire_1.bind(_this, '#' + _this.parent.id), false);
|
|
|
|
|
|
+ if (typeof this_1._configuration.events[eventName] === 'boolean') {
|
|
|
|
+ this_1.parent.addEventListener(eventName, functionToFire_1.bind(this_1, '#' + this_1.parent.id), false);
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- var selectorsArray = _this._configuration.events[eventName];
|
|
|
|
- selectorsArray.forEach(function (selector) {
|
|
|
|
|
|
+ else if (typeof this_1._configuration.events[eventName] === 'object') {
|
|
|
|
+ var selectorsArray = Object.keys(this_1._configuration.events[eventName] || {});
|
|
|
|
+ var event_1 = this_1._configuration.events[eventName] || {};
|
|
|
|
+ selectorsArray.filter(function (selector) { return event_1[selector]; }).forEach(function (selector) {
|
|
|
|
+ if (selector.indexOf('#') !== 0) {
|
|
|
|
+ selector = '#' + selector;
|
|
|
|
+ }
|
|
var htmlElement = _this.parent.querySelector(selector);
|
|
var htmlElement = _this.parent.querySelector(selector);
|
|
htmlElement && htmlElement.addEventListener(eventName, functionToFire_1.bind(_this, selector), false);
|
|
htmlElement && htmlElement.addEventListener(eventName, functionToFire_1.bind(_this, selector), false);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ var this_1 = this;
|
|
|
|
+ for (var eventName in this._configuration.events) {
|
|
|
|
+ _loop_1(eventName);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
return Template;
|
|
return Template;
|
|
@@ -100860,7 +100873,7 @@ exports.defaultConfiguration = {
|
|
visibilityTimeout: 2000
|
|
visibilityTimeout: 2000
|
|
},
|
|
},
|
|
events: {
|
|
events: {
|
|
- pointerdown: ['#fullscreen-button']
|
|
|
|
|
|
+ pointerdown: { 'fullscreen-button': true }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
overlay: {
|
|
overlay: {
|
|
@@ -100881,14 +100894,14 @@ exports.defaultConfiguration = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
camera: {
|
|
camera: {
|
|
- behaviors: [
|
|
|
|
- 0,
|
|
|
|
- {
|
|
|
|
|
|
+ behaviors: {
|
|
|
|
+ autoRotate: 0,
|
|
|
|
+ framing: {
|
|
type: 2,
|
|
type: 2,
|
|
zoomOnBoundingInfo: true,
|
|
zoomOnBoundingInfo: true,
|
|
zoomStopsAnimation: false
|
|
zoomStopsAnimation: false
|
|
}
|
|
}
|
|
- ]
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
skybox: {
|
|
skybox: {
|
|
cubeTexture: {
|
|
cubeTexture: {
|
|
@@ -103372,7 +103385,7 @@ var DefaultViewer = (function (_super) {
|
|
switch (data.selector) {
|
|
switch (data.selector) {
|
|
case '#fullscreen-button':
|
|
case '#fullscreen-button':
|
|
if (!isFullscreen) {
|
|
if (!isFullscreen) {
|
|
- var requestFullScreen = viewerElement.requestFullscreen || viewerElement.webkitRequestFullscreen;
|
|
|
|
|
|
+ var requestFullScreen = viewerElement.requestFullscreen || viewerElement.webkitRequestFullscreen || viewerElement.msRequestFullscreen || viewerElement.mozRequestFullScreen;
|
|
requestFullScreen.call(viewerElement);
|
|
requestFullScreen.call(viewerElement);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -103536,12 +103549,13 @@ var DefaultViewer = (function (_super) {
|
|
var _this = this;
|
|
var _this = this;
|
|
if (focusMeshes === void 0) { focusMeshes = []; }
|
|
if (focusMeshes === void 0) { focusMeshes = []; }
|
|
var sceneConfig = this.configuration.scene || { defaultLight: true };
|
|
var sceneConfig = this.configuration.scene || { defaultLight: true };
|
|
- if (!sceneConfig.defaultLight && (this.configuration.lights && this.configuration.lights.length)) {
|
|
|
|
|
|
+ if (!sceneConfig.defaultLight && (this.configuration.lights && Object.keys(this.configuration.lights).length)) {
|
|
this.scene.lights.forEach(function (l) {
|
|
this.scene.lights.forEach(function (l) {
|
|
l.dispose();
|
|
l.dispose();
|
|
});
|
|
});
|
|
- this.configuration.lights.forEach(function (lightConfig, idx) {
|
|
|
|
- lightConfig.name = lightConfig.name || 'light-' + idx;
|
|
|
|
|
|
+ Object.keys(this.configuration.lights).forEach(function (name, idx) {
|
|
|
|
+ var lightConfig = _this.configuration.lights && _this.configuration.lights[name] || { name: name, type: 0 };
|
|
|
|
+ lightConfig.name = name;
|
|
var constructor = babylonjs_1.Light.GetConstructorFromName(lightConfig.type, lightConfig.name, _this.scene);
|
|
var constructor = babylonjs_1.Light.GetConstructorFromName(lightConfig.type, lightConfig.name, _this.scene);
|
|
var light = constructor();
|
|
var light = constructor();
|
|
if (light.isEnabled() !== !lightConfig.disabled) {
|
|
if (light.isEnabled() !== !lightConfig.disabled) {
|
|
@@ -103561,7 +103575,6 @@ var DefaultViewer = (function (_super) {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
DefaultViewer.prototype.setupCamera = function (focusMeshes) {
|
|
DefaultViewer.prototype.setupCamera = function (focusMeshes) {
|
|
- var _this = this;
|
|
|
|
if (focusMeshes === void 0) { focusMeshes = []; }
|
|
if (focusMeshes === void 0) { focusMeshes = []; }
|
|
var sceneConfig = this.configuration.scene || { autoRotate: false, defaultCamera: true };
|
|
var sceneConfig = this.configuration.scene || { autoRotate: false, defaultCamera: true };
|
|
if (sceneConfig.defaultCamera) {
|
|
if (sceneConfig.defaultCamera) {
|
|
@@ -103577,9 +103590,9 @@ var DefaultViewer = (function (_super) {
|
|
this.camera.minZ = cameraConfig.minZ || this.camera.minZ;
|
|
this.camera.minZ = cameraConfig.minZ || this.camera.minZ;
|
|
this.camera.maxZ = cameraConfig.maxZ || this.camera.maxZ;
|
|
this.camera.maxZ = cameraConfig.maxZ || this.camera.maxZ;
|
|
if (cameraConfig.behaviors) {
|
|
if (cameraConfig.behaviors) {
|
|
- cameraConfig.behaviors.forEach(function (behaviorConfig) {
|
|
|
|
- _this.setCameraBehavior(behaviorConfig, focusMeshes);
|
|
|
|
- });
|
|
|
|
|
|
+ for (var name_1 in cameraConfig.behaviors) {
|
|
|
|
+ this.setCameraBehavior(cameraConfig.behaviors[name_1], focusMeshes);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
;
|
|
;
|
|
if (sceneConfig.autoRotate) {
|
|
if (sceneConfig.autoRotate) {
|