You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Mael B.

Trainee

  • "Mael B." started this thread

Posts: 130

Location: France, Montpellier

  • Send private message

1

Monday, June 17th 2019, 10:48pm

maxpixelzoom issue with Win10 display scale

Hi,

I recently change my old fullHD (1920*1200px) 24" screen for a 4k (3840*2160px) 32" screen, so I use the 150% display scale on Win10.
I realize that the maxpixelzoom value of 1 did not prevent pixel scaling of the source image with my new configuration *sad*

I found a solution by getting the value of window.devicePixelRatio with JS:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
 <action name="correct_maxpixelzoom" autorun="onstart" >
   jscall(
     var display_ratio = window.devicePixelRatio;
     krpano.set("display_ratio", display_ratio);
        );
        
   if(image.type == 'CUBE',
  set(view.maxpixelzoom, calc(view.maxpixelzoom/display_ratio*XX));
      ,
   set(view.maxpixelzoom, calc(view.maxpixelzoom/display_ratio));
   );
</action>


It works fine for flat panorama/image, but for spherical/cube panorama it seems there is another unknown factor XX to be taking account *confused*

2

Tuesday, June 18th 2019, 10:29am

Hi,

it's intentionally that the pixelratio is not included in the maxpixelzoom calculation.

Otherwise it wouldn't be possible to do any zooming when the pano-image itself is not that highres and using a hidpi-screen. That can happen very often especially on mobile devices.

Originally the pixelratio was even included, but there were several reports about that 'zooming-problem', so it was removed later.

Btw - the 'window.devicePixelRatio' is already available in krpano as 'device.pixelratio'.

You could e.g. do also something like this:

Source code

1
<view maxpixelzoom="calc:1.0 / device.pixelratio" />


About the maxpixelzoom on non-flat panos - a pano has a curved surface and not an even pixel-distribution that curviness is included in the calculation.

Best regards,
Klaus

Mael B.

Trainee

  • "Mael B." started this thread

Posts: 130

Location: France, Montpellier

  • Send private message

3

Tuesday, June 18th 2019, 12:36pm

Thank you Klaus for this clarification *smile*