@@ -44,16 +44,11 @@ class ScaleControl implements IControl {
4444    _map : Map ; 
4545    _container : HTMLElement ; 
4646    _language ?: string  |  string [ ] ; 
47-     _isNumberFormatSupported : boolean ; 
4847    options : ScaleControlOptions ; 
4948
5049    constructor ( options : ScaleControlOptions  =  { } )  { 
5150        this . options  =  Object . assign ( { } ,  defaultOptions ,  options ) ; 
5251
53-         // Some old browsers (e.g., Safari < 14.1) don't support the "unit" style in NumberFormat. 
54-         // This is a workaround to display the scale without proper internationalization support. 
55-         this . _isNumberFormatSupported  =  isNumberFormatSupported ( ) ; 
56- 
5752        bindAll ( [ 
5853            '_update' , 
5954            '_setScale' , 
@@ -104,7 +99,7 @@ class ScaleControl implements IControl {
10499            const  distance  =  getRoundNum ( maxDistance ) ; 
105100            const  ratio  =  distance  /  maxDistance ; 
106101
107-             if  ( this . _isNumberFormatSupported   &&   unit  !==  'nautical-mile' )  { 
102+             if  ( unit  !==  'nautical-mile' )  { 
108103                this . _container . innerHTML  =  new  Intl . NumberFormat ( this . _language ,  { style : 'unit' ,  unitDisplay : 'short' ,  unit} ) . format ( distance ) ; 
109104            }  else  { 
110105                this . _container . innerHTML  =  `${ distance }   ${ unitAbbr [ unit ] }  ` ; 
@@ -150,15 +145,6 @@ class ScaleControl implements IControl {
150145
151146export  default  ScaleControl ; 
152147
153- function  isNumberFormatSupported ( )  { 
154-     try  { 
155-         new  Intl . NumberFormat ( 'en' ,  { style : 'unit' ,  unitDisplay : 'short' ,  unit : 'meter' } ) ; 
156-         return  true ; 
157-     }  catch  ( _ : unknown )  { 
158-         return  false ; 
159-     } 
160- } 
161- 
162148function  getDecimalRoundNum ( d : number )  { 
163149    const  multiplier  =  Math . pow ( 10 ,  Math . ceil ( - Math . log ( d )  /  Math . LN10 ) ) ; 
164150    return  Math . round ( d  *  multiplier )  /  multiplier ; 
0 commit comments