-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMPHighlightBehavior.ts
95 lines (91 loc) · 2.83 KB
/
MPHighlightBehavior.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
83
84
85
86
87
88
89
90
91
92
93
94
95
import MapControl from "../../index";
/**
* Sets a behavior for the map when calling {@link MapControl#setHighlight}.
*
* Has a default behavior:
* * MoveCamera = false
* * ShowInfoWindow = false
* * AnimationDuration = 0
* * AllowFloorChange = false
* * ZoomToFit = true
*
* @export
* @class MPFilterBehavior
* @typedef {MPHighlightBehavior}
*/
export default class MPHighlightBehavior {
/**
* Creates an instance of MPHighlightBehavior.
*
* @constructor
* @private
* @param {boolean} allowFloorChange Whether the highlighting is allowed to change the floor if no results are visible on the current floor.
* @param {boolean} moveCamera Whether the highlighting should move the camera to encompass the results.
* @param {number} animationDuration How long the camera movement should be animated for, set to 0 disables animation.
* @param {boolean} showInfoWindow Whether to open the info window if a single result is returned.
* @param {boolean} zoomToFit Whether the highlighting is allowed to zoom in/out the camera.
*/
private constructor(
public allowFloorChange: boolean,
public moveCamera: boolean,
public animationDuration: number,
public showInfoWindow: boolean,
public zoomToFit: boolean,
) { }
/**
* Creator for MPHighlightBehavior, invoke with 0 parameters to use default behavior.
*
* @public
* @static
* @param {MPFilterBehaviorParams} object
* @returns {MPFilterBehavior}
*/
public static create(object?: MPHighlightBehaviorParams): MPHighlightBehavior {
return new MPHighlightBehavior(
object?.allowFloorChange ?? false,
object?.moveCamera ?? false,
object?.animationDuration ?? 0,
object?.showInfoWindow ?? false,
object?.zoomToFit ?? true
);
};
}
/**
* Parameter interface for {@link MPHighlightBehavior}.
*
* @export
* @interface MPHighlightBehaviorParams
* @typedef {MPHighlightBehaviorParams}
*/
export interface MPHighlightBehaviorParams {
/**
* Whether the highlight is allowed to change the floor if no results are visible on the current floor.
*
* @type {?boolean}
*/
allowFloorChange?: boolean,
/**
* Whether the Highlight should move the camera to encompass the results.
*
* @type {?boolean}
*/
moveCamera?: boolean,
/**
* How long the camera movement should be animated for, set to 0 disables animation.
*
* @type {?number}
*/
animationDuration?: number,
/**
* Whether to open the info window if a single result is returned.
*
* @type {?boolean}
*/
showInfoWindow?: boolean,
/**
* Whether the Highlight is allowed to zoom in/out the camera.
*
* @type {?boolean}
*/
zoomToFit?: boolean,
}