File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -861,7 +861,7 @@ export default class Minimap {
861861 */
862862 getDevicePixelRatio ( ) {
863863 if ( this . getDevicePixelRatioRounding ( ) ) {
864- if ( devicePixelRatio >= 0.5 ) {
864+ if ( devicePixelRatio >= 1 ) {
865865 return Math . round ( devicePixelRatio )
866866 } else {
867867 return Math . max ( Math . round ( devicePixelRatio * 10 ) / 10 , 0.1 )
Original file line number Diff line number Diff line change @@ -512,13 +512,28 @@ describe("Stand alone minimap", () => {
512512 expect ( changeSpy . callCount ) . toEqual ( 3 )
513513 } )
514514
515- it ( "returns the rounding number of devicePixelRatio" , ( ) => {
516- window . devicePixelRatio = 1.25
515+ describe ( "returns the rounding number of devicePixelRatio" , ( ) => {
516+ it ( "1.25" , ( ) => {
517+ window . devicePixelRatio = 1.25
518+ minimap . setDevicePixelRatioRounding ( true )
517519
518- minimap . setDevicePixelRatioRounding ( true )
520+ expect ( minimap . getDevicePixelRatioRounding ( ) ) . toEqual ( true )
521+ expect ( minimap . getDevicePixelRatio ( ) ) . toEqual ( 1 )
522+ } )
523+ it ( "0.811" , ( ) => {
524+ window . devicePixelRatio = 0.811
525+ minimap . setDevicePixelRatioRounding ( true )
519526
520- expect ( minimap . getDevicePixelRatioRounding ( ) ) . toEqual ( true )
521- expect ( minimap . getDevicePixelRatio ( ) ) . toEqual ( 1 )
527+ expect ( minimap . getDevicePixelRatioRounding ( ) ) . toEqual ( true )
528+ expect ( minimap . getDevicePixelRatio ( ) ) . toEqual ( 0.8 )
529+ } )
530+ it ( "0.05" , ( ) => {
531+ window . devicePixelRatio = 0.051
532+ minimap . setDevicePixelRatioRounding ( true )
533+
534+ expect ( minimap . getDevicePixelRatioRounding ( ) ) . toEqual ( true )
535+ expect ( minimap . getDevicePixelRatio ( ) ) . toEqual ( 0.1 )
536+ } )
522537 } )
523538
524539 it ( "prevents the rounding number of devicePixelRatio" , ( ) => {
You can’t perform that action at this time.
0 commit comments