File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 11export  default  function ( width ,  height ,  options )  { 
2-   var  scale   =   devicePixelRatio ; 
2+   let  scale ; 
33  if  ( options  ==  null )  { 
4-     options  =  { } ; 
5-   }  else  if  ( options  ==   + options )  { 
6-     scale  =  + options ; 
7-     options  =  { } ; 
4+     options  =  undefined ; 
5+   }  else  if  ( typeof   options  ===    "number" )  { 
6+     scale  =  options ; 
7+     options  =  undefined ; 
88  }  else  { 
9-     if  ( options . scale )  scale  =  + options . scale ; 
10-     delete  options . scale ; 
9+     ( { scale,  ...options }  =  options ) ; 
1110  } 
12-   var  canvas  =  document . createElement ( "canvas" ) ; 
11+   if  ( scale  ===  undefined )  scale  =  devicePixelRatio ; 
12+   const  canvas  =  document . createElement ( "canvas" ) ; 
1313  canvas . width  =  width  *  scale ; 
1414  canvas . height  =  height  *  scale ; 
1515  canvas . style . width  =  width  +  "px" ; 
16-   var  context ; 
17-   context  =  canvas . getContext ( "2d" ,  options ) ; 
16+   const  context  =  canvas . getContext ( "2d" ,  options ) ; 
1817  context . scale ( scale ,  scale ) ; 
1918  return  context ; 
2019} 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments