UNPKG

pano

Version:

Easily add multiple 360-panoramic viewers to a page using Panolens.js

3 lines 2.82 kB
/*! pano.js v1.1.1 | (c) Sinan Bolel & Prescott Prue */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Pano=t():e.Pano=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="/dist/",t(0)}([function(e,t,n){n(1),e.exports=n(1)},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function(){function e(t){if(n(this,e),!t||void 0===("undefined"==typeof t?"undefined":o(t)))throw new Error("No jQuery pattern for panorama container provided.");this.container=t;var i=1*Number(this.container.attributes.width.nodeValue),r=1*Number(this.container.attributes.height.nodeValue),a=r/i,s=a*this.container.parentElement.offsetWidth;this.container.style.setProperty("height",s+"px"),this.config=e.getConfig(t),this.src=this.container.attributes.src.nodeValue,this.pano=new PANOLENS.ImagePanorama(this.src),this.viewer=new PANOLENS.Viewer(this.config)}return i(e,null,[{key:"getConfig",value:function(e){if(!e||"undefined"==typeof e)throw new Error("Pano.Element.getConfig requires a container argument that is a DOM element.");return{container:e,autoHideControlBar:!0,autoHideInfospot:!0,controlBar:!0,controlButtons:["fullscreen","vr"],passiveRendering:!1}}}]),i(e,[{key:"init",value:function(){this.viewer.add(this.pano),this.appendCaption()}},{key:"appendCaption",value:function(){if(this.caption=this.container.attributes.caption.nodeValue,this.caption&&""!==this.caption){var e=document.createElement("em");e.appendChild(document.createTextNode(this.caption)),this.container.appendChild(e)}}}]),e}(),a=function(){function e(t){if(n(this,e),!t||"undefined"==typeof t)throw new Error("No jQuery pattern for panorama container provided.");this.panos=[],this.elements=document.getElementsByTagName("pano");for(var o=0;o<this.elements.length;o++)this.panos.push(new r(this.elements[o]))}return i(e,[{key:"init",value:function(){for(var e=0;e<this.panos.length;e++)this.panos[e].init()}}]),e}(),s={Element:r,Page:a};t.Element=r,t.Page=a,t["default"]=s}])}); //# sourceMappingURL=pano.min.js.map