-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMPCameraPosition.ts
82 lines (76 loc) · 1.9 KB
/
MPCameraPosition.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import MPPoint from "./MPPoint";
/**
* A camera position object, used to move the camera to a specific position.
*
* @export
* @class MPCameraPosition
* @typedef {MPCameraPosition}
*/
export default class MPCameraPosition {
/**
* Creates an instance of MPCameraPosition.
*
* @constructor
* @private
* @param {number} zoom The zoom level of the camera.
* @param {MPPoint} target The target of the camera.
* @param {number} tilt The camera's tilt value.
* @param {number} bearing The camera's heading.
*/
public constructor(
public readonly zoom: number,
public readonly target: MPPoint,
public readonly tilt: number,
public readonly bearing: number,
) { }
/**
* Creator for MPBuildingCollection, used to decode JSON from the MapsIndoors SDK.
*
* @public
* @static
* @param {MPCameraPositionParams} object
* @returns {MPCameraPosition}
*/
public static create(object: MPCameraPositionParams): MPCameraPosition {
const target = object.target instanceof MPPoint ? object.target : MPPoint.create(object.target);
return new MPCameraPosition(
object?.zoom,
target,
object?.bearing ? object.bearing : 0,
object?.tilt ? object.tilt : 0,
);
}
}
/**
* Parameter interface for {@link MPCameraPosition}.
*
* @export
* @interface MPCameraPositionParams
* @typedef {MPCameraPositionParams}
*/
export interface MPCameraPositionParams {
/**
* The zoom level of the camera.
*
* @type {number}
*/
zoom: number,
/**
* The target of the camera.
*
* @type {MPPoint}
*/
target: MPPoint | any,
/**
* The camera's tilt value.
*
* @type {?number}
*/
tilt?: number,
/**
* The camera's heading.
*
* @type {?number}
*/
bearing?: number,
}