panoramic_no_drag.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <krpano version="1.20.9" title="Virtual Tour">
  2. <!-- <plugin name="pp_light" keep="true"
  3. url="https://dm.static.elab-plus.com/miniProgram/krpano/plugins/pp_light.js"
  4. enabled="true"
  5. exposure="0.0"
  6. lights="1.0"
  7. shadows="5.0"
  8. filterrange="60.0"
  9. masking="1.0"
  10. quality="7"
  11. order="1"
  12. phase="1"
  13. />
  14. <plugin name="pp_sharpen" keep="true"
  15. url="https://dm.static.elab-plus.com/miniProgram/krpano/plugins/pp_sharpen.js"
  16. enabled="true"
  17. strength="5.0"
  18. range="5"
  19. quality="5"
  20. luminanceonly="true"
  21. order="2"
  22. phase="1"
  23. /> -->
  24. <action name="mytest">
  25. screentosphere(mouse.x, mouse.y, toh, tov);
  26. jscall(calc('console.log("'+toh+'")'));
  27. jscall(calc('console.log("'+tov+'")'));
  28. </action>
  29. <events onclick="mytest();" />
  30. <!-- startup action - load the first scene -->
  31. <action name="startup" autorun="onstart">
  32. if(startscene === null OR !scene[get(startscene)], copy(startscene,scene[0].name); );
  33. loadscene(get(startscene), null, MERGE);
  34. if(startactions !== null, startactions() );
  35. </action>
  36. <events onloadcomplete="sceneload"></events>
  37. <action name="sceneload">
  38. jscall('window.sceneload()');
  39. </action>
  40. <scene name="mainScene" onstart="" havevrimage.mobilevr="false" havevrimage.no-mobilevr="true" lat="" lng=""
  41. heading="">
  42. <control bouncinglimits="calc:image.cube ? true : false" />
  43. <view hlookat="50.082" vlookat="12.404" fovtype="MFOV" fov="90.000" maxpixelzoom="4.0" fovmin="70" fovmax="120"
  44. limitview="auto" />
  45. <!-- <preview
  46. url="https://elab-marketing-web.oss-cn-shanghai.aliyuncs.com/fairyMountain/layout/hospital/panos/ceshi.tiles/preview.jpg" /> -->
  47. <image if="!(webvr.isenabled OR device.mobilevr)">
  48. <sphere url="%$panorama_url%" />
  49. </image>
  50. <image if="webvr.isenabled OR device.mobilevr">
  51. <sphere url="%$panorama_url%" />
  52. </image>
  53. <!-- <preview url="test3333.png"/> onloaded.addevent="sceneload();"-->
  54. <hotspot name="video" ath="50.082" atv="14" url="https://dm.static.elab-plus.com/videoplayer.js" videourl=""
  55. width="180" height="320" chromakey="0x238E54|0.294|0.133" preload="true" pausedonstart="false" loop="true"
  56. distorted="true" muted="true" zoom="true" autopause="true" autoresume="true" scale="1"
  57. onvideoready="videoreadyFunc" onvideoplay="videoplayHandle" cursor="grab"
  58. onclick="togglepause();" enabled="false"
  59. ondown.addevent="set(cursor,grabbing);" onup.addevent="set(cursor,grab);" >
  60. </hotspot>
  61. <hotspot name="image_hotspot" ath="50.082" atv="14" rotate="-45.0" zorder="1"
  62. distorted="true" scale="0.5" alpha="0.5"
  63. url="https://dm.static.elab-plus.com/miniProgram/grass.jpg" keep="true"></hotspot>
  64. <action name="mobilescale" autorun="preinit" devices="mobile">
  65. mul(stagescale,0.5);
  66. </action>
  67. <action name="playSceneName">
  68. def(scale, string, get(hotspot[video].scale));
  69. <!-- 打印日志 -->
  70. <!-- showlog(true, top); -->
  71. <!-- 播放视频 -->
  72. hotspot[video].playvideo(%1, '', false);
  73. set(hotspot[video].scale, get(scale));
  74. </action>
  75. <!-- 设置缩放大小 -->
  76. <action name="scaleChange">
  77. set(hotspot[video].scale, %1);
  78. </action>
  79. <!-- 获取缩放大小 -->
  80. <action name="getmyScale">
  81. def(scale, string, get(hotspot[video].scale));
  82. jscall(calc("window.getScaleHandle('"+ get(scale) +"')") );
  83. </action>
  84. <!-- 切换状态播放,暂停 -->
  85. <action name="toggleMute">
  86. set(hotspot[video].muted, %1);
  87. </action>
  88. <!-- 视频初始化完成 -->
  89. <action name="videoreadyFunc">
  90. jscall('window.videoready()');
  91. <!-- set(hotspot[video].scale, 0.3); -->
  92. </action>
  93. <!-- 视频播放 -->
  94. <action name="videoplayHandle">
  95. jscall('window.onvideoplay()');
  96. <!-- set(hotspot[video].scale, 0.3); -->
  97. </action>
  98. <!-- 截图 -->
  99. <action name="makescreenshot_init" type="Javascript" autorun="onstart"><![CDATA[
  100. // count the screenshots (for the filenames)
  101. krpano.makescreenshot_count = 1;
  102. // create an empty Object as makeScreenshot cache
  103. var makeScreenshotCache = {};
  104. // add a 'makescreenshot' action to krpano
  105. krpano.makescreenshot = function(leftX,leftY,screenshotwidth,screenshotheight)
  106. {
  107. // if there is already a screenshot layer, remove it now
  108. console.warn("***makescreenshot***",krpano.webGL,leftX,leftY,screenshotwidth,screenshotheight)
  109. var canvas = krpano.webGL.canvas;
  110. var pix = window.devicePixelRatio;
  111. // make a screenshot as canvas
  112. var sizeinfo = {w:screenshotwidth*pix, h:screenshotheight*pix};
  113. var crop = {
  114. x:leftX*pix,
  115. y:leftY*pix,
  116. w:screenshotwidth*pix,
  117. h:screenshotheight*pix
  118. };
  119. var screenshotcanvas = krpano.webGL.makeScreenshot(
  120. canvas.width,
  121. canvas.height,
  122. true,
  123. "png",
  124. 1.0,
  125. crop,
  126. sizeinfo,
  127. makeScreenshotCache);
  128. if (screenshotcanvas)
  129. {
  130. // var imgBase64 = screenshotcanvas.toDataURL();
  131. var imgBase64 = screenshotcanvas;
  132. screenshot(imgBase64);
  133. function screenshot(imgBase64){
  134. var savecreenshot = window.$config.api_url + 'elab-marketing-file/upload/uploadBase64';
  135. var data = JSON.stringify({
  136. base64Str: imgBase64
  137. })
  138. var request = $.ajax({
  139. type: "POST",
  140. url: savecreenshot,
  141. contentType: 'application/json;charset=UTF-8',
  142. data: data
  143. });
  144. request.done(function(result) {
  145. console.warn("***krpano-request-result****",result)
  146. if (result && result.success) {
  147. let shottingImg = result.single.filePath;
  148. window.show_img(shottingImg);
  149. }
  150. });
  151. request.fail(function(jqXHR, textStatus) {
  152. console.warn("Request failed: " + textStatus);
  153. });
  154. }
  155. }
  156. }
  157. ]]>
  158. </action>
  159. </scene>
  160. </krpano>