David `Deltakosh` Catuhe 5 years ago
parent
commit
7275713b7c
2 changed files with 14 additions and 6 deletions
  1. 8 3
      src/Engines/engine.ts
  2. 6 3
      src/Engines/thinEngine.ts

+ 8 - 3
src/Engines/engine.ts

@@ -1312,13 +1312,16 @@ export class Engine extends ThinEngine {
      * Force a specific size of the canvas
      * @param width defines the new canvas' width
      * @param height defines the new canvas' height
+     * @returns true if the size was changed
      */
-    public setSize(width: number, height: number): void {
+    public setSize(width: number, height: number): boolean {
         if (!this._renderingCanvas) {
-            return;
+            return false;
         }
 
-        super.setSize(width, height);
+        if (!super.setSize(width, height)) {
+            return false;
+        }
 
         if (this.scenes) {
             for (var index = 0; index < this.scenes.length; index++) {
@@ -1335,6 +1338,8 @@ export class Engine extends ThinEngine {
                 this.onResizeObservable.notifyObservers(this);
             }
         }
+
+        return true;
     }
 
     /**

+ 6 - 3
src/Engines/thinEngine.ts

@@ -1241,21 +1241,24 @@ export class ThinEngine {
      * Force a specific size of the canvas
      * @param width defines the new canvas' width
      * @param height defines the new canvas' height
+     * @returns true if the size was changed
      */
-    public setSize(width: number, height: number): void {
+    public setSize(width: number, height: number): boolean {
         if (!this._renderingCanvas) {
-            return;
+            return false;
         }
 
         width = width | 0;
         height = height | 0;
 
         if (this._renderingCanvas.width === width && this._renderingCanvas.height === height) {
-            return;
+            return false;
         }
 
         this._renderingCanvas.width = width;
         this._renderingCanvas.height = height;
+
+        return true;
     }
 
     /**