You are not logged in.

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 1,120

Location: Angers - France

Occupation: 360 experiences creator

  • Send private message

1

Thursday, April 28th 2022, 4:35pm

Zoom slider Flat panorama

Hi,
To update a zoom indicator for regular panoramas we can use this action :

Source code

1
2
3
4
5
6
<action name="updateslider">
  sub(val, view.fov, view.fovmin);
  sub(fovrange, view.fovmax, view.fovmin);
  div(val, fovrange);
  mul(plugin[slider_grip].y, val, plugin[slider_bg].pixelheight);
</action>


but when the pano is flat how to set the correct fovmax value as it changes according to the screen and image ratio when limitview is set to auto ?
thnx !

spacerywirtualne

Professional

Posts: 1,117

Location: Poland, Europe

Occupation: krpano developer : virtual tours : the cms4vr owner

  • Send private message

2

Thursday, April 28th 2022, 10:09pm

Hi jeromebg

In this example I have code bolow:

Source code

1
2
calc(val,1 - (view.fov - view.fovmin) / (view.fovmax - view.fovmin));
mul(plugin[slider_grip].x, val, plugin[slider_bg].pixelwidth);


Maybe this will help

Piotr
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 1,120

Location: Angers - France

Occupation: 360 experiences creator

  • Send private message

3

Friday, April 29th 2022, 8:51am

Thanx for your help Piotr !
Unfortunately this doesn't work for me, I feel stupid ;)

https://360images.fr/360/saint-cirq-lapopie/

panoyun

Intermediate

Posts: 234

Location: Somalia

  • Send private message

4

Friday, April 29th 2022, 9:20am

<layer name="slider_bg" type="container" keep="true" maskchildren="true" align="righttop" bgroundedge="5" bgcolor="0xffffff" bgalpha="0.1" x="5" y="100" width="10" >
<layer name="slider_grip" type="container" align="top" edge="top" bgroundedge="5" bgcolor="0xffffff" bgalpha="0.4" keep="true" width="10" height="20"/>
</layer>



<events onviewchanged="updateslider();" />

<action name="updateslider">
calc(plugin[slider_bg].height, view.fovmax);

sub(val, view.fov, view.fovmin);
sub(fovrange, view.fovmax, view.fovmin);
div(val, fovrange);

calc(plugin[slider_grip].y, val * plugin[slider_bg].pixelheight - plugin[slider_grip].pixelheight );


if(plugin[slider_grip].y LT 0,
set(plugin[slider_grip].y,0);
);

trace(plugin[slider_grip].y);
</action>

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 1,120

Location: Angers - France

Occupation: 360 experiences creator

  • Send private message

5

Friday, April 29th 2022, 9:26am

Thanx panoyun, but what is the difference with the initial code in my initial post ?

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 1,120

Location: Angers - France

Occupation: 360 experiences creator

  • Send private message

6

Friday, April 29th 2022, 10:51am

Ok, in fact the trick was to set the fovmax according to the screen and image ratio...

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<events name="sliderevents" onviewchanged="updateslider();" onresize="set_fovmax()"/>

	<action name="set_fovmax">
		div(imageratio, image.hfov, image.vfov);
		div(screenratio, stagewidth, stageheight);
		if(imageratio LT screenratio,
			set(view.fovtype, HFOV);
			copy(view.fovmax, image.hfov);
		,
      		        set(view.fovtype, VFOV);
			copy(view.fovmax, image.vfov);
		);
	</action>

<action name="updateslider">
  sub(val, view.fov, view.fovmin);
  sub(fovrange, view.fovmax, view.fovmin);
  div(val, fovrange);
  mul(plugin[slider_grip].y, val, plugin[slider_bg].pixelheight);
</action>