Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricGuillemetMS committed Jul 21, 2021
1 parent be094ca commit 1c1239f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions gui/src/2D/controls/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export class Image extends Control {
const height = this._domImage.height;

// Should abstract platform instead of using LastCreatedEngine
const engine = Engine.LastCreatedEngine;
const engine = this._host?.getScene()?.getEngine() || Engine.LastCreatedEngine;
if (!engine) {
throw new Error("Invalid engine. Unable to create a canvas.");
}
Expand Down Expand Up @@ -400,7 +400,7 @@ export class Image extends Control {
const height = this._domImage.height;

if (!this._workingCanvas) {
const engine = Engine.LastCreatedEngine;
const engine = this._host?.getScene()?.getEngine() || Engine.LastCreatedEngine;
if (!engine) {
throw new Error("Invalid engine. Unable to create a canvas.");
}
Expand Down Expand Up @@ -512,7 +512,7 @@ export class Image extends Control {
}

// Should abstract platform instead of using LastCreatedEngine
const engine = Engine.LastCreatedEngine;
const engine = this._host?.getScene()?.getEngine() || Engine.LastCreatedEngine;
if (!engine) {
throw new Error("Invalid engine. Unable to create a canvas.");
}
Expand Down Expand Up @@ -761,7 +761,7 @@ export class Image extends Control {
const height = this._currentMeasure.height;

if (!this._workingCanvas) {
const engine = Engine.LastCreatedEngine;
const engine = this._host?.getScene()?.getEngine() || Engine.LastCreatedEngine;
if (!engine) {
throw new Error("Invalid engine. Unable to create a canvas.");
}
Expand Down
3 changes: 1 addition & 2 deletions src/Engines/nativeEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2510,8 +2510,7 @@ export class NativeEngine extends Engine {
* Create an image to use with canvas
* @return IImage interface
*/
public createCanvasImage() : IImage
{
public createCanvasImage(): IImage {
if (!_native.NativeCanvas) {
throw new Error("Native Canvas plugin not available.");
}
Expand Down
3 changes: 1 addition & 2 deletions src/Engines/thinEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,7 @@ export class ThinEngine {
* Create an image to use with canvas
* @return IImage interface
*/
public createCanvasImage(): IImage
{
public createCanvasImage(): IImage {
return document.createElement("img");
}

Expand Down

0 comments on commit 1c1239f

Please sign in to comment.