简体   繁体   English

如何在热点上添加点击事件或在mpetroff / pannellum插件中加载图像事件

[英]How to add click event on hotspot or load event of image in mpetroff/pannellum plugin

Can anyone suggest me with a short example that how to bind click event on hotspot and image load event. 谁能用一个简短的示例来建议我,该示例​​如何在热点上绑定点击事件和图像加载事件。 I tried using "clickHandlerFunc" attribute but unable to add click handler on hotspot or image. 我尝试使用“ clickHandlerFunc”属性,但无法在热点或图像上添加点击处理程序。 Please suggest me, with any basic click event using "mpetroff/pannellum" panorma. 对于任何使用“ mpetroff / pannellum”全景图的基本点击事件,请提出建议。 My requirement is to fetch image data on load of image or on click of hotspot. 我的要求是在加载图像或单击热点时获取图像数据。

Thanks! 谢谢!

One suggestion would be to use the scenechange and load API events exposed by Pannellum ( https://pannellum.org/documentation/reference/#api-events ). 一种建议是使用scenechangeload Pannellum公开的API事件( https://pannellum.org/documentation/reference/#api-events )。 I think it would indirectly achieve what you are looking for since they trigger every time a new scene is loaded. 我认为这将间接实现您的期望,因为每次加载新场景时它们都会触发。

scenechange triggers when a scene change is triggered (eg by clicking on a scene hotspot). 当场景更改被触发时(例如,通过单击场景热点), scenechange会触发。 load triggers when a scene has fully loaded (ie all the images have loaded). 当场景已完全加载(即所有图像均已加载)时, load触发。

Here is an example of how this would look. 这是一个看起来如何的示例。

  viewer = pannellum.viewer('panorama', { 
   // Insert your pannellum config here
   });

  viewer.on('scenechange', function (){
   // Insert handler here
  });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM