Floorplan hotspots: howto react to "ondown"-event?   [SOLVED] - View the solution

This sub-forum is for discussing and reporting bugs on any content that is not available by default in Panotour, so this concerns custom HTML templates, extra plugins (both Kolor-provided and third-party), etc...

Ce sous-forum a été créé pour discuter et/ou rapporter des bugs sur tout contenu qui n'est pas disponible par défaut dans Panotour, donc cela concerne les templates HTML customisés, plugins supplémentaires, etc...
User avatar
360-compunics-com-ni
Member
 
Topic author
Posts: 418
Likes: 15 posts
Liked in: 163 posts
Joined: Wed Dec 17, 2014 12:37 am
Location: León, Nicaragua
Info

Floorplan hotspots: howto react to "ondown"-event?  [SOLVED]

by 360-compunics-com-ni » Mon Apr 17, 2017 1:17 am

There is a special use case that requires all tour navigation to be executed by an "ondown"-event instead of the default "onclick"-event. In other words: the display of a pano shall be initiated when the mouse gets pressed over the navigation element, not when it afterwards gets released.
For buttons and hotpsots this has already been setup, i'm still looking for a way to achieve this for the floorplan hotspots.

This is what i have tried so far (with variations, for example tried an "addEventListener" instead of the "mousedown"):
Code: Select all
<events name="MapspotEvents" keep="true"
   onTourStart="callwhen(ptplugin[floorPlan].jsready, Init_{{plugname}}(); );"
/>

<action name="Init_{{plugname}}">
   {% for group in project.panoGroups %}{% for spot in group.mapFloorPlan.spots %}
      set(LinkedScene, get(ptplugin[floorPlan].floorplanItems[0].floorplanItem[fpitem{{group.tourId}}].spot[{{spot.tourId}}].scene) );
      setOndownEvent( {{spot.tourId}}, get(LinkedScene) );
   {% endfor %}{% endfor %}
</action>

<action name="setOndownEvent" type="Javascript"><![CDATA[
   jQuery('#'%1).mousedown('mainloadscene(%2));');
]]>
</action>

Any help would be greatly appreciated.
Out now: DeviceCheck for PTP plugins! https://www.kolor.com/forum/viewtopic.php?f=40&t=37446

Want to know how clients use your tours? Google Analytics Track Events plugin: http://www.kolor.com/forum/viewtopic.php?f=40&t=34442

Add actions to your hotspots: Hotspot Actionlist plugin: http://www.kolor.com/forum/viewtopic.php?f=40&t=35829

no avatar
Destiny
Moderator
 
Posts: 7882
Likes: 6 posts
Liked in: 227 posts
Joined: Mon Apr 26, 2010 11:55 pm
Location: Australia
Info

Re: Floorplan hotspots: howto react to "ondown"-event?

by Destiny » Mon Apr 17, 2017 3:10 am

Hi.. With Flash, if I were to add an "onclick="onclickspotpoint13" it would act on click.. So by rights it should already work...

Destiny...

User avatar
360-compunics-com-ni
Member
 
Topic author
Posts: 418
Likes: 15 posts
Liked in: 163 posts
Joined: Wed Dec 17, 2014 12:37 am
Location: León, Nicaragua
Info

Re: Floorplan hotspots: howto react to "ondown"-event?

by 360-compunics-com-ni » Tue Apr 25, 2017 7:11 pm

I finally figured out how to solve this issue:

Function definition in "index.html":
Code: Select all
   <script type="text/javascript">
   function setMapspotsOndownEvent(spotDIV)
   {
      var item = document.getElementById(spotDIV);
      item.addEventListener('mousedown', function(){ $('#'+spotDIV).trigger('click');}, false);
   }
   </script>

And the calling code of the plugin:
Code: Select all
<action name="SetMapspotsOndownEvent_{{plugname}}" keep="true">
   {% for group in project.panoGroups %}{% for spot in group.mapFloorPlan.spots %}
      txtadd(thisMapSpot, {{spot.tourId}}, '_img' );
      js( setMapspotsOndownEvent( get(thisMapSpot) ); );
   {% endfor %}{% endfor %}
</action>

This action needs to be called after the floorplan plugin has initialised on tourstart as follows:
Code: Select all
<events name="Events_{{plugname}}"  keep="true"
   onTourStart="callwhen(ptplugin[floorPlan].jsready, SetMapspotsOndownEvent_{{plugname}}(); );">
</events>
Out now: DeviceCheck for PTP plugins! https://www.kolor.com/forum/viewtopic.php?f=40&t=37446

Want to know how clients use your tours? Google Analytics Track Events plugin: http://www.kolor.com/forum/viewtopic.php?f=40&t=34442

Add actions to your hotspots: Hotspot Actionlist plugin: http://www.kolor.com/forum/viewtopic.php?f=40&t=35829

Erik Dreyer likes this post.


Who is online

Users browsing this forum: No registered users and 1 guest