@openglobus/og 0.28.0 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Globe.d.ts CHANGED
@@ -2,6 +2,7 @@ import { Control } from "./control/Control";
2
2
  import { Ellipsoid } from "./ellipsoid/Ellipsoid";
3
3
  import { EmptyTerrain } from "./terrain/EmptyTerrain";
4
4
  import { Layer } from "./layer/Layer";
5
+ import { Navigation } from "./control/Navigation";
5
6
  import type { NumberArray2 } from "./math/Vec2";
6
7
  import type { NumberArray4 } from "./math/Vec4";
7
8
  import { Planet } from "./scene/Planet";
@@ -40,6 +41,18 @@ export interface IGlobeParams {
40
41
  active?: boolean;
41
42
  stopped?: boolean;
42
43
  };
44
+ navigation?: {
45
+ active?: boolean;
46
+ inertia?: number;
47
+ dragInertia?: number;
48
+ minSlope?: number;
49
+ mass?: number;
50
+ zoomSpeed?: number;
51
+ mode?: "lockNorth" | "adaptive" | "free";
52
+ poleThreshold?: number;
53
+ disableRotation?: boolean;
54
+ disableTilt?: boolean;
55
+ };
43
56
  layers?: Layer[];
44
57
  viewExtent?: Extent | NumberArray4;
45
58
  autoActivate?: boolean;
