From 084e7caf0b8e9d624be322bdd1acef77c3fc1fd9 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Mon, 8 Feb 2021 10:48:52 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BA=95=E5=9B=BE=E5=85=BC=E5=AE=B9=E8=80=81=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/ui/collection-tools/leftFunctionalDomain.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/ui/collection-tools/leftFunctionalDomain.ts b/src/app/ui/collection-tools/leftFunctionalDomain.ts index dfbdca6..92be8fb 100644 --- a/src/app/ui/collection-tools/leftFunctionalDomain.ts +++ b/src/app/ui/collection-tools/leftFunctionalDomain.ts @@ -73,7 +73,18 @@ export class editPlaneFigureComponent implements OnInit { this.details = this.data.buildingData.details || '' this.imgWidth = this.data.buildingData.imageWidth || 0 this.imgHeight = this.data.buildingData.imageHeight || 0 - this.imgScale = Number((this.imgWidth/this.imgHeight)) + if (this.imgWidth==0 && this.imgHeight==0 && this.data.buildingData.imageUrl) { + let that = this + let img = new Image() + img.src = this.data.buildingData.imageUrl + img.onload = function () { + that.imgWidth = img.width + that.imgHeight = img.height + that.imgScale = Number((that.imgWidth/that.imgHeight)) + } + } else { + this.imgScale = Number((this.imgWidth/this.imgHeight)) + } this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => { if (event.keyCode === 13) {