Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #83 from pchen66/dev
Browse files Browse the repository at this point in the history
r9
  • Loading branch information
pchen66 authored Jul 8, 2017
2 parents f7d4262 + 21fda36 commit 17c67e3
Show file tree
Hide file tree
Showing 59 changed files with 519 additions and 120 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ All attributes are optional
autoReticleSelect: true, // Auto select a clickable target after dwellTime
viewIndicator: false, // Adds an angle view indicator in upper left corner
indicatorSize: 30, // Size of View Indicator
output: 'console' // Whether and where to output infospot position. Could be 'console' or 'overlay'
output: 'console' // Whether and where to output infospot position. Could be 'console' or 'overlay'
});
</script>
```
Expand Down
58 changes: 54 additions & 4 deletions build/panolens-offline.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions build/panolens-offline.min.js

Large diffs are not rendered by default.

58 changes: 54 additions & 4 deletions build/panolens.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @namespace PANOLENS
*/

var PANOLENS = { REVISION: '8' };
var PANOLENS = { REVISION: '9' };
;/*! npm.im/iphone-inline-video 2.2.2 */
var enableInlineVideo=function(){"use strict";/*! npm.im/intervalometer */
function e(e,i,n,r){function t(n){d=i(t,r),e(n-(a||n)),a=n}var d,a;return{start:function(){d||t(0)},stop:function(){n(d),d=null,a=0}}}function i(i){return e(i,requestAnimationFrame,cancelAnimationFrame)}function n(e,i,n){function r(r){n&&!n(e,i)||r.stopImmediatePropagation()}return e.addEventListener(i,r),r}function r(e,i,n,r){function t(){return n[i]}function d(e){n[i]=e}r&&d(e[i]),Object.defineProperty(e,i,{get:t,set:d})}function t(e,i,n){n.addEventListener(i,function(){return e.dispatchEvent(new Event(i))})}function d(e,i){Promise.resolve().then(function(){e.dispatchEvent(new Event(i))})}function a(e){var i=new Audio;return t(e,"play",i),t(e,"playing",i),t(e,"pause",i),i.crossOrigin=e.crossOrigin,i.src=e.src||e.currentSrc||"data:",i}function u(e,i,n){(m||0)+200<Date.now()&&(e[h]=!0,m=Date.now()),n||(e.currentTime=i),k[++T%3]=100*i|0}function o(e){return e.driver.currentTime>=e.video.duration}function s(e){var i=this;i.video.readyState>=i.video.HAVE_FUTURE_DATA?(i.hasAudio||(i.driver.currentTime=i.video.currentTime+e*i.video.playbackRate/1e3,i.video.loop&&o(i)&&(i.driver.currentTime=0)),u(i.video,i.driver.currentTime)):i.video.networkState===i.video.NETWORK_IDLE&&0===i.video.buffered.length&&i.video.load(),i.video.ended&&(delete i.video[h],i.video.pause(!0))}function c(){var e=this,i=e[g];if(e.webkitDisplayingFullscreen)return void e[E]();"data:"!==i.driver.src&&i.driver.src!==e.src&&(u(e,0,!0),i.driver.src=e.src),e.paused&&(i.paused=!1,0===e.buffered.length&&e.load(),i.driver.play(),i.updater.start(),i.hasAudio||(d(e,"play"),i.video.readyState>=i.video.HAVE_ENOUGH_DATA&&d(e,"playing")))}function v(e){var i=this,n=i[g];n.driver.pause(),n.updater.stop(),i.webkitDisplayingFullscreen&&i[w](),n.paused&&!e||(n.paused=!0,n.hasAudio||d(i,"pause"),i.ended&&!i.webkitDisplayingFullscreen&&(i[h]=!0,d(i,"ended")))}function p(e,n){var r={};e[g]=r,r.paused=!0,r.hasAudio=n,r.video=e,r.updater=i(s.bind(r)),n?r.driver=a(e):(e.addEventListener("canplay",function(){e.paused||d(e,"playing")}),r.driver={src:e.src||e.currentSrc||"data:",muted:!0,paused:!0,pause:function(){r.driver.paused=!0},play:function(){r.driver.paused=!1,o(r)&&u(e,0)},get ended(){return o(r)}}),e.addEventListener("emptied",function(){var i=!r.driver.src||"data:"===r.driver.src;r.driver.src&&r.driver.src!==e.src&&(u(e,0,!0),r.driver.src=e.src,i||!n&&e.autoplay?r.driver.play():r.updater.stop())},!1),e.addEventListener("webkitbeginfullscreen",function(){e.paused?n&&0===r.driver.buffered.length&&r.driver.load():(e.pause(),e[E]())}),n&&(e.addEventListener("webkitendfullscreen",function(){r.driver.currentTime=e.currentTime}),e.addEventListener("seeking",function(){k.indexOf(100*e.currentTime|0)<0&&(r.driver.currentTime=e.currentTime)}))}function l(e){var i=e[h];return delete e[h],!e.webkitDisplayingFullscreen&&!i}function f(e){var i=e[g];e[E]=e.play,e[w]=e.pause,e.play=c,e.pause=v,r(e,"paused",i.driver),r(e,"muted",i.driver,!0),r(e,"playbackRate",i.driver,!0),r(e,"ended",i.driver),r(e,"loop",i.driver,!0),n(e,"seeking",function(e){return!e.webkitDisplayingFullscreen}),n(e,"seeked",function(e){return!e.webkitDisplayingFullscreen}),n(e,"timeupdate",l),n(e,"ended",l)}function y(e,i){if(void 0===i&&(i={}),!e[g]){if(!i.everywhere){if(!b)return;if(!(i.iPad||i.ipad?/iPhone|iPod|iPad/:/iPhone|iPod/).test(navigator.userAgent))return}e.pause();var n=e.autoplay;e.autoplay=!1,p(e,!e.muted),f(e),e.classList.add("IIV"),e.muted&&n&&(e.play(),e.addEventListener("playing",function i(){e.autoplay=!0,e.removeEventListener("playing",i)})),/iPhone|iPod|iPad/.test(navigator.platform)||console.warn("iphone-inline-video is not guaranteed to work in emulated environments")}}var m,b="object"==typeof document&&"object-fit"in document.head.style&&!matchMedia("(-webkit-video-playable-inline)").matches,g="bfred-it:iphone-inline-video",h="bfred-it:iphone-inline-video:event",E="bfred-it:iphone-inline-video:nativeplay",w="bfred-it:iphone-inline-video:nativepause",k=[],T=0;return y}();
Expand Down Expand Up @@ -2827,6 +2827,8 @@ PANOLENS.StereographicShader = {
this.material.side = THREE.DoubleSide;
this.material.visible = false;

this.scale.x *= -1;

this.infospotAnimation = new TWEEN.Tween( this ).to( {}, this.animationDuration / 2 );

this.addEventListener( 'load', this.fadeIn.bind( this ) );
Expand All @@ -2843,11 +2845,13 @@ PANOLENS.StereographicShader = {

/**
* Adding an object
* To counter the scale.x = -1, it will automatically add an
* empty object with inverted scale on x
* @param {THREE.Object3D} object - The object to be added
*/
PANOLENS.Panorama.prototype.add = function ( object ) {

var scope;
var scope, invertedObject;

scope = this;

Expand All @@ -2866,6 +2870,8 @@ PANOLENS.StereographicShader = {
// In case of infospots
if ( object instanceof PANOLENS.Infospot ) {

invertedObject = object;

if ( object.dispatchEvent ) {

this.container && object.dispatchEvent( { type: 'panolens-container', container: this.container } );
Expand All @@ -2885,9 +2891,17 @@ PANOLENS.StereographicShader = {
} } );
}

} else {

// Counter scale.x = -1 effect
invertedObject = new THREE.Object3D();
invertedObject.scale.x = -1;
invertedObject.scalePlaceHolder = true;
invertedObject.add( object );

}

THREE.Object3D.prototype.add.call( this, object );
THREE.Object3D.prototype.add.call( this, invertedObject );

};

Expand Down Expand Up @@ -8117,6 +8131,8 @@ PANOLENS.StereographicShader = {
vptc = this.panorama.getWorldPosition().sub( this.camera.getWorldPosition() );

hv = vector.clone();
// Scale effect
hv.x *= -1;
hv.add( vptc ).normalize();
vv = hv.clone();

Expand Down Expand Up @@ -8155,6 +8171,39 @@ PANOLENS.StereographicShader = {

};

/**
* Tween control looking center by object
* @param {THREE.Object3D} object - Object to be looked at the center
* @param {number} [duration=1000] - Duration to tween
* @param {function} [easing=TWEEN.Easing.Exponential.Out] - Easing function
*/
PANOLENS.Viewer.prototype.tweenControlCenterByObject = function ( object, duration, easing ) {

var isUnderScalePlaceHolder = false;

object.traverseAncestors( function ( ancestor ) {

if ( ancestor.scalePlaceHolder ) {

isUnderScalePlaceHolder = true;

}
} );

if ( isUnderScalePlaceHolder ) {

var invertXVector = new THREE.Vector3( -1, 1, 1 );

this.tweenControlCenter( object.getWorldPosition().multiply( invertXVector ), duration, easing );

} else {

this.tweenControlCenter( object.getWorldPosition(), duration, easing );

}

};

/**
* This is called when window size is changed
* @fires PANOLENS.Viewer#window-resize
Expand Down Expand Up @@ -8241,8 +8290,9 @@ PANOLENS.StereographicShader = {
point = intersects[0].point;
panoramaWorldPosition = this.panorama.getWorldPosition();

// Panorama is scaled -1 on X axis
outputPosition = new THREE.Vector3(
(point.x - panoramaWorldPosition.x).toFixed(2),
-(point.x - panoramaWorldPosition.x).toFixed(2),
(point.y - panoramaWorldPosition.y).toFixed(2),
(point.z - panoramaWorldPosition.z).toFixed(2)
);
Expand Down
10 changes: 5 additions & 5 deletions build/panolens.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/Constants.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/PANOLENS.BasicPanorama.html
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/PANOLENS.CubePanorama.html
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/PANOLENS.EmptyPanorama.html
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
40 changes: 2 additions & 38 deletions docs/PANOLENS.GoogleStreetviewPanorama.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h2>

<hr>
<dt>
<h4 class="name" id="GoogleStreetviewPanorama"><span class="type-signature"></span>new GoogleStreetviewPanorama(panoId, apiKey [, radius])</h4>
<h4 class="name" id="GoogleStreetviewPanorama"><span class="type-signature"></span>new GoogleStreetviewPanorama(panoId [, radius])</h4>


</dt>
Expand Down Expand Up @@ -183,42 +183,6 @@ <h5>Parameters:</h5>



<tr>

<td class="name"><code>apiKey</code></td>


<td class="type">


<span class="param-type">string</span>




</td>


<td class="attributes">





</td>



<td class="default">

</td>


<td class="description last">Google Map api key (@Link https://developers.google.com/maps/documentation/javascript/get-api-key)</td>
</tr>



<tr>

<td class="name"><code>radius</code></td>
Expand Down Expand Up @@ -1091,7 +1055,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/PANOLENS.ImageLittlePlanet.html
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/PANOLENS.ImagePanorama.html
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/PANOLENS.Infospot.html
Original file line number Diff line number Diff line change
Expand Up @@ -3816,7 +3816,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/PANOLENS.LittlePlanet.html
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-07-06T17:34:30-07:00
on 2017-07-08T00:16:25-07:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
Loading

0 comments on commit 17c67e3

Please sign in to comment.