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.

1

Saturday, March 31st 2012, 12:18pm

[SOLVED] Convert Blend slider in Zoom slider ?

Hi,

How to convert the xml blend slider in Zoom slider ?
Replacing the "setblend" action by a "setfov" and how to achieve that ?

Thankx

z ;-)

This post has been edited 1 times, last edit by "zadda" (Apr 12th 2012, 10:47am)


2

Wednesday, April 4th 2012, 2:39pm

Hi,

yes, just replacing the setblend call would be a possibility,
the "val" variable has a value in the range 0.0 to 1.0, so if you want to slide something particular that value needs to be adopted,

e.g. to slide between fovmin and fovmax replace "setblend(get(val));" with:

Source code

1
2
3
4
sub(fovrange, view.fovmax, view.fovmin);
mul(newfov, val, fovrange);
add(newfov, view.fovmin);
set(view.fov, get(newfov));


best regards,
Klaus

3

Wednesday, April 4th 2012, 3:23pm

Thanks, i've got a working zoom slider now, *g*

but i need one more thing :

-updating the x position of the slider grip on start and for any event : mouse-wheel zoom or any other zoom change (context menu...etc)
so i suppose i have to build an action and call her every zoom change..
and what this action will be ? *confused*

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!--
	#############################################
	#                      PLUGIN FOV SLIDER              #
	#############################################
	-->
	<plugin name="slider_bg" url="gfx/slider_background.png" align="bottom" x="0" y="30" handcursor="false" zorder="1" parent="stage"/>
	
	<plugin name="slider_grip" url="gfx/slider_grip.png" align="left" edge="center" parent="slider_bg" x="0" zorder="2" 
			dragging="if(pressed, 
						sub(dx, mouse.stagex, drag_stagex); 
						add(newx, drag_currentx, dx); 
						if(newx LT 0, set(newx,0));
						if(newx GT plugin[slider_bg].pixelwidth, copy(newx,plugin[slider_bg].pixelwidth));
						copy(x,newx);
						div(val, newx, plugin[slider_bg].pixelwidth);
						
							sub(fovrange, view.fovmax, view.fovmin);
							mul(newfov, val, fovrange);
							add(newfov, view.fovmin);
							set(view.fov, get(newfov));	
						
						delayedcall(0,dragging());
					  );"
			ondown="copy(drag_currentx,x); copy(drag_stagex,mouse.stagex); dragging();"
			/>
	<!--  END plugin slider  -->
	


Thanks

z

4

Wednesday, April 4th 2012, 3:35pm

Hi,

the onviewchanged event would need to be used here,

e.g.

Source code

1
2
3
4
5
6
7
8
<events name="sliderevents" keep="true" onviewchanged="updateslider();" />

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


btw - I have moved this topic from the feature request forum to the normal viewer forum, because that's not directly a feature request

best regards,
Klaus

5

Wednesday, April 4th 2012, 5:21pm

Wow cool *thumbsup*
works fine !

thanks Klaus,

and to setup a vertical slider ?
i've tried to replace all "x" values with "y" and "width" references with "height"
but i miss something as the dragging not usable *confused*

Thanks again,
this last point is not urgent yet.

z

6

Wednesday, April 4th 2012, 6:28pm

Hi,

have you really replaced all 'x' occurrences to 'y' (and all 'width' to 'height' of course)?
e.g. also the stagex and so on?

as long as you don't missed one, it should work also vertically of course

best regards,
Klaus

7

Wednesday, April 4th 2012, 8:07pm

well i got this :

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
	<plugin name="slider_bg" url="gfx/slider_background.png" align="bottom" rotate="90" x="210" y="270" handcursor="false" zorder="1" parent="stage"/>
	
	<plugin name="slider_grip" url="gfx/slider_grip.png" align="left" edge="center" parent="slider_bg" y="0" zorder="2" 
			dragging="if(pressed, 
						sub(dy, mouse.stagey, drag_stagey); 
						add(newy, drag_currenty, dy); 
						if(newy LT 0, set(newy,0));
						if(newy GT plugin[slider_bg].pixelheight, copy(newy,plugin[slider_bg].pixelheight));
						copy(y,newy);
						div(val, newy, plugin[slider_bg].pixelheight);
						
							sub(fovrange, view.fovmax, view.fovmin);
							mul(newfov, val, fovrange);
							add(newfov, view.fovmin);
							set(view.fov, get(newfov));	
						
						delayedcall(0,dragging());
					  );"
			ondown="copy(drag_currenty,y); copy(drag_stagey,mouse.stagey); dragging();"
			/>


but i still use the horizontal slider UI with " rotate="90" " - may be i should use a vertical graphic version ?

see ya.

z

8

Wednesday, April 4th 2012, 8:36pm

Hi,

when using rotate="90" keep using x and width for the slider_grip with the exception for 'mouse.stagey',

the slider_grip is a child from the rotated slider_bg element and so it's own child coordinate system is still unrotated,

best regards,
Klaus

9

Thursday, April 5th 2012, 8:35pm

Hi,

ok i got it *thumbsup*

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
		<plugin name="slider_bg" url="gfx/slider_backgroundv.png" align="bottom" x="220" y="200" handcursor="false" zorder="1" parent="stage"/>
	
	<plugin name="slider_grip" url="gfx/slider_grip.png" align="top" edge="center" parent="slider_bg" y="0" zorder="2" 
			dragging="if(pressed, 
						sub(dy, mouse.stagey, drag_stagey); 
						add(newy, drag_currenty, dy); 
						if(newy LT 0, set(newy,0));
						if(newy GT plugin[slider_bg].pixelheight, copy(newy,plugin[slider_bg].pixelheight));
						copy(y,newy);
						div(val, newy, plugin[slider_bg].pixelheight);
						
							sub(fovrange, view.fovmax, view.fovmin);
							mul(newfov, val, fovrange);
							add(newfov, view.fovmin);
							set(view.fov, get(newfov));	
						
						delayedcall(0,dragging());
					  );"
			ondown="copy(drag_currenty,y); copy(drag_stagey,mouse.stagey); dragging();"
			/>



but i'm using a vertical slider graphic instead of rotating the horizontal slider graphic .


thanks

z

This post has been edited 2 times, last edit by "zadda" (Apr 12th 2012, 10:47am)


10

Friday, November 30th 2012, 6:41pm

Inverting the vertical direction

Hi Guys, I also accomplished the transition to vertical slider, but it only works when you drag from top to bottom... I would prefer dragging UP but can not figure out how to invert the drag motion.
Any help?
Thanks
AA