@openglobus/og 0.14.10 → 0.15.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/css/og.css +378 -275
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +18 -17
- package/src/og/Clock.js +218 -194
- package/src/og/Globe.js +5 -5
- package/src/og/Object3d.js +104 -145
- package/src/og/camera/Camera.js +31 -27
- package/src/og/camera/PlanetCamera.js +22 -14
- package/src/og/cons.js +107 -107
- package/src/og/control/Atmosphere.js +396 -0
- package/src/og/control/CompassButton.js +11 -18
- package/src/og/control/Control.js +197 -188
- package/src/og/control/GeoImageDragControl.js +84 -66
- package/src/og/control/LayerSwitcher.js +56 -138
- package/src/og/control/Lighting.js +314 -186
- package/src/og/control/MouseNavigation.js +2 -2
- package/src/og/control/RulerSwitcher.js +24 -19
- package/src/og/control/ScaleControl.js +30 -10
- package/src/og/control/SimpleSkyBackground.js +210 -0
- package/src/og/control/Sun.js +3 -1
- package/src/og/control/ZoomControl.js +30 -42
- package/src/og/control/index.js +6 -0
- package/src/og/control/ruler/RulerScene.js +5 -23
- package/src/og/control/selection/Selection.js +99 -0
- package/src/og/control/selection/SelectionScene.js +350 -0
- package/src/og/control/timeline/TimelineControl.js +99 -0
- package/src/og/control/timeline/TimelineModel.js +133 -0
- package/src/og/control/timeline/TimelineView.js +449 -0
- package/src/og/control/timeline/timelineUtils.js +132 -0
- package/src/og/ellipsoid/Ellipsoid.js +120 -93
- package/src/og/ellipsoid/wgs84.js +13 -13
- package/src/og/entity/Entity.js +36 -9
- package/src/og/entity/EntityCollection.js +0 -2
- package/src/og/entity/GeoObject.js +72 -56
- package/src/og/entity/GeoObjectHandler.js +487 -656
- package/src/og/entity/GeometryHandler.js +1341 -1337
- package/src/og/entity/Polyline.js +0 -16
- package/src/og/entity/Ray.js +0 -10
- package/src/og/entity/RayHandler.js +3 -44
- package/src/og/entity/Strip.js +1 -6
- package/src/og/index.js +13 -7
- package/src/og/input/input.js +3 -1
- package/src/og/layer/CanvasTiles.js +39 -34
- package/src/og/layer/Layer.js +69 -9
- package/src/og/layer/Material.js +1 -8
- package/src/og/layer/WMS.js +16 -5
- package/src/og/light/LightSource.js +2 -0
- package/src/og/math/Line3.js +140 -139
- package/src/og/math/Plane.js +118 -117
- package/src/og/math/Ray.js +242 -239
- package/src/og/math/Vec3.js +56 -37
- package/src/og/math/Vec4.js +3 -4
- package/src/og/math.js +21 -21
- package/src/og/quadTree/Node.js +5 -4
- package/src/og/quadTree/index.js +12 -0
- package/src/og/renderer/Renderer.js +64 -37
- package/src/og/renderer/RendererEvents.js +1071 -1065
- package/src/og/scene/Planet.js +354 -174
- package/src/og/scene/RenderNode.js +27 -12
- package/src/og/segment/Segment.js +0 -5
- package/src/og/shaders/atmos.js +332 -0
- package/src/og/shaders/drawnode.js +475 -109
- package/src/og/shaders/geoObject.js +96 -51
- package/src/og/shaders/polyline.js +212 -17
- package/src/og/shaders/ray.js +13 -6
- package/src/og/shaders/toneMapping.js +5 -5
- package/src/og/shaders/utils.js +88 -0
- package/src/og/terrain/GlobusTerrain.js +5 -4
- package/src/og/terrain/MapboxTerrain.js +231 -52
- package/src/og/ui/Button.js +106 -0
- package/src/og/ui/ButtonGroup.js +57 -0
- package/src/og/ui/Dialog.js +242 -0
- package/src/og/ui/Slider.js +144 -0
- package/src/og/ui/ToggleButton.js +51 -0
- package/src/og/{control → ui}/UIhelpers.js +11 -2
- package/src/og/ui/View.js +190 -0
- package/src/og/utils/shared.js +960 -942
- package/src/og/webgl/Framebuffer.js +308 -387
- package/src/og/webgl/Handler.js +90 -30
- package/src/og/webgl/Multisample.js +8 -0
- package/types/Clock.d.ts +7 -2
- package/types/Object3d.d.ts +14 -3
- package/types/camera/Camera.d.ts +18 -17
- package/types/camera/PlanetCamera.d.ts +3 -1
- package/types/control/Atmosphere.d.ts +15 -0
- package/types/control/CompassButton.d.ts +1 -2
- package/types/control/GeoImageDragControl.d.ts +7 -1
- package/types/control/LayerSwitcher.d.ts +5 -6
- package/types/control/Lighting.d.ts +32 -7
- package/types/control/ScaleControl.d.ts +2 -1
- package/types/control/SimpleSkyBackground.d.ts +15 -0
- package/types/control/ZoomControl.d.ts +0 -1
- package/types/control/index.d.ts +4 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/Selection.d.ts +49 -0
- package/types/control/selection/SelectionScene.d.ts +34 -0
- package/types/ellipsoid/Ellipsoid.d.ts +3 -2
- package/types/entity/Entity.d.ts +8 -0
- package/types/entity/GeoObject.d.ts +28 -22
- package/types/entity/GeoObjectHandler.d.ts +16 -56
- package/types/entity/Ray.d.ts +0 -3
- package/types/entity/RayHandler.d.ts +0 -4
- package/types/index.d.ts +9 -6
- package/types/input/input.d.ts +2 -0
- package/types/layer/CanvasTiles.d.ts +1 -0
- package/types/layer/Layer.d.ts +9 -0
- package/types/layer/WMS.d.ts +7 -3
- package/types/math/Plane.d.ts +1 -1
- package/types/math/Vec3.d.ts +19 -16
- package/types/math/Vec4.d.ts +2 -3
- package/types/math.d.ts +20 -20
- package/types/quadTree/index.d.ts +10 -0
- package/types/renderer/Renderer.d.ts +11 -37
- package/types/scene/Planet.d.ts +27 -1
- package/types/scene/RenderNode.d.ts +2 -1
- package/types/segment/Segment.d.ts +1 -1
- package/types/shaders/atmos.d.ts +4 -0
- package/types/shaders/drawnode.d.ts +3 -2
- package/types/shaders/utils.d.ts +1 -0
- package/types/terrain/GlobusTerrain.d.ts +1 -1
- package/types/terrain/MapboxTerrain.d.ts +2 -1
- package/types/ui/Button.d.ts +21 -0
- package/types/ui/Dialog.d.ts +41 -0
- package/types/ui/Slider.d.ts +30 -0
- package/types/ui/ToggleButton.d.ts +10 -0
- package/types/{control → ui}/UIhelpers.d.ts +1 -1
- package/types/ui/View.d.ts +32 -0
- package/types/utils/shared.d.ts +16 -14
- package/types/webgl/Framebuffer.d.ts +2 -5
- package/types/webgl/Handler.d.ts +15 -10
- package/types/webgl/Multisample.d.ts +2 -0
- package/src/og/ajax.js +0 -204
- package/src/og/entity/Object3d.js +0 -504
- package/src/og/utils/quadTreeType.js +0 -11
- package/types/ajax.d.ts +0 -24
- package/types/utils/quadTreeType.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "[OpenGlobus](https://www.openglobus.org/) is a javascript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers and 3d objects. It uses the WebGL technology, open source and completely free.",
|
|
5
5
|
"directories": {
|
|
6
6
|
"example": "./sandbox"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"api": "jsdoc -r ./src/ -c ./jsdoc.conf.json -d ./api",
|
|
13
13
|
"serve": "ws",
|
|
14
|
-
"build": "rollup -c",
|
|
14
|
+
"build": "rollup -c --bundleConfigAsCjs",
|
|
15
15
|
"webgl": "rollup -c --environment entry:webgl",
|
|
16
16
|
"core": "rollup -c --environment entry:core",
|
|
17
17
|
"test": "jest --env=jsdom --runInBand --ci --coverage=false",
|
|
@@ -44,24 +44,25 @@
|
|
|
44
44
|
"./css/og.css": "./css/og.css"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
48
|
-
"@rollup/plugin-json": "^
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
47
|
+
"@babel/preset-env": "^7.20.2",
|
|
48
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
49
|
+
"@rollup/plugin-terser": "^0.3.0",
|
|
50
|
+
"@types/jest": "^29.2.6",
|
|
51
|
+
"eslint": "^8.32.0",
|
|
52
|
+
"jaguarjs-jsdoc": "^1.0.2",
|
|
53
|
+
"jest": "^29.3.1",
|
|
53
54
|
"jest-canvas-mock": "^2.4.0",
|
|
54
|
-
"jest-environment-jsdom": "^
|
|
55
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
55
56
|
"jest-webgl-canvas-mock": "^0.2.3",
|
|
56
|
-
"jsdoc": "^
|
|
57
|
-
"lint-staged": "^13.0
|
|
57
|
+
"jsdoc": "^4.0.2",
|
|
58
|
+
"lint-staged": "^13.1.0",
|
|
58
59
|
"local-web-server": "^5.2.1",
|
|
59
|
-
"postcss": "^8.4.
|
|
60
|
-
"prettier": "^2.
|
|
61
|
-
"rollup": "^
|
|
60
|
+
"postcss": "^8.4.21",
|
|
61
|
+
"prettier": "^2.8.3",
|
|
62
|
+
"rollup": "^3.10.0",
|
|
62
63
|
"rollup-plugin-postcss": "^4.0.2",
|
|
63
|
-
"
|
|
64
|
-
"typescript": "^4.
|
|
64
|
+
"taffydb": "^2.7.3",
|
|
65
|
+
"typescript": "^4.9.4"
|
|
65
66
|
},
|
|
66
67
|
"lint-staged": {
|
|
67
68
|
"*.{js,ts}": [
|
|
@@ -81,4 +82,4 @@
|
|
|
81
82
|
"globe",
|
|
82
83
|
"og"
|
|
83
84
|
]
|
|
84
|
-
}
|
|
85
|
+
}
|
package/src/og/Clock.js
CHANGED
|
@@ -1,194 +1,218 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/Clock
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
"use strict";
|
|
6
|
-
|
|
7
|
-
import { Events } from "./Events.js";
|
|
8
|
-
import * as jd from "./astro/jd.js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Class represents application timer that stores custom current julian datetime, and time speed multiplier.
|
|
12
|
-
* @class
|
|
13
|
-
* @param {Object} [params] - Clock parameters:
|
|
14
|
-
* @param {number} [params.startDate=0.0] - Julian start date.
|
|
15
|
-
* @param {number} [params.endDate=0.0] - Julian end date.
|
|
16
|
-
* @param {number} [params.currentDate] - Julian current date. Default: current date.
|
|
17
|
-
* @param {number} [params.multiplier=1.0] - Time speed multiolier.
|
|
18
|
-
*/
|
|
19
|
-
class Clock {
|
|
20
|
-
static get _staticCounter() {
|
|
21
|
-
if (!this._counter && this._counter !== 0) {
|
|
22
|
-
this._counter = 0;
|
|
23
|
-
}
|
|
24
|
-
return this._counter;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static set _staticCounter(n) {
|
|
28
|
-
this._counter = n;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @param {Object} [params] - Clock parameters:
|
|
34
|
-
*/
|
|
35
|
-
constructor(params) {
|
|
36
|
-
params = params || {};
|
|
37
|
-
|
|
38
|
-
this._id = Clock._staticCounter++;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Clock name.
|
|
42
|
-
* @public
|
|
43
|
-
* @type {string}
|
|
44
|
-
*/
|
|
45
|
-
this.name = params.name || "";
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Clock events.
|
|
49
|
-
* @public
|
|
50
|
-
* @type {Events}
|
|
51
|
-
*/
|
|
52
|
-
this.events = new Events(["tick", "end"], this);
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Start julian date clock loop.
|
|
56
|
-
* @public
|
|
57
|
-
* @type {number}
|
|
58
|
-
*/
|
|
59
|
-
this.startDate = params.startDate || 0;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* End julian date clock loop.
|
|
63
|
-
* @public
|
|
64
|
-
* @type {number}
|
|
65
|
-
*/
|
|
66
|
-
this.endDate = params.endDate || 0;
|
|
67
|
-
|
|
68
|
-
var currentDate = params.currentDate || jd.DateToUTC(new Date());
|
|
69
|
-
if (params.startDate && currentDate < params.startDate) {
|
|
70
|
-
currentDate = params.startDate;
|
|
71
|
-
}
|
|
72
|
-
if (params.endDate && currentDate > params.endDate) {
|
|
73
|
-
currentDate = params.endDate;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Current julian datetime.
|
|
78
|
-
* @public
|
|
79
|
-
* @type {number}
|
|
80
|
-
*/
|
|
81
|
-
this.currentDate = currentDate;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Timer speed multiplier.
|
|
85
|
-
* @public
|
|
86
|
-
* @type {number}
|
|
87
|
-
*/
|
|
88
|
-
this.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
* @
|
|
94
|
-
* @
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
* @
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.
|
|
107
|
-
this.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.
|
|
119
|
-
this.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*
|
|
125
|
-
* @
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
*
|
|
141
|
-
* @
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this.
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
this.
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
* @
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module og/Clock
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
import { Events } from "./Events.js";
|
|
8
|
+
import * as jd from "./astro/jd.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Class represents application timer that stores custom current julian datetime, and time speed multiplier.
|
|
12
|
+
* @class
|
|
13
|
+
* @param {Object} [params] - Clock parameters:
|
|
14
|
+
* @param {number} [params.startDate=0.0] - Julian start date.
|
|
15
|
+
* @param {number} [params.endDate=0.0] - Julian end date.
|
|
16
|
+
* @param {number} [params.currentDate] - Julian current date. Default: current date.
|
|
17
|
+
* @param {number} [params.multiplier=1.0] - Time speed multiolier.
|
|
18
|
+
*/
|
|
19
|
+
class Clock {
|
|
20
|
+
static get _staticCounter() {
|
|
21
|
+
if (!this._counter && this._counter !== 0) {
|
|
22
|
+
this._counter = 0;
|
|
23
|
+
}
|
|
24
|
+
return this._counter;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static set _staticCounter(n) {
|
|
28
|
+
this._counter = n;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {Object} [params] - Clock parameters:
|
|
34
|
+
*/
|
|
35
|
+
constructor(params) {
|
|
36
|
+
params = params || {};
|
|
37
|
+
|
|
38
|
+
this._id = Clock._staticCounter++;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Clock name.
|
|
42
|
+
* @public
|
|
43
|
+
* @type {string}
|
|
44
|
+
*/
|
|
45
|
+
this.name = params.name || "";
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Clock events.
|
|
49
|
+
* @public
|
|
50
|
+
* @type {Events}
|
|
51
|
+
*/
|
|
52
|
+
this.events = new Events(["tick", "end", "start", "stop"], this);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Start julian date clock loop.
|
|
56
|
+
* @public
|
|
57
|
+
* @type {number}
|
|
58
|
+
*/
|
|
59
|
+
this.startDate = params.startDate || 0;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* End julian date clock loop.
|
|
63
|
+
* @public
|
|
64
|
+
* @type {number}
|
|
65
|
+
*/
|
|
66
|
+
this.endDate = params.endDate || 0;
|
|
67
|
+
|
|
68
|
+
var currentDate = params.currentDate || jd.DateToUTC(new Date());
|
|
69
|
+
if (params.startDate && currentDate < params.startDate) {
|
|
70
|
+
currentDate = params.startDate;
|
|
71
|
+
}
|
|
72
|
+
if (params.endDate && currentDate > params.endDate) {
|
|
73
|
+
currentDate = params.endDate;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Current julian datetime.
|
|
78
|
+
* @public
|
|
79
|
+
* @type {number}
|
|
80
|
+
*/
|
|
81
|
+
this.currentDate = currentDate;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Timer speed multiplier.
|
|
85
|
+
* @public
|
|
86
|
+
* @type {number}
|
|
87
|
+
*/
|
|
88
|
+
this._multiplier = params.multiplier !== undefined ? params.multiplier : 1.0;
|
|
89
|
+
this._running = 1;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Animation frame delta time.
|
|
93
|
+
* @public
|
|
94
|
+
* @readonly
|
|
95
|
+
* @type {number}
|
|
96
|
+
*/
|
|
97
|
+
this.deltaTicks = 0;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Timer activity.
|
|
101
|
+
* @public
|
|
102
|
+
* @type {boolean}
|
|
103
|
+
*/
|
|
104
|
+
this.active = true;
|
|
105
|
+
|
|
106
|
+
this._intervalDelay = 0;
|
|
107
|
+
this._intervalStart = 0;
|
|
108
|
+
this._intervalCallback = null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
clearInterval() {
|
|
112
|
+
this._intervalDelay = 0;
|
|
113
|
+
this._intervalStart = 0;
|
|
114
|
+
this._intervalCallback = null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
setInterval(delay, callback) {
|
|
118
|
+
this._intervalStart = this.currentDate;
|
|
119
|
+
this._intervalDelay = delay * jd.ONE_BY_MILLISECONDS_PER_DAY;
|
|
120
|
+
this._intervalCallback = callback;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Sets current clock datetime.
|
|
125
|
+
* @public
|
|
126
|
+
* @param {Object} date - JavaScript Date object.
|
|
127
|
+
*/
|
|
128
|
+
setDate(date) {
|
|
129
|
+
var d = jd.DateToUTC(date);
|
|
130
|
+
if (this.startDate && d < this.startDate) {
|
|
131
|
+
d = this.startDate;
|
|
132
|
+
}
|
|
133
|
+
if (this.endDate && d > this.endDate) {
|
|
134
|
+
d = this.endDate;
|
|
135
|
+
}
|
|
136
|
+
this.currentDate = d;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Returns current application date.
|
|
141
|
+
* @public
|
|
142
|
+
* @returns {Date} - Current date.
|
|
143
|
+
*/
|
|
144
|
+
getDate() {
|
|
145
|
+
return jd.UTCtoDate(this.currentDate);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
reset() {
|
|
149
|
+
if (this.startDate) {
|
|
150
|
+
this.currentDate = this.startDate;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
_tick(dt) {
|
|
155
|
+
let m = this._multiplier * this._running;
|
|
156
|
+
this.deltaTicks = dt * m
|
|
157
|
+
if (this.active) {
|
|
158
|
+
let cd = jd.addMilliseconds(this.currentDate, this.deltaTicks);
|
|
159
|
+
if (m > 0) {
|
|
160
|
+
if (this.endDate && cd > this.endDate) {
|
|
161
|
+
this.currentDate = this.startDate;
|
|
162
|
+
this.events.dispatch(this.events.end, this);
|
|
163
|
+
} else {
|
|
164
|
+
this.currentDate = cd;
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
if (this.startDate && cd < this.startDate) {
|
|
168
|
+
this.currentDate = this.endDate;
|
|
169
|
+
this.events.dispatch(this.events.end, this);
|
|
170
|
+
} else {
|
|
171
|
+
this.currentDate = cd;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (this._intervalCallback) {
|
|
176
|
+
if (this.currentDate - this._intervalStart >= this._intervalDelay) {
|
|
177
|
+
this._intervalStart = this.currentDate;
|
|
178
|
+
this._intervalCallback(this);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
this.events.dispatch(this.events.tick, this);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @public
|
|
188
|
+
* @param {Clock} clock - Clock instance to compare.
|
|
189
|
+
* @returns {boolean} - Returns true if a clock is the same instance.
|
|
190
|
+
*/
|
|
191
|
+
isEqual(clock) {
|
|
192
|
+
return this._id === clock._id;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
start() {
|
|
196
|
+
if (this._running === 0) {
|
|
197
|
+
this._running = 1;
|
|
198
|
+
this.events.dispatch(this.events.start, this);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
get multiplier() {
|
|
203
|
+
return this._multiplier;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
set multiplier(value) {
|
|
207
|
+
this._multiplier = value;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
stop() {
|
|
211
|
+
if (this._running === 1) {
|
|
212
|
+
this._running = 0;
|
|
213
|
+
this.events.dispatch(this.events.stop, this);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export { Clock };
|
package/src/og/Globe.js
CHANGED
|
@@ -69,7 +69,7 @@ const PLANET_NAME_PREFIX = "globus_planet_";
|
|
|
69
69
|
* @param {Number} [options.maxEqualZoomAltitude=15000000.0] - Maximal altitude since segments on the screen bacame the same zoom level
|
|
70
70
|
* @param {Number} [options.minEqualZoomAltitude=10000.0] - Minimal altitude since segments on the screen bacame the same zoom level
|
|
71
71
|
* @param {Number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above te globe where segments on the screen bacame the same zoom level
|
|
72
|
-
* @param {Number} [options.loadingBatchSize=12] -
|
|
72
|
+
* @param {Number} [options.loadingBatchSize=12] -
|
|
73
73
|
* @param {Number} [options.quadTreeStrategyPrototype] - Prototype of quadTree. QuadTreeStrategy for Earth is default.
|
|
74
74
|
*/
|
|
75
75
|
|
|
@@ -129,12 +129,12 @@ class Globe {
|
|
|
129
129
|
context: {
|
|
130
130
|
alpha: false,
|
|
131
131
|
antialias: false,
|
|
132
|
-
premultipliedAlpha:
|
|
132
|
+
premultipliedAlpha: false
|
|
133
133
|
}
|
|
134
134
|
}), {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
autoActivate: false,
|
|
136
|
+
backgroundColor: createColorRGB(options.backgroundColor, new Vec3(115 / 255, 203 / 255, 249 / 255))
|
|
137
|
+
}
|
|
138
138
|
);
|
|
139
139
|
this.renderer.initialize();
|
|
140
140
|
this.renderer.div = this.div;
|