@babylonjs/core 6.5.1 → 6.6.1

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.
@@ -6,7 +6,7 @@ export interface Behavior<T> {
6
6
  /** gets or sets behavior's name */
7
7
  name: string;
8
8
  /**
9
- * Function called when the behavior needs to be initialized (after attaching it to a target)
9
+ * Function called when the behavior needs to be initialized (before attaching it to a target)
10
10
  */
11
11
  init(): void;
12
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"behavior.js","sourceRoot":"","sources":["../../../../lts/core/generated/Behaviors/behavior.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"../types\";\r\n\r\n/**\r\n * Interface used to define a behavior\r\n */\r\nexport interface Behavior<T> {\r\n /** gets or sets behavior's name */\r\n name: string;\r\n\r\n /**\r\n * Function called when the behavior needs to be initialized (after attaching it to a target)\r\n */\r\n init(): void;\r\n /**\r\n * Called when the behavior is attached to a target\r\n * @param target defines the target where the behavior is attached to\r\n */\r\n attach(target: T): void;\r\n /**\r\n * Called when the behavior is detached from its target\r\n */\r\n detach(): void;\r\n}\r\n\r\n/**\r\n * Interface implemented by classes supporting behaviors\r\n */\r\nexport interface IBehaviorAware<T> {\r\n /**\r\n * Attach a behavior\r\n * @param behavior defines the behavior to attach\r\n * @returns the current host\r\n */\r\n addBehavior(behavior: Behavior<T>): T;\r\n /**\r\n * Remove a behavior from the current object\r\n * @param behavior defines the behavior to detach\r\n * @returns the current host\r\n */\r\n removeBehavior(behavior: Behavior<T>): T;\r\n /**\r\n * Gets a behavior using its name to search\r\n * @param name defines the name to search\r\n * @returns the behavior or null if not found\r\n */\r\n getBehaviorByName(name: string): Nullable<Behavior<T>>;\r\n}\r\n"]}
1
+ {"version":3,"file":"behavior.js","sourceRoot":"","sources":["../../../../lts/core/generated/Behaviors/behavior.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"../types\";\r\n\r\n/**\r\n * Interface used to define a behavior\r\n */\r\nexport interface Behavior<T> {\r\n /** gets or sets behavior's name */\r\n name: string;\r\n\r\n /**\r\n * Function called when the behavior needs to be initialized (before attaching it to a target)\r\n */\r\n init(): void;\r\n /**\r\n * Called when the behavior is attached to a target\r\n * @param target defines the target where the behavior is attached to\r\n */\r\n attach(target: T): void;\r\n /**\r\n * Called when the behavior is detached from its target\r\n */\r\n detach(): void;\r\n}\r\n\r\n/**\r\n * Interface implemented by classes supporting behaviors\r\n */\r\nexport interface IBehaviorAware<T> {\r\n /**\r\n * Attach a behavior\r\n * @param behavior defines the behavior to attach\r\n * @returns the current host\r\n */\r\n addBehavior(behavior: Behavior<T>): T;\r\n /**\r\n * Remove a behavior from the current object\r\n * @param behavior defines the behavior to detach\r\n * @returns the current host\r\n */\r\n removeBehavior(behavior: Behavior<T>): T;\r\n /**\r\n * Gets a behavior using its name to search\r\n * @param name defines the name to search\r\n * @returns the behavior or null if not found\r\n */\r\n getBehaviorByName(name: string): Nullable<Behavior<T>>;\r\n}\r\n"]}
@@ -34,13 +34,13 @@ export class ThinEngine {
34
34
  */
35
35
  // Not mixed with Version for tooling purpose.
36
36
  static get NpmPackage() {
37
- return "babylonjs@6.5.1";
37
+ return "babylonjs@6.6.1";
38
38
  }
39
39
  /**
40
40
  * Returns the current version of the framework
41
41
  */
42
42
  static get Version() {
43
- return "6.5.1";
43
+ return "6.6.1";
44
44
  }
45
45
  /**
46
46
  * Returns a string describing the current engine
@@ -1280,15 +1280,16 @@ export class ThinEngine {
1280
1280
  resize(forceSetSize = false) {
1281
1281
  let width;
1282
1282
  let height;
1283
- // Requery hardware scaling level to handle zoomed-in resizing.
1283
+ // Re-query hardware scaling level to handle zoomed-in resizing.
1284
1284
  if (this.adaptToDeviceRatio) {
1285
1285
  const devicePixelRatio = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;
1286
1286
  const changeRatio = this._lastDevicePixelRatio / devicePixelRatio;
1287
1287
  this._lastDevicePixelRatio = devicePixelRatio;
1288
1288
  this._hardwareScalingLevel *= changeRatio;
1289
1289
  }
1290
- if (IsWindowObjectExist()) {
1291
- if (this._renderingCanvas) {
1290
+ if (IsWindowObjectExist() && IsDocumentAvailable()) {
1291
+ // make sure it is a Node object, and is a part of the document.
1292
+ if (this._renderingCanvas && this._renderingCanvas.nodeType && document.body.contains(this._renderingCanvas)) {
1292
1293
  const boundingRect = this._renderingCanvas.getBoundingClientRect
1293
1294
  ? this._renderingCanvas.getBoundingClientRect()
1294
1295
  : {
@@ -1299,6 +1300,10 @@ export class ThinEngine {
1299
1300
  width = this._renderingCanvas.clientWidth || boundingRect.width;
1300
1301
  height = this._renderingCanvas.clientHeight || boundingRect.height;
1301
1302
  }
1303
+ else if (this._renderingCanvas) {
1304
+ width = this._renderingCanvas.width;
1305
+ height = this._renderingCanvas.height;
1306
+ }
1302
1307
  else {
1303
1308
  width = window.innerWidth;
1304
1309
  height = window.innerHeight;