40 lines
102 KiB
JavaScript
40 lines
102 KiB
JavaScript
|
/**
|
||
|
* Minified by jsDelivr using Terser v5.14.1.
|
||
|
* Original file: /npm/photo-sphere-viewer@4.7.1/dist/photo-sphere-viewer.js
|
||
|
*
|
||
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||
|
*/
|
||
|
/*!
|
||
|
* Photo Sphere Viewer 4.7.1
|
||
|
* @copyright 2014-2015 Jérémy Heleine
|
||
|
* @copyright 2015-2022 Damien "Mistic" Sorel
|
||
|
* @licence MIT (https://opensource.org/licenses/MIT)
|
||
|
*/
|
||
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three"),require("uevent")):"function"==typeof define&&define.amd?define(["exports","three","uevent"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).PhotoSphereViewer={},t.THREE,t.uEvent)}(this,(function(t,e,o){"use strict";function i(t){this.message=t,"captureStackTrace"in Error?Error.captureStackTrace(this,i):this.stack=(new Error).stack}i.prototype=Object.create(Error.prototype),i.prototype.name="PSVError",i.prototype.constructor=i;var n=function(){function t(t){this.psv=t}var o=t.prototype;return o.destroy=function(){delete this.psv},o.supportsTransition=function(t){return!1},o.supportsPreload=function(t){return!1},o.loadTexture=function(t,e,o){throw new i("loadTexture not implemented")},o.createMesh=function(t){throw new i("createMesh not implemented")},o.setTexture=function(t,e,o){throw new i("setTexture not implemented")},o.setTextureOpacity=function(t,e){throw new i("setTextureOpacity not implemented")},o.disposeTexture=function(t){throw new i("disposeTexture not implemented")},o.setOverlay=function(t,e,o){throw new i("setOverlay not implemented")},t.createOverlayMaterial=function(){var o;return new e.ShaderMaterial({uniforms:(o={},o[t.OVERLAY_UNIFORMS.panorama]={value:new e.Texture},o[t.OVERLAY_UNIFORMS.overlay]={value:new e.Texture},o[t.OVERLAY_UNIFORMS.globalOpacity]={value:1},o[t.OVERLAY_UNIFORMS.overlayOpacity]={value:1},o),vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"\nuniform sampler2D "+t.OVERLAY_UNIFORMS.panorama+";\nuniform sampler2D "+t.OVERLAY_UNIFORMS.overlay+";\nuniform float "+t.OVERLAY_UNIFORMS.globalOpacity+";\nuniform float "+t.OVERLAY_UNIFORMS.overlayOpacity+";\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 tColor1 = texture2D( "+t.OVERLAY_UNIFORMS.panorama+", vUv );\n vec4 tColor2 = texture2D( "+t.OVERLAY_UNIFORMS.overlay+", vUv );\n gl_FragColor = vec4( \n mix( tColor1.rgb, tColor2.rgb, tColor2.a * "+t.OVERLAY_UNIFORMS.overlayOpacity+" ), \n "+t.OVERLAY_UNIFORMS.globalOpacity+"\n );\n}"})},t}();function r(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,o){return e&&r(t.prototype,e),o&&r(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function a(){return a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i])}return t},a.apply(this,arguments)}function c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,h(t,e)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}n.id=null,n.supportsDownload=!1,n.supportsOverlay=!1,n.OVERLAY_UNIFORMS={panorama:"panorama",overlay:"overlay",globalOpacity:"globalOpacity",overlayOpacity:"overlayOpacity"};var p=10,u="photoSphereViewer",d="psvSphere",v={ROTATE_LAT_UP:"rotateLatitudeUp",ROTATE_LAT_DOWN:"rotateLatitudeDown",ROTATE_LONG_RIGHT:"rotateLongitudeRight",ROTATE_LONG_LEFT:"rotateLongitudeLeft",ZOOM_IN:"zoomIn",ZOOM_OUT:"zoomOut",TOGGLE_AUTOROTATE:"toggleAutorotate"},f={AUTOROTATE:"autorotate",BEFORE_RENDER:"before-render",BEFORE_ROTATE:"before-rotate",CLICK:"click",CLOSE_PANEL:"close-panel",CONFIG_CHANGED:"config-changed",DOUBLE_CLICK:"dblclick",FULLSCREEN_UPDATED:"fullscreen-updated",HIDE_NOTIFICATION:"hide-notification",HIDE_OVERLAY:"hide-overlay",HIDE_TOOLTIP:"hide-tooltip",KEY_PRESS:"key-press",LOAD_PROGRESS:"load-progress",OPEN_PANEL:"open-panel",PANORAMA_LOADED:"panorama-loaded",POSITION_UPDATED:"position-updated",READY:"ready",RENDER:"render",SHOW_NOTIFICATION:"show-notification",SHOW_OVERLAY:"show-overlay",SHOW_TOOLTIP:"show-tooltip",SIZE_UPDATED:"size-updated",STOP_ALL:"stop-all",
|
||
|
/**
|
||
|
* @summary Normalize mousewheel values accross browsers
|
||
|
* @memberOf PSV.utils
|
||
|
* @description From Facebook's Fixed Data Table
|
||
|
* {@link https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js}
|
||
|
* @copyright Facebook
|
||
|
* @param {WheelEvent} event
|
||
|
* @returns {{spinX: number, spinY: number, pixelX: number, pixelY: number}}
|
||
|
*/function k(t){var e=0,o=0,i=0,n=0;return"detail"in t&&(o=t.detail),"wheelDelta"in t&&(o=-t.wheelDelta/120),"wheelDeltaY"in t&&(o=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=o,o=0),i=10*e,n=10*o,"deltaY"in t&&(n=t.deltaY),"deltaX"in t&&(i=t.deltaX),(i||n)&&t.deltaMode&&(1===t.deltaMode?(i*=40,n*=40):(i*=800,n*=800)),i&&!e&&(e=i<1?-1:1),n&&!o&&(o=n<1?-1:1),{spinX:e,spinY:o,pixelX:i,pixelY:n}}function D(t,e){var o=t%e;return o<0&&(o+=e),o}function N(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function U(t,e){return[0,2*Math.PI,2*-Math.PI].reduce((function(o,i){var n=e-t+i;return Math.abs(n)<Math.abs(o)?n:o}),1/0)}function H(t,e){return Math.acos(Math.cos(t.latitude)*Math.cos(e.latitude)*Math.cos(t.longitude-e.longitude)+Math.sin(t.latitude)*Math.sin(e.latitude))}function z(t){return t.replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(function(t,e){return(e>0?"-":"")+t.toLowerCase()}))}
|
||
|
/**
|
||
|
* @summary Returns a function, that, when invoked, will only be triggered at most once during a given window of time.
|
||
|
* @memberOf PSV.utils
|
||
|
* @copyright underscore.js - modified by Clément Prévost {@link http://stackoverflow.com/a/27078401}
|
||
|
* @param {Function} func
|
||
|
* @param {number} wait
|
||
|
* @returns {Function}
|
||
|
*/function F(t,e){var o,i,n,r,s=0,a=function(){s=Date.now(),r=void 0,n=t.apply(o,i),r||(o=i=null)};return function(){var c=Date.now();s||(s=c);var h=e-(c-s);return o=this,i=arguments,h<=0||h>e?(r&&(clearTimeout(r),r=void 0),s=c,n=t.apply(o,i),r||(o=i=null)):r||(r=setTimeout(a,h)),n}}function V(t){if("object"==typeof t&&null!==t){if("function"==typeof Object.getPrototypeOf){var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}return"[object Object]"===Object.prototype.toString.call(t)}return!1}
|
||
|
/**
|
||
|
* @summary Merges the enumerable attributes of two objects
|
||
|
* @memberOf PSV.utils
|
||
|
* @description Replaces arrays and alters the target object.
|
||
|
* @copyright Nicholas Fisher <nfisher110@gmail.com>
|
||
|
* @param {Object} target
|
||
|
* @param {Object} src
|
||
|
* @returns {Object} target
|
||
|
*/function W(t,e){var o=e;return function t(e,i){return Array.isArray(i)?(e&&Array.isArray(e)?e.length=0:e=[],i.forEach((function(o,i){e[i]=t(null,o)}))):"object"==typeof i?(e&&!Array.isArray(e)||(e={}),Object.keys(i).forEach((function(n){"object"==typeof i[n]&&i[n]&&V(i[n])?i[n]!=o&&(e[n]?t(e[n],i[n]):e[n]=t(null,i[n])):e[n]=i[n]}))):e=i,e}(t,e)}function Y(t){return W(null,t)}function j(t){return!t||0===Object.keys(t).length&&t.constructor===Object}function Z(t,e){Object.keys(t).forEach((function(o){e(t[o],o)}))}function X(t){return null==t}function B(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];for(var i=0,n=e;i<n.length;i++){var r=n[i];if(!X(r))return r}}function G(t){return"object"==typeof t&&null!=t}function q(t,e){if(t)for(var o=0,i=[["_",t]].concat(Object.entries(t));o<i.length;o++){var n=i[o][1];if(n.prototype instanceof e)return n}return null}function K(){var t=new Error("Loading was aborted.");return t.name="AbortError",t}function Q(t){return"AbortError"===(null==t?void 0:t.name)}function $(t){console.warn("PhotoSphereViewer: "+t)}function J(t){return[["x","y"],["longitude","latitude"]].some((function(e){var o=e[0],i=e[1];return void 0!==t[o]&&void 0!==t[i]}))}function tt(t,e){var o=t.match("<GPano:"+e+">(.*)</GPano:"+e+">");if(null!==o){var i=parseInt(o[1],10);return isNaN(i)?null:i}if(null!==(o=t.match("GPano:"+e+'="(.*?)"'))){var n=parseInt(o[1],10);return isNaN(n)?null:n}return null}var et={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"};function ot(t){if(!t)return{x:.5,y:.5};if("object"==typeof t)return t;var e=t.toLocaleLowerCase().split(" ").slice(0,2);1===e.length&&(e=void 0!==et[e[0]]?[e[0],"center"]:[e[0],e[0]]);var o="left"!==e[1]&&"right"!==e[1]&&"top"!==e[0]&&"bottom"!==e[0];e=e.map((function(t){return et[t]||t})),o||e.reverse();var i=e.join(" ").match(/^([0-9.]+)% ([0-9.]+)%$/);return i?{x:parseFloat(i[1])/100,y:parseFloat(i[2])/100}:{x:.5,y:.5}}var it={0:"left",.5:"center",1:"right"},nt={0:"top",.5:"center",1:"bottom"};function rt(t,e){if(void 0===e&&(e=!0),"string"==typeof t){var o=ot(t);if(!(o.x in it)||!(o.y in nt))throw new i('Unable to parse position "'+t+'"');t=[nt[o.y],it[o.x]]}if(!e&&"center"===t[0]&&"center"===t[1])throw new i('Unable to parse position "center center"');return t}function st(t){var o;if("string"==typeof t){var n=t.toString().trim(),r=parseFloat(n.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),s=n.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();switch(s.match(/(pm|per minute)$/)&&(r/=60),s){case"dpm":case"degrees per minute":case"dps":case"degrees per second":o=e.MathUtils.degToRad(r);break;case"rdpm":case"radians per minute":case"rdps":case"radians per second":o=r;break;case"rpm":case"revolutions per minute":case"rps":case"revolutions per second":o=r*Math.PI*2;break;default:throw new i('Unknown speed unit "'+s+'"')}}else o=t;return o}function at(t,o,n){var r;if(void 0===o&&(o=!1),void 0===n&&(n=o),"string"==typeof t){var s=t.toLowerCase().trim().match(/^(-?[0-9]+(?:\.[0-9]*)?)(.*)$/);if(!s)throw new i('Unknown angle "'+t+'"');var a=parseFloat(s[1]),c=s[2];if(c)switch(c){case"deg":case"degs":r=e.MathUtils.degToRad(a);break;case"rad":case"rads":r=a;break;default:throw new i('Unknown angle unit "'+c+'"')}else r=a}else{if("number"!=typeof t||isNaN(t))throw new i('Unknown angle "'+t+'"');r=t}return r=D(o?r+Math.PI:r,2*Math.PI),o?e.MathUtils.clamp(r-Math.PI,-Math.PI/(n?2:1),Math.PI/(n?2:1)):r}function ct(t){var o=new e.Texture(t);return o.needsUpdate=!0,o.minFilter=e.LinearFilter,o.generateMipmaps=!1,o}var ht=new e.Quaternion;function lt(t,e){ht.setFromEuler(e).invert(),t.applyQuaternion(ht)}var pt=function(){function t(t){var e=this;this.__callbacks=[],t?(t.easing&&"string"!=typeof t.easing||(t.easing=w[t.easing||"linear"]),this.__start=null,this.options=t,t.delay?this.__delayTimeout=setTimeout((function(){e.__delayTimeout=null,e.__animationFrame=window.requestAnimationFrame((function(t){return e.__run(t)}))}),t.delay):this.__animationFrame=window.requestAnimationFrame((function(t){return e.__run(t)}))):this.__resolved=!0}var e=t.p
|
||
|
//# sourceMappingURL=/sm/3711cd16151c12d984aa9d8c7a6d39223b65090654f0d64937f0d9c4005b15a8.map
|