Skip to content

Commit

Permalink
Remove deprecated options
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Dec 21, 2024
1 parent 7e42eec commit a28b4c4
Show file tree
Hide file tree
Showing 18 changed files with 17 additions and 267 deletions.
6 changes: 0 additions & 6 deletions packages/core/src/Viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ import {
* Photo Sphere Viewer controller
*/
export class Viewer extends TypedEventTarget<ViewerEvents> {
/**
* Change the order in which the panoData and sphereCorrection angles are applied from 'ZXY' to 'YXZ'
* @deprecated Will be removed in version 5.12
*/
static useNewAnglesOrder = true;

readonly state: ViewerState;
readonly config: ParsedViewerConfig;

Expand Down
28 changes: 1 addition & 27 deletions packages/core/src/adapters/EquirectangularAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,13 @@ import type { Viewer } from '../Viewer';
import { SPHERE_RADIUS } from '../data/constants';
import { SYSTEM } from '../data/system';
import { EquirectangularPanorama, PanoData, PanoDataProvider, PanoramaPosition, Position, TextureData } from '../model';
import { createTexture, getConfigParser, getXMPValue, isNil, logWarn, mergePanoData } from '../utils';
import { createTexture, getConfigParser, getXMPValue, isNil, mergePanoData } from '../utils';
import { AbstractAdapter } from './AbstractAdapter';

/**
* Configuration for {@link EquirectangularAdapter}
*/
export type EquirectangularAdapterConfig = {
/**
* @deprecated Use CSS to change the background color of '.psv-canvas'
*/
backgroundColor?: string;
/**
* @deprecated Not supported anymore
*/
interpolateBackground?: boolean;
/**
* number of faces of the sphere geometry, higher values may decrease performances
* @default 64
Expand All @@ -41,8 +33,6 @@ export type EquirectangularTextureData = TextureData<Texture, string | Equirecta

const getConfig = getConfigParser<EquirectangularAdapterConfig>(
{
backgroundColor: null,
interpolateBackground: false,
resolution: 64,
useXmpData: true,
blur: false,
Expand All @@ -54,18 +44,6 @@ const getConfig = getConfigParser<EquirectangularAdapterConfig>(
}
return resolution;
},
backgroundColor: (backgroundColor) => {
if (backgroundColor) {
logWarn(`EquirectangularAdapter.backgroundColor is deprecated, use 'canvasBackground' main option instead.`);
}
return backgroundColor;
},
interpolateBackground: (interpolateBackground) => {
if (interpolateBackground) {
logWarn(`EquirectangularAdapter.interpolateBackground is not supported anymore.`);
}
return false;
},
},
);

Expand All @@ -91,10 +69,6 @@ export class EquirectangularAdapter extends AbstractAdapter<string | Equirectang

this.SPHERE_SEGMENTS = this.config.resolution;
this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;

if (this.config.backgroundColor) {
viewer.config.canvasBackground = config.backgroundColor;
}
}

override supportsTransition() {
Expand Down
10 changes: 0 additions & 10 deletions packages/core/src/components/Overlay.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { CAPTURE_EVENTS_CLASS, KEY_CODES } from '../data/constants';
import { HideOverlayEvent, KeypressEvent, ShowOverlayEvent } from '../events';
import { PSVError } from '../PSVError';
import { logWarn } from '../utils';
import type { Viewer } from '../Viewer';
import { AbstractComponent } from './AbstractComponent';

Expand All @@ -25,10 +24,6 @@ export type OverlayConfig = {
* secondary message
*/
text?: string;
/**
* @deprecated Use `dismissible`
*/
dissmisable?: boolean;
/**
* if the user can hide the overlay by clicking
* @default true
Expand Down Expand Up @@ -128,11 +123,6 @@ export class Overlay extends AbstractComponent {
config = { title: config };
}

if ('dissmisable' in config) {
logWarn('Replace "dissmisable" by "dismissible"');
config.dismissible = config.dissmisable;
}

this.state.contentId = config.id || null;
this.state.dismissible = config.dismissible !== false;
this.image.innerHTML = config.image || '';
Expand Down
14 changes: 0 additions & 14 deletions packages/core/src/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ export const CONFIG_PARSERS: ConfigParsers<ViewerConfig, ParsedViewerConfig> = {
if (!(adapter[0] as any).id) {
throw new PSVError(`Adapter has no id.`);
}
if ((adapter[0] as any).id === 'little-planet') {
logWarn('LittlePlanetAdapter support has been removed, use `{ fisheye: 2, maxFov: 130 }` to achieve similar effect.');
adapter = defValue;
}
return adapter;
},
defaultYaw: (defaultYaw) => {
Expand Down Expand Up @@ -172,16 +168,6 @@ export const CONFIG_PARSERS: ConfigParsers<ViewerConfig, ParsedViewerConfig> = {
...lang,
};
},
keyboard: (keyboard) => {
if (!keyboard) {
return false;
}
if (typeof keyboard === 'object') {
logWarn(`Use keyboardActions to configure the keyboard actions, keyboard option must be either true, false, 'fullscreen' or 'always'`);
return 'fullscreen';
}
return keyboard === 'always' ? 'always' : 'fullscreen';
},
keyboardActions: (keyboardActions, { rawConfig }) => {
if (rawConfig.keyboard && typeof rawConfig.keyboard === 'object') {
return rawConfig.keyboard;
Expand Down
10 changes: 2 additions & 8 deletions packages/core/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,7 @@ export type PanoramaOptions = {
* enable transition (rotation + fading) between old and new panorama
* @default true
*/
transition?: boolean | 'fade-only' | TransitionOptions;
/**
* @deprecated Use `transition.speed`
*/
speed?: string | number;
transition?: boolean | TransitionOptions;
/**
* show the loader while loading the new panorama
* @default true
Expand Down Expand Up @@ -384,7 +380,7 @@ export type ViewerConfig = {
/** @default 'zoom move download description caption fullscreen' */
navbar?: boolean | string | Array<string | NavbarCustomButton>;
lang?: Record<string, string>;
keyboard?: boolean | 'always' | 'fullscreen' | Record<string, ACTIONS | ((viewer: Viewer) => void)>;
keyboard?: boolean | 'always' | 'fullscreen';
keyboardActions?: Record<string, ACTIONS | ((viewer: Viewer, e: KeyboardEvent) => void)>;
};

Expand All @@ -401,7 +397,6 @@ export type ParsedViewerConfig = Omit<
| 'fisheye'
| 'requestHeaders'
| 'navbar'
| 'keyboard'
> & {
adapter?: [AdapterConstructor, any];
plugins?: Array<[PluginConstructor, any]>;
Expand All @@ -411,7 +406,6 @@ export type ParsedViewerConfig = Omit<
fisheye?: number;
requestHeaders?: (url: string) => Record<string, string>;
navbar?: Array<string | NavbarCustomButton>;
keyboard?: false | 'always' | 'fullscreen';
};

/**
Expand Down
16 changes: 1 addition & 15 deletions packages/core/src/services/DataHelper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Euler, MathUtils, Vector3 } from 'three';
import { PSVError } from '../PSVError';
import type { Viewer } from '../Viewer';
import { DEFAULTS } from '../data/config';
import { ANIMATION_MIN_DURATION, SPHERE_RADIUS, VIEWER_DATA } from '../data/constants';
import {
ExtendedPosition,
Expand All @@ -19,12 +20,10 @@ import {
getShortestArc,
isExtendedPosition,
isNil,
logWarn,
parseAngle,
speedToDuration,
} from '../utils';
import { AbstractService } from './AbstractService';
import { DEFAULTS } from '../data/config';

const vector3 = new Vector3();
const EULER_ZERO = new Euler(0, 0, 0, 'ZXY');
Expand Down Expand Up @@ -137,12 +136,6 @@ export class DataHelper extends AbstractService {
transition = {
...defaultTransition,
};
} else if (options.transition === 'fade-only') {
logWarn(`PanoramaOptions transition "fade-only" value is deprecated, set transition.rotation=false instead.`);
transition = {
...defaultTransition,
rotation: false,
};
} else if (typeof options.transition === 'object') {
transition = {
...defaultTransition,
Expand All @@ -152,13 +145,6 @@ export class DataHelper extends AbstractService {
transition = this.config.defaultTransition;
}

if ('speed' in options) {
logWarn(`PanoramaOptions speed is deprecated, set transition.speed instead.`);
if (transition) {
transition.speed = options.speed;
}
}

return transition;
}

Expand Down
28 changes: 3 additions & 25 deletions packages/core/src/services/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
TextureData,
TransitionOptions,
} from '../model';
import { Animation, isNil, logWarn } from '../utils';
import { Animation, isNil } from '../utils';
import { Viewer } from '../Viewer';
import { AbstractService } from './AbstractService';

Expand Down Expand Up @@ -296,18 +296,7 @@ export class Renderer extends AbstractService {
*/
setPanoramaPose(panoData: PanoData, mesh: Object3D = this.mesh) {
const cleanCorrection = this.viewer.dataHelper.cleanPanoramaPose(panoData);

const i = (cleanCorrection.pan ? 1 : 0) + (cleanCorrection.tilt ? 1 : 0) + (cleanCorrection.roll ? 1 : 0);
if (!Viewer.useNewAnglesOrder && i > 1) {
logWarn(`'panoData' Euler angles have changed in version 5.11.0.`);
logWarn(`Remove your 'useNewAnglesOrder' override to remove this warning (you might have to adapt your poseHeading/posePitch/poseRoll parameters).`);
}

if (Viewer.useNewAnglesOrder) {
mesh.rotation.set(cleanCorrection.tilt, cleanCorrection.pan, cleanCorrection.roll, 'YXZ');
} else {
mesh.rotation.set(-cleanCorrection.tilt, -cleanCorrection.pan, -cleanCorrection.roll, 'ZXY');
}
mesh.rotation.set(cleanCorrection.tilt, cleanCorrection.pan, cleanCorrection.roll, 'YXZ');
}

/**
Expand All @@ -316,18 +305,7 @@ export class Renderer extends AbstractService {
*/
setSphereCorrection(sphereCorrection: SphereCorrection, group: Object3D = this.meshContainer) {
const cleanCorrection = this.viewer.dataHelper.cleanSphereCorrection(sphereCorrection);

const i = (cleanCorrection.pan ? 1 : 0) + (cleanCorrection.tilt ? 1 : 0) + (cleanCorrection.roll ? 1 : 0);
if (!Viewer.useNewAnglesOrder && i > 1) {
logWarn(`'sphereCorrection' Euler angles have changed in version 5.11.0.`);
logWarn(`Remove your 'useNewAnglesOrder' override to remove this warning (you might have to adapt your poseHeading/posePitch/poseRoll parameters).`);
}

if (Viewer.useNewAnglesOrder) {
group.rotation.set(cleanCorrection.tilt, cleanCorrection.pan, cleanCorrection.roll, 'YXZ');
} else {
group.rotation.set(cleanCorrection.tilt, cleanCorrection.pan, cleanCorrection.roll, 'ZXY');
}
group.rotation.set(cleanCorrection.tilt, cleanCorrection.pan, cleanCorrection.roll, 'YXZ');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ function meshes(group: Group) {
}

const getConfig = utils.getConfigParser<EquirectangularTilesAdapterConfig>({
backgroundColor: null,
resolution: 64,
showErrorTile: true,
baseBlur: true,
Expand Down
11 changes: 0 additions & 11 deletions packages/markers-plugin/src/markers/Marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,6 @@ export abstract class Marker {
throw new PSVError(`cannot change marker ${config.id} type`);
}

if (utils.isExtendedPosition(config)) {
utils.logWarn('Use the "position" property to configure the position of a marker');
config.position = this.viewer.dataHelper.cleanPosition(config);
}

if ('width' in config && 'height' in config) {
utils.logWarn('Use the "size" property to configure the size of a marker');
// @ts-ignore
config.size = { width: config['width'], height: config['height'] };
}

this.config = utils.deepmerge(this.config, config as any);
if (typeof this.config.tooltip === 'string') {
this.config.tooltip = { content: this.config.tooltip };
Expand Down
23 changes: 3 additions & 20 deletions packages/markers-plugin/src/markers/Marker3D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,9 @@ export class Marker3D extends Marker {
this.viewer.dataHelper.sphericalCoordsToVector3(this.state.position, group.position);

group.lookAt(0, group.position.y, 0);
if (this.config.orientation) {
utils.logWarn(`Marker#orientation is deprecated, use "rotation.yaw" or "rotation.pitch" instead`);
mesh.rotateZ(-this.config.rotation.roll);
switch (this.config.orientation) {
case 'horizontal':
group.rotateX(this.state.position.pitch < 0 ? -Math.PI / 2 : Math.PI / 2);
break;
case 'vertical-left':
group.rotateY(-Math.PI * 0.4);
break;
case 'vertical-right':
group.rotateY(Math.PI * 0.4);
break;
// no default
}
} else {
mesh.rotateY(-this.config.rotation.yaw);
mesh.rotateX(-this.config.rotation.pitch);
mesh.rotateZ(-this.config.rotation.roll);
}
mesh.rotateY(-this.config.rotation.yaw);
mesh.rotateX(-this.config.rotation.pitch);
mesh.rotateZ(-this.config.rotation.roll);

const p = mesh.geometry.getAttribute('position');
this.state.positions3D = [0, 1, 3, 2].map((i) => {
Expand Down
4 changes: 0 additions & 4 deletions packages/markers-plugin/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ export type MarkerConfig = {
* Only 3D markers (`imageLayer`, `videoLayer`, `elementLayer`) support `yaw` and `pitch`
*/
rotation?: string | number | { yaw?: number | string; pitch?: number | string; roll?: number | string };
/**
* @deprecated Use `rotation` as an object
*/
orientation?: 'front' | 'horizontal' | 'vertical-left' | 'vertical-right';
/**
* Configures the scale of the marker depending on the zoom level and/or the horizontal offset (ignored for `polygon`, `polyline`, `imageLayer`, `videoLayer`)
*/
Expand Down
18 changes: 0 additions & 18 deletions packages/overlays-plugin/src/OverlaysPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ export class OverlaysPlugin extends AbstractConfigurablePlugin<
throw new PSVError(`Missing overlay "path"`);
}

if (config.type === 'video') {
utils.logWarn('"video" overlay are not supported anymore');
return;
}

const parsedConfig: OverlayConfig = {
id: Math.random().toString(36).substring(2),
opacity: 1,
Expand All @@ -138,14 +133,6 @@ export class OverlaysPlugin extends AbstractConfigurablePlugin<
}
}

/**
* @deprecated
*/
getVideo(_: string): any {
utils.logWarn('"video" overlay are not supported anymore');
return null;
}

/**
* Removes an overlay
*/
Expand Down Expand Up @@ -177,11 +164,6 @@ export class OverlaysPlugin extends AbstractConfigurablePlugin<
* Add a spherical overlay
*/
private async __addSphereImageOverlay(config: SphereOverlayConfig) {
if (config.width || config.height || config.pitch || config.yaw) {
utils.logWarn(`Positionned overlays are not supported anymore`);
return;
}

const currentPanoData = this.viewer.state.textureData.panoData as PanoData;

const adapter = this.__getEquirectangularAdapter();
Expand Down
Loading

0 comments on commit a28b4c4

Please sign in to comment.