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

Wednesday, February 8th 2023, 11:25am

how to get the width of a textlayer and copy it

dear forummembers

how to read out the width of this textfield see the code below and copy it to it's parent layer[primus]




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
	<style name="leo2"
	keep="false"
	type="text"
	renderer="webgl"		   
	alpha="1"		   
	edge="lefttop"
	capture="false"
	distorted="true"
	css="color:#fff;font-size:14px;"
	padding="4"
	wordwrap="true"
	selectable="false"
	background="false"
	backgroundcolor="0xffffff"
	backgroundalpha="0.7"
	border="false"
	bordercolor="0xFFFFFF"	 
	roundedge="0"
	textshadow="0.5"
	textshadowrange="4.0"
	textshadowangle="45"
	textshadowcolor="0x000000"
	textshadowalpha="1.0"	   />




Source code

1
2
3
4
5
6
			<layer name="subtext" style="leo2"
			html="hier können sie mehr über die[br]
				  mittelalterliche Uferbefestigung erfahren"		 
			parent="layer[primus]"
			align="leftbottom" ox="0"	   
			onclick=""/>

2

Wednesday, February 8th 2023, 12:16pm

Hi,

there are multiple ways:

With version 1.21 this can be done automatically by adding flowchildren="v" (and optionally also a childmargin) to the parent layer. Then the parent layer will take the size of its children:

Source code

1
2
3
<layer type="container" ... flowchildren="v" childmargin="5">
   <layer type="text" ... />
</layer>


Or use the onresize event (also version 1.21) on the inner layer and transfer the size back to the parent (plus optionally some adjustments):

Source code

1
<layer ... onresize="parentobject.width = width + 10;" />


Best regards,
Klaus

3

Wednesday, February 8th 2023, 12:52pm

parentobject in version 1.21

Hello Klaus. can i also read out the lowest layer in a hierarchy and bring this value to the parent.
for example the value from text2 (see code below)


Source code

1
2
3
4
5
6
<layer type="container" ... flowchildren="v" childmargin="5">
   <layer type="img" ... >
   <layer type="vector" ... >
   <layer type="text1" ... >
   <layer type="text2" ... />
</layer></layer></layer>

This post has been edited 1 times, last edit by "nikonutsch" (Feb 8th 2023, 3:51pm)


4

Wednesday, February 8th 2023, 4:24pm

parentobject in version 1.21

dear forummembers

i have had a lot of questions in the last days
svg hotspots , getlooktodistance and now the problem with bringin child value to the parent.

i ll show an example on what i am working.
( i have bought a license for callout hotspots, but ei want to have a bit more control, so i started to try.......)


https://360.tirol/bw/

finaly i want to get the sice of the masklayer depending to its child_parts

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!-- ANFANG_hotspot_3-->	
			<hotspot name="x_sign_3" url="skin/circularhotspots.png" ath="110" atv="-1"  keep="false" onclick="" edge="center" rotate="180" zoom="false" scale="1" capture="false" alpha="1" zorder="99999" width="40" height="40" distorted="false" tweenwidth="160" onloaded="do_crop_animation(64,64,32);" scalechildren="false"/>

			<layer name="circle_dot_3" style="kreis" parent="hotspot[x_sign_3]"   keep="false" onclick="" edge="center" 
			align="center" rotate="0" zoom="false" scale="1" capture="false" alpha="1" zorder="99999" width="10" height="10" distorted="false" onloaded="" />

			<layer name="x_sign_3"
			type="image"
			url="skin/trans2.png"
			keep="false"
			parent="hotspot[x_sign_3]"
			visible="true"
			enabled="true"
			maskchildren="true"
			scalechildren="false"
			zorder="0"
			style=""
			align="center"
			edge="leftbottom"
			ox=""
			oy=""
			rotate="0.0"
			open_width="300"
			width="0"
			height="118"
			scale="1.0"
			alpha="1"
			/>	

			<layer name="x_master_3" style="gerade" 
			width="100" height="4"
			x="2" oy=""
			keep="false" onclick="" 
			edge="leftbottom" align="leftbottom" 
			rotate="-60" zoom="false" scale="1" 
			capture="false" alpha="1" 
			parent="layer[x_sign_3]" 
			distorted="false"/>		

			<layer name="senkrechte_3" style="vertikal" 
			width="6" height="60"
			ox="0" oy="0"
			keep="false" onclick="" 
			edge="center" align="rightcenter" 
			rotate="60" zoom="false" scale="1" 
			capture="false" alpha="1" 
			parent="layer[x_master_3]" 
			distorted="false"/>	

			<layer name="primus_3" style="leo" rotate="180"
			html="Stadtmauer"		 
			parent="layer[senkrechte_3]"
			align="leftbottom" ox="-5" edge="righttop"	   
			onclick=""/>

			<layer name="subtext_3" style="leo2"
			html="weiterlesen...."		 
			parent="layer[primus_3]"
			edge="righttop"	   
			align="rightbottom" ox="0"	   
			onclick=""/>

5

Wednesday, February 8th 2023, 5:14pm

Hello Klaus. can i also read out the lowest layer in a hierarchy and bring this value to the parent.
You could loop through parentobject until it is null, but when you know the hierarchy, it might easier just to use e.g.
parentobject.parentobject.parentobject.width = ...;
to go a certain steps upward...

https://360.tirol/bw/
*thumbup*

finaly i want to get the sice of the masklayer depending to its child_parts
What is the masklayer in this example?

6

Wednesday, February 8th 2023, 6:06pm

onresize="parentobject"

thanks klaus, this works. to jump up in the hirarchy!!!!!!!!!!!!!

parentobject.parentobject.parentobject.width = ...;