File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ <h2 class="title has-text-centered" id="title" href="#confidenceLevel">NFT Marke
13
13
< button class ="button is-fullwidth " id ="generateBt " onclick ="window.generate() " disabled > Generate</ button >
14
14
</ div >
15
15
< div class ="tile is-ancestor " id ="wrapper ">
16
- < canvas class ="tile " id ="imageCanvas " style =" width: auto; height: 120rem " > </ canvas >
16
+ < canvas class ="tile " id ="imageCanvas " > </ canvas >
17
17
< div class ="spinner-container ">
18
18
< div class ="spinner "> </ div >
19
19
</ div >
Original file line number Diff line number Diff line change @@ -208,11 +208,14 @@ function useJpeg(e) {
208
208
function readImage ( e ) {
209
209
reader . onload = function ( event ) {
210
210
211
- var img = new Image ( ) ;
211
+ const img = new Image ( ) ;
212
212
img . onload = function ( ) {
213
- var canvasEl = document . querySelector ( '#imageCanvas' ) ;
214
- canvas . width = canvasEl . clientWidth ;
215
- canvas . height = canvasEl . clientHeight ;
213
+ canvas . width = img . width ;
214
+ canvas . height = img . height ;
215
+
216
+ canvas . style . width = img . width > 1200 ? '1200px' : img . width + 'px' ;
217
+ canvas . style . height = img . height > 1200 ? '1200px' : img . height + 'px' ;
218
+
216
219
217
220
hideCanvas . width = img . width ;
218
221
hideCanvas . height = img . height ;
You can’t perform that action at this time.
0 commit comments