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

Thursday, December 4th 2014, 9:48pm

Dynamic sizing for image popups. Global 'width' parameter.

Hello all!

I have a number of image layers in my pano, that popup when a certain hotspot is clicked:


<layer name="image1" type="image" url="evidence/01-evidence-lockpicks.jpg" style="popups"/>
<layer name="image2" type="image" url="evidence/02-evidence-toy_aeroplane.jpg" style="popups"/>
etc.

As you can see, they have the common style 'popups' set.

Is it possible within that style to have a width that is set dependant on the stagewidth? I.e. if stagewidth is greater than 1080px then image popup width is 960px, else image popup width is 90%.

I've tried a few things, but haven't got it working. Can image width be set to 'a variable'?

Thanks in advance.

Sam

2

Thursday, December 4th 2014, 10:25pm

Alternatively, perhaps someone could tell me how to alter this code so that it applies to image1, image2, image3 etc. without just duplicating it?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
<events name="image_scale" onresize="image_automatic_fit_inside();" />

<action name="image_automatic_fit_inside">
    if(layer[image1].loaded,
        div(screenaspect, stagewidth, stageheight);
        div(imageaspect, layer[image1].imagewidth, layer[image1].imageheight);
        if(imageaspect GT screenaspect,
            set(layer[image1].width,90%); set(layer[image1].height,prop);
            ,
            set(layer[image1].width,prop); set(layer[image1].height,90%);
        );
    );
</action>

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

3

Monday, December 8th 2014, 1:01pm

use only one image layer changing url for other images and calling image_automatic_fit_inside on loaded-