You are not logged in.

1

Wednesday, September 1st 2010, 6:54pm

Fullscreen - how do I detect it and hook an action to it?

So, dumb question, I know if I continue to look in the documentation I will find it somewhere, but I'm wondering how I can scale a plugin when the panorama goes to fullscreen (or, if it is already at fullscreen, to appear scaled already).

Here is the example:

http://iiswebdev.pacific.edu/cms-apps/ma…rtour-forum.asp

When you click on the Map button, the map will appear (I will eventually have little hotspots on it). What I would like, is that if the map is visible and the pano goes fullscreen, for the map to scale up. Or, for the map to be scaled up already if the pano is fullscreen when the Map button is clicked.

Here is my code for the map image and its background:

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
<!-- Map -->
<plugin name="map"
url="../../img/map-large-notext-rotated.png" 
visible="false" 
align="center" 
scale="0.5" 
zorder="6" />

<!-- Map background -->
<plugin name="map-bg" 
url="%SWFPATH%/plugins/textfield.swf" 
html="" 
visible="false" 
align="center" 
zorder="1" 
height="556" 
width="549" 
backgroundcolor="0x000000" 
roundedge="5" 
shadow="1" 
borderwidth="0" 
glow="4" 
alpha="0.5" 
scale="0.5" 
/> 


And for the map button:

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
<!-- Top button - Show Map -->
    <plugin name="map-off" 
        url="../img/button-2-map.png" 
        visible="true" 
        zorder="2" 
        alpha="0.8" 
        blendmode="normal" 
        origin="righttop" 
        x="70"  
        y="4" 
        height="62" 
        width="62" 
        handcursor="true" 
        onclick="action(togglemap);" />
    <plugin name="map-on" 
        url="../img/button-2-map-on.png" 
        visible="false" 
        zorder="2" 
        alpha="0.8" 
        blendmode="normal" 
        origin="righttop" 
        x="70"  
        y="4" 
        height="62" 
        width="62" 
        handcursor="true" 
        onclick="action(togglemap);" />


And the "togglemap" action:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<action name="togglemap">
        set(dontshow, false);
        if( plugin[map].visible == true, 
            set(plugin[map].visible, false); 
            set(plugin[map-off].visible, true);
            set(plugin[map-on].visible, false);
            set(plugin[map-bg].visible, false);
            set(autorotate.enabled,true); 
            set(dontshow, true) 
        );
        if( dontshow == false, 
            set(plugin[map].visible, true); 
            set(plugin[map-off].visible, false);
            set(plugin[map-on].visible, true);
            set(plugin[map-bg].visible, true);
            set(autorotate.enabled,false); 
        );
    </action>


(I know it probably wasn't necessary to post all of that code, but just in the interests of completeness.)

I know the answer is probably painfully obvious, but I am making myself crazy over it.

Thanks

This post has been edited 1 times, last edit by "pan-o-rama" (Sep 1st 2010, 7:09pm)


2

Wednesday, September 1st 2010, 7:55pm

Never mind, got it:

Source code

1
2
3
4
<events 
    onenterfullscreen="set(plugin[map].scale, 1.0);set(plugin[map-bg].scale, 1.0);" 
    onexitfullscreen="set(plugin[map].scale, 0.5);set(plugin[map-bg].scale, 0.5);" 
    />


But now I'm not sure how it will look on different screen sizes. I will try to see if I can scale it to a % of the screen size.

3

Wednesday, September 1st 2010, 11:48pm

I think you can set the width and height values to % values, in which case you shouldn't even need to do anything else. Please let me know if you can't, because my project will require this when I get to the plugin coding part and it's best to avoid nasty surprises *g*

4

Thursday, September 2nd 2010, 6:53pm

I think you can set the width and height values to % values, in which case you shouldn't even need to do anything else. Please let me know if you can't, because my project will require this when I get to the plugin coding part and it's best to avoid nasty surprises *g*


Thanks Protected, I will check it out. What I would really like to do is have it fill the space, but stay a set number of pixels away from the sides. I will tinker with it further.

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

5

Thursday, September 2nd 2010, 6:59pm

if(fullscreen == true , tween(PLUGIN XX.scale,1.3);,tween(PLUGIN XX.scale,1); );

or something...

PLUGIN XX should be: plugin[nameofplugin]

hope i'm right and it helps..

the comma , is the else..

cheers

Tuur *thumbsup*

6

Thursday, September 2nd 2010, 7:01pm

I'm this very moment about to claw my eyes out due to the despair caused by repeatedly attempting and failing to do that (exept I want to set only one dimension and then scale the other according to the original aspect ratio). The % in width/height and "prop" options built into krpano are no good, because they only have in account the plugin's original width and height. My plugin changes sizes, and when that happens, krpano preserves the initial scaling and positioning, which means a huge mess on the panorama.

I'm trying to obtain the viewer size in pixels from within the plugin, but I don't know how I should be doing it, so it's mainly trial and error.

EDIT: Likewise, the scale parameter suggested by Tuur is also no good because the plugin's aspect ratio changes on its own.

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

7

Thursday, September 2nd 2010, 7:05pm

i'm quite sure it works.. make the dots parent/child with the map!!

but you can put all variables to the if and else...

Tuur

it looks like if you got it working..

8

Thursday, September 2nd 2010, 7:14pm

Know of any solution for my problem, Tuur? Ideally I'd need to be able to call a krpano function from within my plugin that tells krpano to recalculate the plugin's dimensions.

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

10

Thursday, September 2nd 2010, 8:37pm

I managed to fix this problem; a rendering problem (see my thread asking for help in the plugins forum) was interfering with the calculations but it is possible to calculate the dimensions from stageWidth and stageHeight, center the plugin but keep the EDGE attribute at lefttop and offset the edge within the plugin itself, since this option doesn't work well (it changes the edge by applying an offset calculated only once, when the plugin is instantiated, and therefore the results are broken once the plugin changes shape).

11

Friday, September 3rd 2010, 10:31am

Hi,

I'm not sure what you want to do,
but when adding an own plugin RESIZE event krpano will not scale the plugin anymore,
it will just pass the new size to the event and then the plugin must handle it's size by itself,
with that you can also set the "width" and "height" attributes to let krpano use them
for positioning but without any automatic scaling,

and about plugin positioning - when you don't set "align" and "edge" to any value, then you can
control the position also by yourself in the plugin code, krpano will not calculate or set the
positions in any way in this case,

best regards,
Klaus

12

Friday, September 3rd 2010, 2:23pm

That's what I'm doing right now and it's working, it's just too bad there isn't a function call from the interface that would reposition the plugin allowing me to make use of the built-in positioning system in changing plugins!

13

Wednesday, September 8th 2010, 11:24am

Hi,
That's what I'm doing right now and it's working, it's just too bad there isn't a function call from the interface that would reposition the plugin allowing me to make use of the built-in positioning system in changing plugins!
but when you have a krpano RESIZE event in your plugin, you should be able to use the krpano positioning system...

best regards,
Klaus