From f763c2291bd6f0226d8779ad91ef811d427cb580 Mon Sep 17 00:00:00 2001 From: Max Kubik <50140834+mkubdev@users.noreply.github.com> Date: Fri, 18 Nov 2022 23:40:23 +0100 Subject: [PATCH 1/4] fix: display video adaptater on iOS (#784) Update `playinline` to `playInline` to be able to read the panorama on iOS --- src/adapters/shared/AbstractVideoAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapters/shared/AbstractVideoAdapter.js b/src/adapters/shared/AbstractVideoAdapter.js index 3cfb1f98e..accf2dbd8 100644 --- a/src/adapters/shared/AbstractVideoAdapter.js +++ b/src/adapters/shared/AbstractVideoAdapter.js @@ -158,7 +158,7 @@ export class AbstractVideoAdapter extends AbstractAdapter { const video = document.createElement('video'); video.crossOrigin = this.psv.config.withCredentials ? 'use-credentials' : 'anonymous'; video.loop = true; - video.playsinline = true; + video.playsInline = true; video.style.display = 'none'; video.muted = this.config.muted; video.src = src; From 109b53e89efbb0207c1757b3ccd6243bfa1bbe4e Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 27 Nov 2022 11:10:10 +0100 Subject: [PATCH 2/4] Fix #787 markers: add `gotoMarkerSpeed` option --- docs/plugins/plugin-markers.md | 8 +++++++- example/plugin-markers.html | 8 ++++---- src/Viewer.js | 12 ++++++++++-- src/data/constants.js | 8 ++++++++ src/plugins/markers/index.js | 6 ++++-- types/plugins/markers/index.d.ts | 1 + 6 files changed, 34 insertions(+), 9 deletions(-) diff --git a/docs/plugins/plugin-markers.md b/docs/plugins/plugin-markers.md index 971fa1c5c..965462198 100644 --- a/docs/plugins/plugin-markers.md +++ b/docs/plugins/plugin-markers.md @@ -494,6 +494,12 @@ lang: { _Note: this option is not part of the plugin but is merged with the main [`lang`](../guide/config.md#lang) object._ +#### `gotoMarkerSpeed` +- type: `string|number` +- default `'8rpm'` + +Default animation speed for `gotoMarker` method. + #### `clickEventOnMarker` - type: `boolean` - default: `false` @@ -529,7 +535,7 @@ Returns the last marker clicked by the user. Moves the view to face a specific marker. ```js -markersPlugin.gotoMarker('marker-1', 1500) +markersPlugin.gotoMarker('marker-1', '4rpm') .then(() => /* animation complete */); ``` diff --git a/example/plugin-markers.html b/example/plugin-markers.html index c9d7810af..b5cc58436 100644 --- a/example/plugin-markers.html +++ b/example/plugin-markers.html @@ -426,11 +426,11 @@

Lorem ipsum

}); // add markers all hover the sphere - for (let i = 0; i < Math.PI * 2; i += Math.PI / 4) { - for (let j = -Math.PI / 2 + Math.PI / 4; j < Math.PI / 2; j += Math.PI / 4) { + for (let i = 0, k = 1; i < Math.PI * 2; i += Math.PI / 4) { + for (let j = -Math.PI / 2 + Math.PI / 4; j < Math.PI / 2; j += Math.PI / 4, k++) { a.push({ - id : '#' + a.length, - tooltip : '#' + a.length, + id : '#' + k, + tooltip : '#' + k, latitude : j, longitude: i, image : 'assets/pin-red.png', diff --git a/src/Viewer.js b/src/Viewer.js index 02481372e..f8a14c397 100644 --- a/src/Viewer.js +++ b/src/Viewer.js @@ -6,7 +6,15 @@ import { Notification } from './components/Notification'; import { Overlay } from './components/Overlay'; import { Panel } from './components/Panel'; import { CONFIG_PARSERS, DEFAULTS, DEPRECATED_OPTIONS, getConfig, READONLY_OPTIONS } from './data/config'; -import { CHANGE_EVENTS, DEFAULT_TRANSITION, EVENTS, IDS, SPHERE_RADIUS, VIEWER_DATA } from './data/constants'; +import { + ANIMATION_MIN_DURATION, + CHANGE_EVENTS, + DEFAULT_TRANSITION, + EVENTS, + IDS, + SPHERE_RADIUS, + VIEWER_DATA +} from './data/constants'; import { SYSTEM } from './data/system'; import errorIcon from './icons/error.svg'; import { AbstractPlugin } from './plugins/AbstractPlugin'; @@ -877,7 +885,7 @@ export class Viewer extends EventEmitter { this.prop.animationPromise = new Animation({ properties: animProperties, - duration : duration, + duration : Math.max(ANIMATION_MIN_DURATION, duration), easing : 'inOutSine', onTick : (properties) => { if (positionProvided) { diff --git a/src/data/constants.js b/src/data/constants.js index 87b611a57..105167ecb 100644 --- a/src/data/constants.js +++ b/src/data/constants.js @@ -10,6 +10,14 @@ */ export const DEFAULT_TRANSITION = 1500; +/** + * @summary Minimum duration of the animations created with {@link Viewer#animate} + * @memberOf PSV.constants + * @type {number} + * @constant + */ +export const ANIMATION_MIN_DURATION = 500; + /** * @summary Number of pixels bellow which a mouse move will be considered as a click * @memberOf PSV.constants diff --git a/src/plugins/markers/index.js b/src/plugins/markers/index.js index 60ff20420..ade2350d8 100644 --- a/src/plugins/markers/index.js +++ b/src/plugins/markers/index.js @@ -18,6 +18,7 @@ import './style.scss'; /** * @typedef {Object} PSV.plugins.MarkersPlugin.Options * @property {boolean} [clickEventOnMarker=false] If a `click` event is triggered on the viewer additionally to the `select-marker` event. + * @property {string | number} [gotoMarkerSpeed=8rpm] Default animation speed for `gotoMarker` method * @property {PSV.plugins.MarkersPlugin.Properties[]} [markers] */ @@ -82,6 +83,7 @@ export class MarkersPlugin extends AbstractPlugin { */ this.config = { clickEventOnMarker: false, + gotoMarkerSpeed: '8rpm', ...options, }; @@ -438,7 +440,7 @@ export class MarkersPlugin extends AbstractPlugin { * @fires PSV.plugins.MarkersPlugin.goto-marker-done * @return {PSV.utils.Animation} A promise that will be resolved when the animation finishes */ - gotoMarker(markerId, speed) { + gotoMarker(markerId, speed = this.config.gotoMarkerSpeed) { const marker = this.getMarker(markerId); return this.psv.animate({ @@ -560,7 +562,7 @@ export class MarkersPlugin extends AbstractPlugin { this.trigger(EVENTS.SELECT_MARKER_LIST, marker); - this.gotoMarker(marker, 1000); + this.gotoMarker(marker); this.hideMarkersList(); } }, diff --git a/types/plugins/markers/index.d.ts b/types/plugins/markers/index.d.ts index 7aefa69ed..e0b28005d 100644 --- a/types/plugins/markers/index.d.ts +++ b/types/plugins/markers/index.d.ts @@ -61,6 +61,7 @@ export type SelectMarkerData = { export type MarkersPluginOptions = { clickEventOnMarker?: boolean; + gotoMarkerSpeed?: string | number; markers?: MarkerProperties[]; }; From 8793db810cb5e8306b064233f3f9589933e0fbe0 Mon Sep 17 00:00:00 2001 From: Damien SOREL Date: Mon, 5 Dec 2022 13:26:35 +0100 Subject: [PATCH 3/4] doc: use fetch API --- docs/.netlify/functions/announcements.js | 12 +++++------- docs/.netlify/functions/releases.js | 12 +++++------- package.json | 1 - 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/docs/.netlify/functions/announcements.js b/docs/.netlify/functions/announcements.js index 49c583292..08f175c45 100644 --- a/docs/.netlify/functions/announcements.js +++ b/docs/.netlify/functions/announcements.js @@ -1,17 +1,14 @@ -const axios = require('axios'); - exports.handler = async function(event, context) { if (event.httpMethod !== 'GET') { return { statusCode: 405, body: 'Method Not Allowed' }; } - return await axios({ - url : 'https://api.github.com/graphql', + return await fetch('https://api.github.com/graphql', { method : 'POST', headers: { 'Authorization': `bearer ${process.env.GH_TOKEN}`, }, - data : { + body : JSON.stringify({ query: ` query { repository(owner: "mistic100", name: "photo-sphere-viewer") { @@ -27,10 +24,11 @@ exports.handler = async function(event, context) { } } }`, - }, + }), }) + .then(response => response.json()) .then(result => { - const announcements = result.data.data.repository.pinnedDiscussions.nodes.map(n => n.discussion); + const announcements = result.data.repository.pinnedDiscussions.nodes.map(n => n.discussion); return { statusCode: 200, body: JSON.stringify(announcements) diff --git a/docs/.netlify/functions/releases.js b/docs/.netlify/functions/releases.js index 0924bf299..ed01a12d1 100644 --- a/docs/.netlify/functions/releases.js +++ b/docs/.netlify/functions/releases.js @@ -1,17 +1,14 @@ -const axios = require('axios'); - exports.handler = async function(event, context) { if (event.httpMethod !== 'GET') { return { statusCode: 405, body: 'Method Not Allowed' }; } - return await axios({ - url : 'https://api.github.com/graphql', + return await fetch('https://api.github.com/graphql', { method : 'POST', headers: { 'Authorization': `bearer ${process.env.GH_TOKEN}`, }, - data : { + body : JSON.stringify({ query: ` query { repository(owner: "mistic100", name: "photo-sphere-viewer") { @@ -26,10 +23,11 @@ exports.handler = async function(event, context) { } } }`, - }, + }), }) + .then(response => response.json()) .then(result => { - const releases = result.data.data.repository.releases.nodes; + const releases = result.data.repository.releases.nodes; return { statusCode: 200, body: JSON.stringify(releases) diff --git a/package.json b/package.json index 53a4d9279..bc35eae61 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "@vuepress/plugin-back-to-top": "^1.8.2", "@vuepress/plugin-google-analytics": "^1.8.2", "autoprefixer": "^10.3.3", - "axios": "^1.0.0", "cpx2": "^4.1.2", "date-fns": "^2.23.0", "eslint": "^8.2.0", From 981c0a0fc889c8adfafcfd1f658b5c4199a29fc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 11 Dec 2022 17:52:50 +0100 Subject: [PATCH 4/4] build(deps): bump three from 0.146.0 to 0.147.0 (#788) Bumps [three](https://github.com/mrdoob/three.js) from 0.146.0 to 0.147.0. - [Release notes](https://github.com/mrdoob/three.js/releases) - [Commits](https://github.com/mrdoob/three.js/commits) --- updated-dependencies: - dependency-name: three dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc35eae61..3cce01584 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "url": "git://github.com/mistic100/Photo-Sphere-Viewer.git" }, "dependencies": { - "three": "^0.146.0", + "three": "^0.147.0", "uevent": "^2.1.1" }, "devDependencies": {