Sie sind nicht angemeldet.

1

Mittwoch, 4. November 2020, 14:18

Flying hotspot width relative to stagewidth

Hi,

I'm trying to set the width of a flying hotspot to the stagewidth:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<hotspot name="test"
ath="0" atv="0" 
type="text"
distorted="true"
bgcolor="0x663366"
bgalpha="0.9"
wordwrap="true"
edge="center"
width="1"
zoom="false"
flying="1"
html="bla bla bla..."
onloaded="set(width,get(stagewidth))"
/>


While it does set the width of the hotspot, the results are different among various devices (tested on Chrome on Mac, iPad, Pixel smartphone). Do I have to correct for certain device properties? I tried to find a connection to device.pixelratio, but I couldn't find any.

2

Mittwoch, 4. November 2020, 14:31

I think I found out the problem. A flying hotspot's scale is somehow connected to the stage height. Any ideas how to disconnect them?


Sergey74

Fortgeschrittener

Beiträge: 193

Wohnort: Russia, Chelyabinsk

Beruf: professional noob

  • Nachricht senden

3

Mittwoch, 4. November 2020, 16:34

Do you want to make the hotspot width equal to the stagewidth? Just set the width to 100%
translation difficulties *huh*

4

Mittwoch, 4. November 2020, 19:47

Do you want to make the hotspot width equal to the stagewidth? Just set the width to 100%

That's exactly what I'd like to do, but setting percentages only works on layers. Right?

I dug a little deeper into this forum. 10 years ago, Klaus said:

sorry, but that's not possible yet,
the size of the (distorted) hotspots is always relative to the pano size,
the size of the plugin not,

Is this still the case, Klaus? Can't flying hotspots be sized relative to the stage size?

Sergey74

Fortgeschrittener

Beiträge: 193

Wohnort: Russia, Chelyabinsk

Beruf: professional noob

  • Nachricht senden

5

Donnerstag, 5. November 2020, 04:51

Oh yes, I confused hotspot and layer. Strange, but even event oresize does not work.

Quellcode

1
2
3
4
5
6
<events name="resize_hotspot" onresize="
    trace(stagewidth);
    trace(hotspot[test].width);
    set(hotspot[test].width,get(stagewidth));
    trace(hotspot[test].width);
    "/>
translation difficulties *huh*

6

Donnerstag, 5. November 2020, 10:31

I connected the hotspot size to the stage size like this (btw, I prefer scale over width, so the dimensions remain the same):

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<events keep="true" onresize="size_hotspot()"/>

<action name="size_hotspot">

	copy(hs,hotspot[test]);

	div(stageratio,stageheight,stagewidth);
	div(relativeratio,stagewidth,hs.width);

	if(stageratio GT .8 AND stagewidth GT 900 AND relativeratio GT 1.5,
		set(relativeratio,1.5);
	);

	set(hs.scale,get(relativeratio));

</action>

It kind of works, but it feels quite hacky.



Klaus, can you help me out? Is there a logic behind the flying hotspot sizing? And is it possible to elegantly connect hotspot size to stage size?

Thanks!