You are not logged in.

1

Saturday, March 13th 2021, 2:32pm

Is it possible to construct <style> with <point>?

Hi there!
Would it be possible to create a style for a polygon hotspot with points already?
For example:

<style name="stylename" visible="true" onclick="goto(scene_02);">
<point ath="147" atv="1" />
<point ath="159" atv="1" />
<point ath="159" atv="32" />
</style>

Kind regards
meewee



Fernando

Intermediate

Posts: 330

Location: Habana, Cuba

Occupation: Architect, Photographer.

  • Send private message

2

Saturday, March 13th 2021, 2:46pm

Hi, if you need keep the polygonal hotspot in all scene just add the property keep="true". But you can test your style quickly, I think that yes, it would be work.
Best regards,
Fdo

3

Saturday, March 13th 2021, 3:37pm

Hi Fernando,

thanks for the quick reply.

My question is dictated by the idea of removing the definition of polygonal hotspots from the scene code.


I have already tried to do this, but unfortunately only attributes that are between the "<style>" and "/>" tags have been taken.

"<point>" was not included.

I asked because maybe someone would know a trick.


meewee

aperture147

Beginner

Posts: 17

Location: Vietnam

Occupation: DevOps

  • Send private message

4

Monday, March 15th 2021, 7:05am

I'm afraid that you have to add points manually, luckily with new Krpano we could achieve this really easy by utilizing "onloaded.addevent". Please check this example:

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
<style name="test_poly" fillalpha="0.8" keep="true" onloaded.addevent="add_points">
	<point name="n1" ath="0" atv="0"/>
	<point name="n2" ath="10" atv="10"/>
	<point name="n3" ath="0" atv="20"/>
	<point name="n4" ath="-10" atv="10"/>
</style>

<action name="add_points" scope="local">
	for (set(i, 0), i LT style[test_poly].point.count, inc(i),
    	debugvar(style[test_poly].point[get(i)].ath);
    	copy(caller.point[get(i)].ath, style[test_poly].point[get(i)].ath);
    	copy(caller.point[get(i)].atv, style[test_poly].point[get(i)].atv);
	);

	// delele init point
	set(caller.point[init].name, null);
</action>

<action name="test_startup" autorun="onstart">
	addhotspot('test_hotspot');
	// Must set an init point or the hotspot will never be loaded
	// Could be deleted later
	set(hotspot['test_hotspot'],
    	point[init].ath=500,
    	point[init].atv=400,
	);
	hotspot['test_hotspot'].loadstyle(test_poly);
</action>
KRPano Showcases:
Showcase 1
Showcase 2

This post has been edited 1 times, last edit by "aperture147" (Mar 15th 2021, 7:31am)


5

Monday, March 15th 2021, 10:43pm

Hi aperture147,

thanks for the help.
Looks like a very nice trick.
It doesn't matter that you need to add one point.
It's not much for being able to operate outside the scene code without adding an action with point data. :)

meewee