Sie sind nicht angemeldet.

1

Dienstag, 17. Juni 2014, 13:33

Button > open/close layer [1.17.4]

Hello everyone!
I'm trying to develop a standalone optimized button to open/close various layers on my projects.
Here is the piece of code for a layer containig a floorplan:

Quellcode

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
   	<layer name="closelayer"
    	type="image"
    	url="buttoncloseimage.png"
    	keep="true"
    	visible="true"
    	enabled="true"
    	onhover="showtext(close floorplan);"
       
 onclick="set(layer[floorplan].visible, false); 
set(layer[closelayer].visible, false); set(layer[closelayer].enabled, 
false); set(layer[openlayer].visible, true); 
set(layer[openlayer].enabled, true); "
    	/>
   	 
    	<layer name="openlayer"
    	type="image"
    	url="buttonopenimage.png"
    	keep="true"
    	visible="false"
    	enabled="false"
    	onhover="showtext(open floorplan);"
       
 onclick="set(layer[floorplan].visible, true); 
set(layer[openlayer].visible, false); set(layer[openlayer].enabled, 
false); set(layer[closelayer].visible, true); 
set(layer[closelayer].enabled, true); "
    	/>


The code seems to works fine but I would like to ask you for any suggestion on this regard (better ways / code optimization /...) - I'm working with the 1.17.4 release...
Thanks in advance & best, DL

2

Mittwoch, 18. Juni 2014, 09:44

UP!
Any kind feedback would be greatly appreciated...

3

Mittwoch, 18. Juni 2014, 09:48

Hi,

what exactly do you what 'optimize'?

Best regards,
Klaus

4

Mittwoch, 18. Juni 2014, 09:54

Thanks Klaus,

I would like to know if the code is clean and/or if there is a better way to do the same thing maximizing the compatibility with devices/os/...

Best regards,
DL

5

Mittwoch, 18. Juni 2014, 10:03

Hi,

you are only changing the visibility and enabled state of some elements - that will work everywhere without any problem.

The only thing that will not work everywhere is the 'showtext' call - that's Flash-only.
An alternative solution for tooltips that will work everywhere can be seen in the 'tooltips' example:
http://krpano.com/examples/117/examples/…s/tooltips.html

Best regards,
Klaus

6

Mittwoch, 18. Juni 2014, 10:24

Thanks Klaus,

something that 'will work everywhere without any problem' is exactly what I'm looking for.
I'm going to check the tooltips example you suggested... ;-)

All the best,
DL