@@ -67,7 +80,7 @@ export interface IGlobeParams {
67
80
  * target: 'globus',
68
81
  * name: 'Earth',
69
82
  * controls: [
70
- * new control.MouseNavigation(),
83
+ * new control.Navigation(),
71
84
  * new control.KeyboardNavigation(),
72
85
  * new control.EarthCoordinates(),
73
86
  * new control.LayerSwitcher({),
@@ -129,6 +142,7 @@ declare class Globe {
129
142
  protected _planetName: string;
130
143
  planet: Planet;
131
144
  sun: Sun;
145
+ navigation: Navigation;
132
146
  constructor(options: IGlobeParams);
133
147
  start(): void;
134
148
  /**
@@ -6,35 +6,41 @@ import { Sphere } from "../bv/Sphere";
6
6
  import { Vec2 } from "../math/Vec2";
7
7
  import { Vec3 } from "../math/Vec3";
8
8
  import { type EventsHandler } from "../Events";
9
- interface IMouseNavigationParams extends IControlParams {
10
- fixedUp?: boolean;
9
+ export type NavigationMode = "lockNorth" | "adaptive" | "free";
10
+ export interface INavigationParams extends IControlParams {
11
11
  inertia?: number;
12
12
  dragInertia?: number;
13
13
  minSlope?: number;
14
14
  mass?: number;
15
15
  zoomSpeed?: number;
16
+ mode?: NavigationMode;
17
+ poleThreshold?: number;
18
+ disableRotation?: boolean;
19
+ disableTilt?: boolean;
16
20
  }
17
- export type MouseNavigationEventsList = [
21
+ export type NavigationEventsList = [
18
22
  "drag",
19
23
  "zoom",
20
24
  "rotate"
21
25
  ];
22
26
  /**
23
- * Mouse navigation.
27
+ * Navigation.
24
28
  * @class
25
29
  * @extends {Control}
26
- * @param {IMouseNavigationParams} [options] - Mouse navigation options:
27
- * @param {boolean} [options.fixedUp] - fix up at north pole
30
+ * @param {INavigationParams} [options] - Navigation options:
31
+ * @param {NavigationMode} [options.mode] - Navigation mode: "lockNorth" (keeps north fixed), "adaptive" (default, auto-detects arc mode), "free" (arc rotation mode)
28
32
  * @param {number} [options.inertia] - inertia factor
29
33
  * @param {number} [options.dragInertia] - drag inertia
30
34
  * @param {number} [options.mass] - camera mass, affects velocity. Default is 1
31
35
  * @param {number} [options.minSlope] - minimal slope for vertical camera movement. Default is 0.35
32
- * @param {number} [options.zoomSpeed] - zoom speed factor. Default is 1
33
- * @fires og.MouseNavigation#drag
34
- * @fires og.MouseNavigation#zoom
35
- * @fires og.MouseNavigation#rotate
36
+ * @param {number} [options.poleThreshold] - Vertical rotation is reduced when camera is close to poles
37
+ * @param {boolean} [options.disableRotation] - Disables horizontal rotation controls (right mouse button and touchpad). Default is false
38
+ * @param {boolean} [options.disableTilt] - Disables vertical tilt controls (right mouse button and touchpad). Default is false
39
+ * @fires og.Navigation#drag
40
+ * @fires og.Navigation#zoom
41
+ * @fires og.Navigation#rotate
36
42
  */
37
- export declare class MouseNavigation extends Control {
43
+ export declare class Navigation extends Control {
38
44
  force: Vec3;
39
45
  force_h: number;
40
46
  force_v: number;
@@ -46,9 +52,14 @@ export declare class MouseNavigation extends Control {
46
52
  inertia: number;
47
53
  dragInertia: number;
48
54
  zoomSpeed: number;
55
+ poleThreshold: number;
56
+ mode: number;
57
+ disableRotation: boolean;
58
+ disableTilt: boolean;
49
59
  vel_roll: number;
50
60
  force_roll: number;
51
- events: EventsHandler<MouseNavigationEventsList>;
61
+ protected _freeMode: boolean;
62
+ events: EventsHandler<NavigationEventsList>;
52
63
  protected _lookPos: Vec3 | undefined;
53
64
  protected _grabbedPoint: Vec3 | null;
54
65
  protected _grabbedDist: number;
@@ -61,7 +72,6 @@ export declare class MouseNavigation extends Control {
61
72
  protected _tUp: Vec3;
62
73
  protected _tRad: number;
63
74
  protected _shiftBusy: boolean;
64
- protected fixedUp: boolean;
65
75
  protected _curPitch: number;
66
76
  protected _curYaw: number;
67
77
  protected _curRoll: number;
@@ -72,11 +82,9 @@ export declare class MouseNavigation extends Control {
72
82
  protected _isTouchPad: boolean;
73
83
  protected _velInertia: number;
74
84
  protected _hold: boolean;
75
- protected _prevVel: Vec3;
76
- protected _screenPosIsChanged: boolean;
77
85
  protected _rotHDir: number;
78
86
  protected _rotVDir: number;
79
- constructor(options?: IMouseNavigationParams);
87
+ constructor(options?: INavigationParams);
80
88
  oninit(): void;
81
89
  onadd(): void;
82
90
  onremove(): void;
@@ -96,6 +104,9 @@ export declare class MouseNavigation extends Control {
96
104
  protected _onLDown: (e: IMouseState) => void;
97
105
  protected _onLHold: (e: IMouseState) => void;
98
106
  protected _onLUp: (e: IMouseState) => void;
107
+ get freeMode(): boolean;
108
+ setMode(mode: NavigationMode): void;
109
+ protected _modeToNumber(mode: NavigationMode): number;
99
110
  protected _handleDrag(): void;
100
111
  protected _corrRoll(): void;
101
112
  protected _handleZoom(): void;
@@ -107,4 +118,3 @@ export declare class MouseNavigation extends Control {
107
118
  protected get velocityInertia(): number;
108
119
  stop(): void;
109
120
  }
110
- export {};
@@ -9,7 +9,7 @@ export * from "./LayerAnimation";
9
9
  export * from "./LayerSwitcher";
10
10
  export * from "./Lighting";
11
11
  export * from "./OldMouseNavigation";
12
- export * from "./MouseNavigation";
12
+ export * from "./Navigation";
13
13
  export * from "./RulerSwitcher";
14
14
  export * from "./ScaleControl";
15
15
  export * from "./ShowFps";