photo-sphere-viewer
Advanced tools
Comparing version 4.2.0 to 4.2.1
/*! | ||
* Photo Sphere Viewer 4.2.0 | ||
* Photo Sphere Viewer 4.2.1 | ||
* @copyright 2014-2015 Jérémy Heleine | ||
@@ -4,0 +4,0 @@ * @copyright 2015-2021 Damien "Mistic" Sorel |
/*! | ||
* Photo Sphere Viewer 4.2.0 | ||
* Photo Sphere Viewer 4.2.1 | ||
* @copyright 2014-2015 Jérémy Heleine | ||
@@ -4,0 +4,0 @@ * @copyright 2015-2021 Damien "Mistic" Sorel |
/*! | ||
* Photo Sphere Viewer 4.2.0 | ||
* Photo Sphere Viewer 4.2.1 | ||
* @copyright 2014-2015 Jérémy Heleine | ||
@@ -1310,3 +1310,3 @@ * @copyright 2015-2021 Damien "Mistic" Sorel | ||
* @summary Removes a marker from the viewer | ||
* @param {*} markerOrId | ||
* @param {string} markerId | ||
* @param {boolean} [render=true] - renders the marker immediately | ||
@@ -1316,3 +1316,3 @@ */ | ||
_proto.removeMarker = function removeMarker(markerOrId, render) { | ||
_proto.removeMarker = function removeMarker(markerId, render) { | ||
if (render === void 0) { | ||
@@ -1322,3 +1322,3 @@ render = true; | ||
var marker = this.getMarker(markerOrId); | ||
var marker = this.getMarker(markerId); | ||
@@ -1451,14 +1451,2 @@ if (marker.isNormal()) { | ||
/** | ||
* @summary Toggles the visibility of markers list | ||
*/ | ||
; | ||
_proto.toggleMarkersList = function toggleMarkersList() { | ||
if (this.psv.panel.prop.contentId === MarkersPlugin.ID_PANEL_MARKERS_LIST) { | ||
this.hideMarkersList(); | ||
} else { | ||
this.showMarkersList(); | ||
} | ||
} | ||
/** | ||
* @summary Opens the panel with the content of the marker | ||
@@ -1484,2 +1472,14 @@ * @param {string} markerId | ||
/** | ||
* @summary Toggles the visibility of markers list | ||
*/ | ||
; | ||
_proto.toggleMarkersList = function toggleMarkersList() { | ||
if (this.psv.panel.prop.contentId === MarkersPlugin.ID_PANEL_MARKERS_LIST) { | ||
this.hideMarkersList(); | ||
} else { | ||
this.showMarkersList(); | ||
} | ||
} | ||
/** | ||
* @summary Opens side panel with list of markers | ||
@@ -1959,3 +1959,5 @@ * @fires PSV.plugins.MarkersPlugin.filter:render-markers-list | ||
_proto.__refreshUi = function __refreshUi() { | ||
var nbMarkers = this.getNbMarkers(); | ||
var nbMarkers = Object.values(this.markers).filter(function (m) { | ||
return !m.config.hideList; | ||
}).length; | ||
var markersButton = this.psv.navbar.getButton(MarkersButton.id, false); | ||
@@ -1962,0 +1964,0 @@ var markersListButton = this.psv.navbar.getButton(MarkersListButton.id, false); |
/*! | ||
* Photo Sphere Viewer 4.2.0 | ||
* Photo Sphere Viewer 4.2.1 | ||
* @copyright 2014-2015 Jérémy Heleine | ||
@@ -4,0 +4,0 @@ * @copyright 2015-2021 Damien "Mistic" Sorel |
/*! | ||
* Photo Sphere Viewer 4.2.0 | ||
* Photo Sphere Viewer 4.2.1 | ||
* @copyright 2014-2015 Jérémy Heleine | ||
@@ -4,0 +4,0 @@ * @copyright 2015-2021 Damien "Mistic" Sorel |
/*! | ||
* Photo Sphere Viewer 4.2.0 | ||
* Photo Sphere Viewer 4.2.1 | ||
* @copyright 2014-2015 Jérémy Heleine | ||
@@ -4,0 +4,0 @@ * @copyright 2015-2021 Damien "Mistic" Sorel |
/*! | ||
* Photo Sphere Viewer 4.2.0 | ||
* Photo Sphere Viewer 4.2.1 | ||
* @copyright 2014-2015 Jérémy Heleine | ||
@@ -4,0 +4,0 @@ * @copyright 2015-2021 Damien "Mistic" Sorel |
/*! | ||
* Photo Sphere Viewer 4.2.0 | ||
* Photo Sphere Viewer 4.2.1 | ||
* @copyright 2014-2015 Jérémy Heleine | ||
@@ -4,0 +4,0 @@ * @copyright 2015-2021 Damien "Mistic" Sorel |
{ | ||
"name": "photo-sphere-viewer", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "A JavaScript library to display Photo Sphere panoramas", | ||
@@ -34,3 +34,3 @@ "homepage": "https://photo-sphere-viewer.js.org", | ||
"dependencies": { | ||
"three": "^0.125.2", | ||
"three": "^0.126.0", | ||
"uevent": "~2.0.0" | ||
@@ -44,3 +44,3 @@ }, | ||
"@babel/register": "^7.7.4", | ||
"@csstools/postcss-sass": "^4.0.0", | ||
"@csstools/postcss-sass": "https://github.com/sinankeskin/postcss-sass#master", | ||
"@pixi/jsdoc-template": "^2.5.1", | ||
@@ -54,3 +54,3 @@ "@rollup/plugin-alias": "^3.0.1", | ||
"@vuepress/plugin-google-analytics": "^1.2.0", | ||
"autoprefixer": "^9.7.3", | ||
"autoprefixer": "^10.2.4", | ||
"axios": "^0.21.0", | ||
@@ -65,9 +65,9 @@ "babel-eslint": "^10.0.3", | ||
"live-server": "^1.2.0", | ||
"marked": "^1.0.0", | ||
"marked": "^2.0.0", | ||
"mocha": "^8.0.1", | ||
"ngrok": "^3.2.7", | ||
"node-sass": "^4.13.0", | ||
"nosleep.js": "^0.12.0", | ||
"npm-run-all": "^4.1.3", | ||
"postcss-banner": "^3.0.0", | ||
"postcss": "^8.2.6", | ||
"postcss-banner": "^4.0.0", | ||
"promise-polyfill": "^8.1.3", | ||
@@ -77,3 +77,3 @@ "raw-loader": "^4.0.0", | ||
"rollup-plugin-local-resolve": "^1.0.7", | ||
"rollup-plugin-postcss": "^3.1.0", | ||
"rollup-plugin-postcss": "^4.0.0", | ||
"rollup-plugin-string": "^3.0.0", | ||
@@ -80,0 +80,0 @@ "stylelint": "^13.0.0", |
@@ -98,15 +98,8 @@ import { EVENTS } from '../data/constants'; | ||
* @param {Object|string} config | ||
* @param {string} [config.id] | ||
* @param {string} config.image | ||
* @param {string} config.text | ||
* @param {string} [config.subtext] | ||
* @param {boolean} [config.dissmisable=true] | ||
* @param {string} [config.id] - unique identifier to use with "hide" | ||
* @param {string} config.image - SVG image/icon displayed above the text | ||
* @param {string} config.text - main message | ||
* @param {string} [config.subtext] - secondary message | ||
* @param {boolean} [config.dissmisable=true] - if the user can hide the overlay by clicking | ||
* @fires PSV.show-overlay | ||
* | ||
* @example | ||
* viewer.showOverlay({ | ||
* image: '<svg></svg>', | ||
* text: '....', | ||
* subtext: '....' | ||
* }) | ||
*/ | ||
@@ -113,0 +106,0 @@ show(config) { |
@@ -44,2 +44,3 @@ import { EVENTS } from '../data/constants'; | ||
clickHandler: null, | ||
width : {}, | ||
}; | ||
@@ -132,6 +133,7 @@ | ||
* @param {string|Object} config | ||
* @param {string} [config.id] | ||
* @param {string} config.content | ||
* @param {boolean} [config.noMargin=false] | ||
* @param {Function} [config.clickHandler] | ||
* @param {string} [config.id] - unique identifier to use with "hide" and to store the user desired width | ||
* @param {string} config.content - HTML content of the panel | ||
* @param {boolean} [config.noMargin=false] - remove the default margins | ||
* @param {string} [config.width] - initial width, if not specified the default width will be used | ||
* @param {Function} [config.clickHandler] - called when the user clicks inside the panel | ||
* @fires PSV.open-panel | ||
@@ -152,2 +154,12 @@ */ | ||
if (config.id && this.prop.width[config.id]) { | ||
this.container.style.width = this.prop.width[config.id]; | ||
} | ||
else if (config.width) { | ||
this.container.style.width = config.width; | ||
} | ||
else { | ||
this.container.style.width = null; | ||
} | ||
this.content.innerHTML = config.content; | ||
@@ -267,5 +279,10 @@ this.content.scrollTop = 0; | ||
const y = evt.clientY; | ||
const width = Math.max(PANEL_MIN_WIDTH, this.container.offsetWidth - (x - this.prop.mouseX)) + 'px'; | ||
this.container.style.width = Math.max(PANEL_MIN_WIDTH, this.container.offsetWidth - (x - this.prop.mouseX)) + 'px'; | ||
if (this.prop.contentId) { | ||
this.prop.width[this.prop.contentId] = width; | ||
} | ||
this.container.style.width = width; | ||
this.prop.mouseX = x; | ||
@@ -272,0 +289,0 @@ this.prop.mouseY = y; |
@@ -25,2 +25,3 @@ import { PSVError } from '../PSVError'; | ||
sphereCorrection : null, | ||
sphereCorrectionReorder: false, | ||
moveSpeed : 1, | ||
@@ -27,0 +28,0 @@ zoomButtonIncrement: 2, |
@@ -369,7 +369,7 @@ import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from 'photo-sphere-viewer'; | ||
* @summary Removes a marker from the viewer | ||
* @param {*} markerOrId | ||
* @param {string} markerId | ||
* @param {boolean} [render=true] - renders the marker immediately | ||
*/ | ||
removeMarker(markerOrId, render = true) { | ||
const marker = this.getMarker(markerOrId); | ||
removeMarker(markerId, render = true) { | ||
const marker = this.getMarker(markerId); | ||
@@ -483,14 +483,2 @@ if (marker.isNormal()) { | ||
/** | ||
* @summary Toggles the visibility of markers list | ||
*/ | ||
toggleMarkersList() { | ||
if (this.psv.panel.prop.contentId === MarkersPlugin.ID_PANEL_MARKERS_LIST) { | ||
this.hideMarkersList(); | ||
} | ||
else { | ||
this.showMarkersList(); | ||
} | ||
} | ||
/** | ||
* @summary Opens the panel with the content of the marker | ||
@@ -514,2 +502,14 @@ * @param {string} markerId | ||
/** | ||
* @summary Toggles the visibility of markers list | ||
*/ | ||
toggleMarkersList() { | ||
if (this.psv.panel.prop.contentId === MarkersPlugin.ID_PANEL_MARKERS_LIST) { | ||
this.hideMarkersList(); | ||
} | ||
else { | ||
this.showMarkersList(); | ||
} | ||
} | ||
/** | ||
* @summary Opens side panel with list of markers | ||
@@ -979,3 +979,3 @@ * @fires PSV.plugins.MarkersPlugin.filter:render-markers-list | ||
__refreshUi() { | ||
const nbMarkers = this.getNbMarkers(); | ||
const nbMarkers = Object.values(this.markers).filter(m => !m.config.hideList).length; | ||
const markersButton = this.psv.navbar.getButton(MarkersButton.id, false); | ||
@@ -982,0 +982,0 @@ const markersListButton = this.psv.navbar.getButton(MarkersListButton.id, false); |
@@ -148,3 +148,3 @@ import * as THREE from 'three'; | ||
const intersects = this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children); | ||
const intersects = this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children, true); | ||
@@ -151,0 +151,0 @@ if (intersects.length === 1) { |
@@ -56,2 +56,9 @@ import * as THREE from 'three'; | ||
/** | ||
* @member {external:THREE.Group} | ||
* @readonly | ||
* @private | ||
*/ | ||
this.meshContainer = null; | ||
/** | ||
* @member {external:THREE.Raycaster} | ||
@@ -109,2 +116,3 @@ * @readonly | ||
delete this.mesh; | ||
delete this.meshContainer; | ||
delete this.raycaster; | ||
@@ -207,9 +215,8 @@ | ||
/** | ||
* @summary Apply a SphereCorrection to a Mesh | ||
* @summary Apply a panorama data pose to a Mesh | ||
* @param {PSV.PanoData} [panoData] | ||
* @param {PSV.SphereCorrection} [sphereCorrection] | ||
* @param {external:THREE.Mesh} [mesh=this.mesh] | ||
* @package | ||
*/ | ||
setSphereCorrection(panoData, sphereCorrection, mesh = this.mesh) { | ||
setPanoramaPose(panoData, mesh = this.mesh) { | ||
if (!isNil(panoData?.poseHeading) || !isNil(panoData?.posePitch) || !isNil(panoData?.poseRoll)) { | ||
@@ -224,14 +231,31 @@ // By Google documentation the angles are applied on the camera in order : heading, pitch, roll | ||
); | ||
} | ||
else { | ||
mesh.rotation.set(0, 0, 0); | ||
} | ||
} | ||
if (sphereCorrection) { | ||
logWarn('sphereCorrection was ignored because panoData already contains pose angles.'); | ||
} | ||
} | ||
else if (sphereCorrection) { | ||
/** | ||
* @summary Apply a SphereCorrection to a Mesh | ||
* @param {PSV.SphereCorrection} [sphereCorrection] | ||
* @param {external:THREE.Mesh} [mesh=this.meshContainer] | ||
* @package | ||
*/ | ||
setSphereCorrection(sphereCorrection, mesh = this.meshContainer) { | ||
if (sphereCorrection) { | ||
const cleanCorrection = this.psv.dataHelper.cleanSphereCorrection(sphereCorrection); | ||
if (!this.config.sphereCorrectionReorder) { | ||
const nonZeros = (cleanCorrection.tilt !== 0) + (cleanCorrection.pan !== 0) + (cleanCorrection.roll !== 0); | ||
if (nonZeros > 1) { | ||
logWarn(`"sphereCorrection" computation will change in a future version. | ||
Please set "sphereCorrectionReorder: true" and modify your correction accordingly.`); | ||
} | ||
} | ||
mesh.rotation.set( | ||
cleanCorrection.tilt, | ||
cleanCorrection.pan, | ||
cleanCorrection.roll | ||
cleanCorrection.roll, | ||
this.config.sphereCorrectionReorder ? 'ZXY' : 'XYZ' | ||
); | ||
@@ -268,3 +292,5 @@ } | ||
this.scene.add(this.mesh); | ||
this.meshContainer = new THREE.Group(); | ||
this.meshContainer.add(this.mesh); | ||
this.scene.add(this.meshContainer); | ||
@@ -332,2 +358,3 @@ // create canvas container | ||
const group = new THREE.Group(); | ||
let mesh; | ||
@@ -356,3 +383,4 @@ | ||
this.setSphereCorrection(panoData, options.sphereCorrection, mesh); | ||
this.setPanoramaPose(panoData, mesh); | ||
this.setSphereCorrection(options.sphereCorrection, group); | ||
} | ||
@@ -366,7 +394,7 @@ | ||
const verticalAxis = new THREE.Vector3(0, 1, 0); | ||
mesh.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - this.prop.position.longitude); | ||
group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - this.prop.position.longitude); | ||
// Latitude rotation along the camera horizontal axis | ||
const horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.camera.getWorldDirection(new THREE.Vector3())).normalize(); | ||
mesh.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - this.prop.position.latitude); | ||
group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - this.prop.position.latitude); | ||
@@ -381,3 +409,4 @@ // TODO: find a better way to handle ranges | ||
this.scene.add(mesh); | ||
group.add(mesh); | ||
this.scene.add(group); | ||
this.psv.needsUpdate(); | ||
@@ -412,3 +441,3 @@ | ||
this.setTexture(textureData); | ||
this.scene.remove(mesh); | ||
this.scene.remove(group); | ||
@@ -419,3 +448,4 @@ mesh.geometry.dispose(); | ||
if (!this.prop.isCubemap) { | ||
this.setSphereCorrection(panoData, options.sphereCorrection); | ||
this.setPanoramaPose(panoData); | ||
this.setSphereCorrection(options.sphereCorrection); | ||
} | ||
@@ -422,0 +452,0 @@ |
@@ -503,3 +503,4 @@ import * as THREE from 'three'; | ||
this.renderer.setTexture(textureData); | ||
this.renderer.setSphereCorrection(textureData.panoData, options.sphereCorrection); | ||
this.renderer.setPanoramaPose(textureData.panoData); | ||
this.renderer.setSphereCorrection(options.sphereCorrection); | ||
@@ -564,3 +565,3 @@ if (zoomProvided) { | ||
case 'sphereCorrection': | ||
this.renderer.setSphereCorrection(this.prop.panoData, value); | ||
this.renderer.setSphereCorrection(value); | ||
break; | ||
@@ -567,0 +568,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1370553
21845
+ Addedthree@0.126.1(transitive)
- Removedthree@0.125.2(transitive)
Updatedthree@^0.126.0