From 9f0d82ce7dfa0103781b7f420cb75a01f634ed4f Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Tue, 24 Dec 2019 22:39:15 -0500 Subject: [PATCH] [+] Create loadDimensions method --- src/App.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/App.ts b/src/App.ts index 0592b75..6f1c5bb 100644 --- a/src/App.ts +++ b/src/App.ts @@ -49,6 +49,18 @@ class Artwork return './404.jpg' } } + + loadDimensions() + { + let img = new Image(); + img.onload = () => + { + this.width = img.width; + this.height = img.height; + }; + img.src = this.imgFull; + return this; + } } @Component({components: {PhotoSwipper}})