File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,10 @@ export default {
204
204
205
205
this .canvasWidth = this .width
206
206
this .canvasHeight = this .height
207
+ if ( this .width != Number .MAX_SAFE_INTEGER && this .height != Number .MAX_SAFE_INTEGER ) {
208
+ this .previewWidth = this .width
209
+ this .previewHeight = this .height
210
+ }
207
211
208
212
this .$on (' error' , this .onError )
209
213
},
@@ -232,9 +236,7 @@ export default {
232
236
this .$emit (' click' )
233
237
},
234
238
onResize () {
235
- this .resizeCanvas ()
236
-
237
- if (this .imageObject ) {
239
+ if (this .resizeCanvas () && this .imageObject ) {
238
240
this .drawImage (this .imageObject )
239
241
}
240
242
},
@@ -416,12 +418,14 @@ export default {
416
418
resizeCanvas () {
417
419
let previewRatio = this .canvasWidth / this .canvasHeight
418
420
let newWidth = this .$refs .container .clientWidth
421
+ if ( ! newWidth ) return false ;
419
422
if (! this .toggleAspectRatio && newWidth === this .containerWidth ) {
420
- return
423
+ return false ;
421
424
}
422
425
this .containerWidth = newWidth
423
426
this .previewWidth = Math .min (this .containerWidth - this .margin * 2 , this .canvasWidth )
424
427
this .previewHeight = this .previewWidth / previewRatio
428
+ return true ;
425
429
},
426
430
getOrientation (width , height ) {
427
431
let orientation = ' square'
You can’t perform that action at this time.
0 commit comments