File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1515             margin :  0px  ;
1616             overflow :  hidden;
1717        }
18-         canvas  {
19-             width :  100vw  ;
20-             height :  100vh  ;
18+         canvas  { 
2119            border :  0px  ;
2220            position :  absolute;
2321            top : 0px  ;
Original file line number Diff line number Diff line change @@ -96,7 +96,16 @@ export class Editor {
9696        this . _ctx  =  canvas . getContext ( '2d' ) ! ;  //TODO:handle error 
9797        this . _ctx . font  =  Theme . config . fontSize + 'px ' + Theme . config . fontFamily ; 
9898
99-         this . canvasAspect  =  this . canvas . width  /  this . canvas . height ; 
99+         const  dpr  =  window . devicePixelRatio  ||  1 ; 
100+ 
101+         this . canvas . width  =  window . innerWidth  *  dpr ; 
102+         this . canvas . height  =  window . innerHeight  *  dpr ; 
103+ 
104+         // Set CSS size (for display) 
105+         this . canvas . style . width  =  `${ window . innerWidth }  ; 
106+         this . canvas . style . height  =  `${ window . innerHeight }  ; 
107+ 
108+         this . canvasAspect  =  this . canvas . height  /  this . canvas . width ; 
100109        this . reset ( ) ; 
101110
102111        window . addEventListener ( "resize" ,  this . onResize . bind ( this ) ) ;  
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments