From f7580bfe5ff12f0342efb8071a72e1a91c283cab Mon Sep 17 00:00:00 2001 From: Oscar Lorentzon Date: Tue, 19 Mar 2019 15:22:27 +0100 Subject: [PATCH] docs: include components and configurations in docs Document bearing and zoom components and include in docs. Include component size enum in public API. --- src/Component.ts | 1 + src/Mapillary.ts | 5 ++++- src/component/BearingComponent.ts | 17 ++++++++++++++++- src/component/interfaces/interfaces.ts | 2 ++ src/component/utils/ComponentSize.ts | 21 +++++++++++++++++++++ src/component/zoom/ZoomComponent.ts | 17 ++++++++++++++++- src/viewer/interfaces/IComponentOptions.ts | 6 ++++-- tsconfig.docs.json | 4 ++++ 8 files changed, 68 insertions(+), 5 deletions(-) diff --git a/src/Component.ts b/src/Component.ts index 3f144be0..1726080b 100644 --- a/src/Component.ts +++ b/src/Component.ts @@ -4,6 +4,7 @@ export {HandlerBase} from "./component/utils/HandlerBase"; export {MeshFactory} from "./component/utils/MeshFactory"; export {MeshScene} from "./component/utils/MeshScene"; export {MouseOperator} from "./component/utils/MouseOperator"; +export {ComponentSize} from "./component/utils/ComponentSize"; export {AttributionComponent} from "./component/AttributionComponent"; export {BackgroundComponent} from "./component/BackgroundComponent"; export {BearingComponent} from "./component/BearingComponent"; diff --git a/src/Mapillary.ts b/src/Mapillary.ts index a2db68ae..2a563efb 100644 --- a/src/Mapillary.ts +++ b/src/Mapillary.ts @@ -14,7 +14,10 @@ export { ImageSize, Viewer, } from "./Viewer"; -export {SliderMode} from "./Component"; +export { + SliderMode, + ComponentSize, +} from "./Component"; import * as TagComponent from "./component/tag/Tag"; export {TagComponent}; diff --git a/src/component/BearingComponent.ts b/src/component/BearingComponent.ts index d5a14a8a..b373b595 100644 --- a/src/component/BearingComponent.ts +++ b/src/component/BearingComponent.ts @@ -6,7 +6,6 @@ import {Observable, Subscription, combineLatest as observableCombineLatest} from import { Component, ComponentService, - IComponentConfiguration, } from "../Component"; import { Spatial, Transform, Geo, @@ -26,6 +25,22 @@ import IBearingConfiguration from "./interfaces/IBearingConfiguration"; import ISize from "../render/interfaces/ISize"; import ComponentSize from "./utils/ComponentSize"; +/** + * @class BearingComponent + * + * @classdesc Component for indicating bearing and field of view. + * + * @example + * ``` + * var viewer = new Mapillary.Viewer( + * "", + * "", + * ""); + * + * var bearingComponent = viewer.getComponent("bearing"); + * bearingComponent.configure({ size: Mapillary.ComponentSize.Small }); + * ``` + */ export class BearingComponent extends Component { public static componentName: string = "bearing"; diff --git a/src/component/interfaces/interfaces.ts b/src/component/interfaces/interfaces.ts index 07f7bb0f..f8e5e74e 100644 --- a/src/component/interfaces/interfaces.ts +++ b/src/component/interfaces/interfaces.ts @@ -1,3 +1,4 @@ +export {IBearingConfiguration} from "./IBearingConfiguration"; export {ICacheConfiguration, ICacheDepth} from "./ICacheConfiguration"; export {CoverState, ICoverConfiguration} from "./ICoverConfiguration"; export {IDirectionConfiguration} from "./IDirectionConfiguration"; @@ -11,6 +12,7 @@ export {IComponentConfiguration} from "./IComponentConfiguration"; export {ISequenceConfiguration} from "./ISequenceConfiguration"; export {ISpatialDataConfiguration} from "./ISpatialDataConfiguration"; export {ITagConfiguration} from "./ITagConfiguration"; +export {IZoomConfiguration} from "./IZoomConfiguration"; export {IShader} from "./IShader"; export * from "../imageplane/interfaces/interfaces"; export * from "../marker/interfaces/interfaces"; diff --git a/src/component/utils/ComponentSize.ts b/src/component/utils/ComponentSize.ts index f15ea173..68292010 100644 --- a/src/component/utils/ComponentSize.ts +++ b/src/component/utils/ComponentSize.ts @@ -1,6 +1,27 @@ +/** + * Enumeration for component size. + * @enum {number} + * @readonly + * @description May be used by a component to allow for resizing + * of the UI elements rendered by the component. + */ export enum ComponentSize { + /** + * Automatic size. The size of the elements will automatically + * change at a predefined threshold. + */ Automatic, + + /** + * Large size. The size of the elements will be fixed until another + * component size is configured. + */ Large, + + /** + * Small size. The size of the elements will be fixed until another + * component size is configured. + */ Small, } diff --git a/src/component/zoom/ZoomComponent.ts b/src/component/zoom/ZoomComponent.ts index b6f321cf..7800a4be 100644 --- a/src/component/zoom/ZoomComponent.ts +++ b/src/component/zoom/ZoomComponent.ts @@ -6,7 +6,6 @@ import * as vd from "virtual-dom"; import { ComponentService, Component, - IComponentConfiguration, } from "../../Component"; import { Transform, @@ -28,6 +27,22 @@ import IZoomConfiguration from "../interfaces/IZoomConfiguration"; import ISize from "../../render/interfaces/ISize"; import ComponentSize from "../utils/ComponentSize"; +/** + * @class ZoomComponent + * + * @classdesc Component rendering UI elements used for zooming. + * + * @example + * ``` + * var viewer = new Mapillary.Viewer( + * "", + * "", + * ""); + * + * var zoomComponent = viewer.getComponent("zoom"); + * zoomComponent.configure({ size: Mapillary.ComponentSize.Small }); + * ``` + */ export class ZoomComponent extends Component { public static componentName: string = "zoom"; diff --git a/src/viewer/interfaces/IComponentOptions.ts b/src/viewer/interfaces/IComponentOptions.ts index 2844ddaf..837da031 100644 --- a/src/viewer/interfaces/IComponentOptions.ts +++ b/src/viewer/interfaces/IComponentOptions.ts @@ -1,4 +1,5 @@ import { + IBearingConfiguration, ICacheConfiguration, IDirectionConfiguration, IKeyboardConfiguration, @@ -9,6 +10,7 @@ import { ISliderConfiguration, ISpatialDataConfiguration, ITagConfiguration, + IZoomConfiguration, } from "../../Component"; /** @@ -36,7 +38,7 @@ export interface IComponentOptions { * * @default true */ - bearing?: boolean; + bearing?: boolean | IBearingConfiguration; /** * Cache images around the current one. @@ -195,7 +197,7 @@ export interface IComponentOptions { * * @default true */ - zoom?: boolean; + zoom?: boolean | IZoomConfiguration; } export default IComponentOptions; diff --git a/tsconfig.docs.json b/tsconfig.docs.json index 88dc28db..37ce2b8f 100644 --- a/tsconfig.docs.json +++ b/tsconfig.docs.json @@ -3,6 +3,7 @@ "files": [ "./src/api/interfaces/IGPano.ts", "./src/api/interfaces/ILatLon.ts", + "./src/component/interfaces/IBearingConfiguration.ts", "./src/component/interfaces/ICacheConfiguration.ts", "./src/component/interfaces/IDirectionConfiguration.ts", "./src/component/interfaces/IKeyboardConfiguration.ts", @@ -13,6 +14,7 @@ "./src/component/interfaces/ISliderConfiguration.ts", "./src/component/interfaces/ISpatialDataConfiguration.ts", "./src/component/interfaces/ITagConfiguration.ts", + "./src/component/interfaces/IZoomConfiguration.ts", "./src/component/keyboard/KeyboardComponent.ts", "./src/component/keyboard/KeyPlayHandler.ts", "./src/component/keyboard/KeySequenceNavigationHandler.ts", @@ -45,7 +47,9 @@ "./src/component/tag/tag/SpotTag.ts", "./src/component/tag/TagComponent.ts", "./src/component/tag/TagMode.ts", + "./src/component/zoom/ZoomComponent.ts", "./src/component/NavigationComponent.ts", + "./src/component/BearingComponent.ts", "./src/error/AbortMapillaryError.ts", "./src/graph/edge/interfaces/IEdge.ts", "./src/graph/edge/interfaces/IEdgeData.ts",