@openglobus/og 0.11.1 → 0.11.6
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/package.json +18 -20
- package/src/og/Clock.js +11 -11
- package/src/og/Deferred.js +1 -1
- package/src/og/Events.js +9 -7
- package/src/og/Extent.js +117 -72
- package/src/og/Globe.js +35 -22
- package/src/og/ImageCanvas.js +24 -18
- package/src/og/Lock.js +2 -2
- package/src/og/LonLat.js +40 -37
- package/src/og/Popup.js +21 -15
- package/src/og/QueueArray.js +7 -3
- package/src/og/Rectangle.js +11 -6
- package/src/og/Stack.js +8 -5
- package/src/og/ajax.js +21 -33
- package/src/og/astro/astro.js +5 -5
- package/src/og/astro/earth.js +23 -17
- package/src/og/astro/jd.js +44 -39
- package/src/og/astro/orbit.js +20 -18
- package/src/og/astro/rotation.js +17 -8
- package/src/og/bv/Box.js +7 -3
- package/src/og/bv/Sphere.js +17 -9
- package/src/og/camera/Camera.js +137 -86
- package/src/og/camera/Frustum.js +30 -19
- package/src/og/camera/PlanetCamera.js +30 -26
- package/src/og/control/CompassButton.js +8 -2
- package/src/og/control/Control.js +13 -11
- package/src/og/control/DebugInfo.js +4 -1
- package/src/og/control/EarthCoordinates.js +62 -41
- package/src/og/control/EarthNavigation.js +20 -22
- package/src/og/control/GeoImageDragControl.js +1 -1
- package/src/og/control/KeyboardNavigation.js +12 -12
- package/src/og/control/LayerSwitcher.js +24 -23
- package/src/og/control/Lighting.js +1 -1
- package/src/og/control/MouseNavigation.js +1 -1
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/SegmentBoundVisualization.js +8 -9
- package/src/og/control/ShowFps.js +15 -10
- package/src/og/control/SimpleNavigation.js +8 -10
- package/src/og/control/Sun.js +25 -15
- package/src/og/control/ToggleWireframe.js +5 -5
- package/src/og/control/TouchNavigation.js +58 -45
- package/src/og/control/ZoomControl.js +41 -25
- package/src/og/control/index.js +4 -0
- package/src/og/ellipsoid/Ellipsoid.js +181 -85
- package/src/og/ellipsoid/wgs84.js +4 -4
- package/src/og/entity/BaseBillboard.js +97 -44
- package/src/og/entity/Billboard.js +15 -11
- package/src/og/entity/BillboardHandler.js +314 -64
- package/src/og/entity/Entity.js +106 -74
- package/src/og/entity/EntityCollection.js +72 -49
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/Geometry.js +29 -26
- package/src/og/entity/GeometryHandler.js +598 -126
- package/src/og/entity/Label.js +74 -40
- package/src/og/entity/LabelHandler.js +47 -246
- package/src/og/entity/LabelWorker.js +213 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +81 -33
- package/src/og/entity/PointCloudHandler.js +9 -9
- package/src/og/entity/Polyline.js +39 -39
- package/src/og/entity/Ray.js +61 -28
- package/src/og/entity/ShapeHandler.js +1 -1
- package/src/og/entity/Strip.js +77 -48
- package/src/og/entity/StripHandler.js +27 -27
- package/src/og/entity/index.js +8 -16
- package/src/og/input/KeyboardHandler.js +107 -104
- package/src/og/input/MouseHandler.js +81 -78
- package/src/og/input/TouchHandler.js +55 -51
- package/src/og/layer/BaseGeoImage.js +61 -30
- package/src/og/layer/CanvasTiles.js +26 -24
- package/src/og/layer/GeoImage.js +10 -10
- package/src/og/layer/GeoTexture2d.js +1 -1
- package/src/og/layer/GeoVideo.js +3 -3
- package/src/og/layer/KML.js +66 -40
- package/src/og/layer/Layer.js +27 -17
- package/src/og/layer/Material.js +93 -61
- package/src/og/layer/Vector.js +118 -72
- package/src/og/layer/WMS.js +36 -19
- package/src/og/layer/XYZ.js +55 -48
- package/src/og/light/LightSource.js +47 -40
- package/src/og/math/Line2.js +24 -24
- package/src/og/math/Line3.js +103 -102
- package/src/og/math/Mat3.js +134 -121
- package/src/og/math/Mat4.js +603 -459
- package/src/og/math/Plane.js +21 -20
- package/src/og/math/Quat.js +980 -927
- package/src/og/math/Ray.js +195 -187
- package/src/og/math/Vec2.js +127 -117
- package/src/og/math/Vec3.js +206 -176
- package/src/og/math/Vec4.js +49 -53
- package/src/og/math/coder.js +18 -18
- package/src/og/math.js +12 -12
- package/src/og/mercator.js +11 -11
- package/src/og/proj/EPSG3857.js +4 -4
- package/src/og/proj/EPSG4326.js +4 -4
- package/src/og/proj/Proj.js +31 -31
- package/src/og/quadTree/EntityCollectionNode.js +310 -300
- package/src/og/quadTree/Node.js +1008 -993
- package/src/og/renderer/Renderer.js +768 -747
- package/src/og/renderer/RendererEvents.js +9 -6
- package/src/og/scene/Axes.js +1 -1
- package/src/og/scene/BaseNode.js +8 -9
- package/src/og/scene/Planet.js +115 -87
- package/src/og/scene/RenderNode.js +29 -22
- package/src/og/scene/SkyBox.js +1 -1
- package/src/og/segment/Segment.js +1886 -1878
- package/src/og/segment/SegmentLonLat.js +298 -268
- package/src/og/segment/segmentHelper.js +11 -11
- package/src/og/shaders/bloom.js +1 -1
- package/src/og/shaders/blur.js +2 -2
- package/src/og/shaders/depth.js +1 -1
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/label.js +1 -1
- package/src/og/shaders/lumFilter.js +1 -1
- package/src/og/shaders/pointCloud.js +42 -42
- package/src/og/shaders/screenFrame.js +1 -1
- package/src/og/shaders/shape.js +15 -21
- package/src/og/shaders/skybox.js +37 -37
- package/src/og/shaders/toneMapping.js +1 -1
- package/src/og/shapes/BaseShape.js +129 -57
- package/src/og/shapes/Icosphere.js +30 -15
- package/src/og/shapes/Sphere.js +13 -16
- package/src/og/terrain/BilTerrain.js +2 -1
- package/src/og/terrain/EmptyTerrain.js +2 -2
- package/src/og/terrain/Geoid.js +2 -2
- package/src/og/terrain/GlobusTerrain.js +10 -10
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/GeoImageCreator.js +9 -9
- package/src/og/utils/Loader.js +6 -6
- package/src/og/utils/NormalMapCreator.js +13 -13
- package/src/og/utils/TerrainWorker.js +1 -1
- package/src/og/utils/TextureAtlas.js +20 -22
- package/src/og/utils/VectorTileCreator.js +5 -5
- package/src/og/utils/earcut.js +1 -1
- package/src/og/utils/shared.js +15 -15
- package/src/og/webgl/Framebuffer.js +101 -53
- package/src/og/webgl/Handler.js +125 -85
- package/src/og/webgl/Multisample.js +55 -27
- package/src/og/webgl/Program.js +80 -35
- package/src/og/webgl/ProgramController.js +27 -23
- package/src/og/webgl/callbacks.js +8 -8
- package/types/Clock.d.ts +6 -2
- package/types/Deferred.d.ts +1 -1
- package/types/Events.d.ts +8 -4
- package/types/Extent.d.ts +37 -33
- package/types/Globe.d.ts +15 -13
- package/types/ImageCanvas.d.ts +5 -3
- package/types/LonLat.d.ts +24 -24
- package/types/Popup.d.ts +4 -0
- package/types/QueueArray.d.ts +6 -2
- package/types/Rectangle.d.ts +10 -4
- package/types/Stack.d.ts +4 -0
- package/types/ajax.d.ts +1 -1
- package/types/astro/earth.d.ts +3 -2
- package/types/bv/Box.d.ts +10 -5
- package/types/bv/Sphere.d.ts +13 -7
- package/types/camera/Camera.d.ts +90 -81
- package/types/camera/Frustum.d.ts +26 -22
- package/types/camera/PlanetCamera.d.ts +49 -53
- package/types/control/CompassButton.d.ts +4 -4
- package/types/control/Control.d.ts +7 -4
- package/types/control/DebugInfo.d.ts +3 -4
- package/types/control/EarthCoordinates.d.ts +6 -6
- package/types/control/EarthNavigation.d.ts +42 -0
- package/types/control/KeyboardNavigation.d.ts +3 -4
- package/types/control/LayerSwitcher.d.ts +3 -5
- package/types/control/Lighting.d.ts +3 -3
- package/types/control/MouseNavigation.d.ts +47 -0
- package/types/control/ScaleControl.d.ts +3 -3
- package/types/control/ShowFps.d.ts +3 -4
- package/types/control/SimpleNavigation.d.ts +3 -6
- package/types/control/Sun.d.ts +8 -10
- package/types/control/ToggleWireframe.d.ts +3 -3
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +3 -4
- package/types/control/index.d.ts +3 -1
- package/types/ellipsoid/Ellipsoid.d.ts +47 -43
- package/types/ellipsoid/wgs84.d.ts +3 -2
- package/types/entity/BaseBillboard.d.ts +41 -34
- package/types/entity/Billboard.d.ts +7 -7
- package/types/entity/BillboardHandler.d.ts +4 -0
- package/types/entity/Entity.d.ts +101 -83
- package/types/entity/EntityCollection.d.ts +57 -43
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +77 -0
- package/types/entity/Geometry.d.ts +9 -7
- package/types/entity/GeometryHandler.d.ts +2 -2
- package/types/entity/Label.d.ts +24 -29
- package/types/entity/LabelHandler.d.ts +9 -2
- package/types/entity/LabelWorker.d.ts +9 -0
- package/types/entity/PointCloud.d.ts +8 -8
- package/types/entity/PointCloudHandler.d.ts +3 -3
- package/types/entity/Polyline.d.ts +58 -55
- package/types/entity/Ray.d.ts +19 -18
- package/types/entity/Strip.d.ts +8 -7
- package/types/entity/StripHandler.d.ts +3 -3
- package/types/entity/index.d.ts +7 -7
- package/types/input/KeyboardHandler.d.ts +10 -0
- package/types/input/MouseHandler.d.ts +5 -0
- package/types/input/TouchHandler.d.ts +5 -0
- package/types/layer/BaseGeoImage.d.ts +23 -35
- package/types/layer/CanvasTiles.d.ts +15 -22
- package/types/layer/GeoImage.d.ts +5 -18
- package/types/layer/GeoVideo.d.ts +5 -30
- package/types/layer/KML.d.ts +20 -15
- package/types/layer/Layer.d.ts +326 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +4 -7
- package/types/layer/XYZ.d.ts +19 -25
- package/types/light/LightSource.d.ts +54 -53
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +30 -18
- package/types/math/Mat4.d.ts +71 -52
- package/types/math/Plane.d.ts +5 -4
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +102 -101
- package/types/math/Vec3.d.ts +143 -142
- package/types/math/Vec4.d.ts +40 -39
- package/types/math/coder.d.ts +12 -11
- package/types/math.d.ts +8 -8
- package/types/mercator.d.ts +3 -3
- package/types/proj/EPSG3857.d.ts +3 -2
- package/types/proj/EPSG4326.d.ts +3 -2
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +61 -0
- package/types/renderer/Renderer.d.ts +300 -0
- package/types/renderer/RendererEvents.d.ts +10 -7
- package/types/scene/BaseNode.d.ts +9 -9
- package/types/scene/Planet.d.ts +131 -126
- package/types/scene/RenderNode.d.ts +22 -23
- package/types/segment/Segment.d.ts +279 -0
- package/types/segment/SegmentLonLat.d.ts +16 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shapes/BaseShape.d.ts +43 -40
- package/types/shapes/Sphere.d.ts +7 -7
- package/types/terrain/BilTerrain.d.ts +0 -1
- package/types/terrain/EmptyTerrain.d.ts +4 -4
- package/types/terrain/GlobusTerrain.d.ts +17 -54
- package/types/terrain/MapboxTerrain.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +3 -2
- package/types/utils/TextureAtlas.d.ts +8 -8
- package/types/utils/shared.d.ts +25 -24
- package/types/webgl/Framebuffer.d.ts +5 -5
- package/types/webgl/Handler.d.ts +68 -43
- package/types/webgl/Multisample.d.ts +5 -5
- package/types/webgl/Program.d.ts +8 -2
- package/types/webgl/ProgramController.d.ts +18 -13
- package/src/og/inherits.js +0 -8
- package/src/og/utils/polylabel.js +0 -176
- package/types/inherits.d.ts +0 -4
|
@@ -2,21 +2,38 @@
|
|
|
2
2
|
* @module og/control/TouchNavigation
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import * as math from
|
|
8
|
-
import { Control } from
|
|
9
|
-
import { Key } from
|
|
10
|
-
import { LonLat } from
|
|
11
|
-
import { Quat } from
|
|
12
|
-
import { Ray } from
|
|
13
|
-
import { Sphere } from
|
|
14
|
-
import { Vec3 } from
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
import * as math from "../math.js";
|
|
8
|
+
import { Control } from "./Control.js";
|
|
9
|
+
import { Key } from "../Lock.js";
|
|
10
|
+
import { LonLat } from "../LonLat.js";
|
|
11
|
+
import { Quat } from "../math/Quat.js";
|
|
12
|
+
import { Ray } from "../math/Ray.js";
|
|
13
|
+
import { Sphere } from "../bv/Sphere.js";
|
|
14
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
15
|
+
|
|
16
|
+
class Touch {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.x = 0;
|
|
19
|
+
this.y = 0;
|
|
20
|
+
this.prev_x = 0;
|
|
21
|
+
this.prev_y = 0;
|
|
22
|
+
this.grabbedPoint = new Vec3();
|
|
23
|
+
this.grabbedSpheroid = new Sphere();
|
|
24
|
+
this.dX = function () {
|
|
25
|
+
return this.x - this.prev_x;
|
|
26
|
+
};
|
|
27
|
+
this.dY = function () {
|
|
28
|
+
return this.y - this.prev_y;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
15
32
|
|
|
16
33
|
/**
|
|
17
34
|
* Touch pad planet camera dragging control.
|
|
18
35
|
* @class
|
|
19
|
-
* @extends {
|
|
36
|
+
* @extends {Control}
|
|
20
37
|
* @param {Object} [options] - Control options.
|
|
21
38
|
*/
|
|
22
39
|
class TouchNavigation extends Control {
|
|
@@ -38,17 +55,6 @@ class TouchNavigation extends Control {
|
|
|
38
55
|
this.stepsForward = null;
|
|
39
56
|
this.stepIndex = 0;
|
|
40
57
|
|
|
41
|
-
var Touch = function () {
|
|
42
|
-
this.x = 0;
|
|
43
|
-
this.y = 0;
|
|
44
|
-
this.prev_x = 0;
|
|
45
|
-
this.prev_y = 0;
|
|
46
|
-
this.grabbedPoint = new Vec3();
|
|
47
|
-
this.grabbedSpheroid = new Sphere();
|
|
48
|
-
this.dX = function () { return this.x - this.prev_x; };
|
|
49
|
-
this.dY = function () { return this.y - this.prev_y; };
|
|
50
|
-
};
|
|
51
|
-
|
|
52
58
|
this.pointOnEarth = null;
|
|
53
59
|
this.earthUp = null;
|
|
54
60
|
|
|
@@ -67,11 +73,9 @@ class TouchNavigation extends Control {
|
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
onTouchStart(e) {
|
|
70
|
-
|
|
71
76
|
this._touching = true;
|
|
72
77
|
|
|
73
78
|
if (e.sys.touches.length === 2) {
|
|
74
|
-
|
|
75
79
|
var t0 = this.touches[0],
|
|
76
80
|
t1 = this.touches[1];
|
|
77
81
|
|
|
@@ -88,7 +92,10 @@ class TouchNavigation extends Control {
|
|
|
88
92
|
t1.grabbedPoint = this.planet.getCartesianFromPixelTerrain(t1, true);
|
|
89
93
|
|
|
90
94
|
// this.planet._viewChanged = true;
|
|
91
|
-
this.pointOnEarth = this.planet.getCartesianFromPixelTerrain(
|
|
95
|
+
this.pointOnEarth = this.planet.getCartesianFromPixelTerrain(
|
|
96
|
+
this.renderer.handler.getCenter(),
|
|
97
|
+
true
|
|
98
|
+
);
|
|
92
99
|
|
|
93
100
|
if (this.pointOnEarth) {
|
|
94
101
|
this.earthUp = this.pointOnEarth.normal();
|
|
@@ -99,7 +106,6 @@ class TouchNavigation extends Control {
|
|
|
99
106
|
t1.grabbedSpheroid.radius = t1.grabbedPoint.length();
|
|
100
107
|
this.stopRotation();
|
|
101
108
|
}
|
|
102
|
-
|
|
103
109
|
} else if (e.sys.touches.length === 1) {
|
|
104
110
|
this._startTouchOne(e);
|
|
105
111
|
}
|
|
@@ -139,12 +145,13 @@ class TouchNavigation extends Control {
|
|
|
139
145
|
var p = this.planet.getCartesianFromPixelTerrain(this.touches[0], true);
|
|
140
146
|
if (p) {
|
|
141
147
|
var g = this.planet.ellipsoid.cartesianToLonLat(p);
|
|
142
|
-
this.planet.flyLonLat(
|
|
148
|
+
this.planet.flyLonLat(
|
|
149
|
+
new LonLat(g.lon, g.lat, this.renderer.activeCamera.eye.distance(p) * 0.57)
|
|
150
|
+
);
|
|
143
151
|
}
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
onTouchEnd(e) {
|
|
147
|
-
|
|
148
155
|
if (e.sys.touches.length === 0) {
|
|
149
156
|
this._touching = false;
|
|
150
157
|
}
|
|
@@ -153,21 +160,20 @@ class TouchNavigation extends Control {
|
|
|
153
160
|
this._startTouchOne(e);
|
|
154
161
|
}
|
|
155
162
|
|
|
156
|
-
if (
|
|
157
|
-
|
|
163
|
+
if (
|
|
164
|
+
Math.abs(this.touches[0].x - this.touches[0].prev_x) < 3 &&
|
|
165
|
+
Math.abs(this.touches[0].y - this.touches[0].prev_y) < 3
|
|
166
|
+
) {
|
|
158
167
|
this.scaleRot = 0;
|
|
159
168
|
}
|
|
160
169
|
}
|
|
161
170
|
|
|
162
|
-
onTouchCancel(e) {
|
|
163
|
-
}
|
|
171
|
+
onTouchCancel(e) {}
|
|
164
172
|
|
|
165
173
|
onTouchMove(e) {
|
|
166
|
-
|
|
167
174
|
var cam = this.renderer.activeCamera;
|
|
168
175
|
|
|
169
176
|
if (e.sys.touches.length === 2) {
|
|
170
|
-
|
|
171
177
|
this.renderer.controlsBag.scaleRot = 1;
|
|
172
178
|
|
|
173
179
|
var t0 = this.touches[0],
|
|
@@ -189,9 +195,14 @@ class TouchNavigation extends Control {
|
|
|
189
195
|
t1.x = e.sys.touches.item(1).clientX - e.sys.offsetLeft;
|
|
190
196
|
t1.y = e.sys.touches.item(1).clientY - e.sys.offsetTop;
|
|
191
197
|
|
|
192
|
-
if (
|
|
193
|
-
(t0.
|
|
194
|
-
|
|
198
|
+
if (
|
|
199
|
+
(t0.dY() > 0 && t1.dY() > 0) ||
|
|
200
|
+
(t0.dY() < 0 && t1.dY() < 0) ||
|
|
201
|
+
(t0.dX() > 0 && t1.dX() > 0) ||
|
|
202
|
+
(t0.dX() < 0 && t1.dX() < 0)
|
|
203
|
+
) {
|
|
204
|
+
var l =
|
|
205
|
+
(0.5 / cam.eye.distance(this.pointOnEarth)) * cam._lonLat.height * math.RADIANS;
|
|
195
206
|
if (l > 0.007) l = 0.007;
|
|
196
207
|
cam.rotateHorizontal(l * t0.dX(), false, this.pointOnEarth, this.earthUp);
|
|
197
208
|
cam.rotateVertical(l * t0.dY(), this.pointOnEarth, true);
|
|
@@ -200,9 +211,7 @@ class TouchNavigation extends Control {
|
|
|
200
211
|
}
|
|
201
212
|
|
|
202
213
|
this.scaleRot = 0;
|
|
203
|
-
|
|
204
214
|
} else if (e.sys.touches.length === 1) {
|
|
205
|
-
|
|
206
215
|
var t = this.touches[0];
|
|
207
216
|
|
|
208
217
|
t.prev_x = t.x;
|
|
@@ -221,7 +230,10 @@ class TouchNavigation extends Control {
|
|
|
221
230
|
|
|
222
231
|
if (targetPoint) {
|
|
223
232
|
if (cam.slope > 0.2) {
|
|
224
|
-
this.qRot = Quat.getRotationBetweenVectors(
|
|
233
|
+
this.qRot = Quat.getRotationBetweenVectors(
|
|
234
|
+
targetPoint.normal(),
|
|
235
|
+
t.grabbedPoint.normal()
|
|
236
|
+
);
|
|
225
237
|
var rot = this.qRot;
|
|
226
238
|
cam.eye = rot.mulVec3(cam.eye);
|
|
227
239
|
cam._v = rot.mulVec3(cam._v);
|
|
@@ -245,10 +257,9 @@ class TouchNavigation extends Control {
|
|
|
245
257
|
}
|
|
246
258
|
}
|
|
247
259
|
}
|
|
248
|
-
}
|
|
260
|
+
}
|
|
249
261
|
|
|
250
262
|
onDraw(e) {
|
|
251
|
-
|
|
252
263
|
this.renderer.controlsBag.scaleRot = this.scaleRot;
|
|
253
264
|
|
|
254
265
|
if (this._touching) {
|
|
@@ -279,7 +290,9 @@ class TouchNavigation extends Control {
|
|
|
279
290
|
this.scaleRot = 0;
|
|
280
291
|
} else {
|
|
281
292
|
r.controlsBag.scaleRot = this.scaleRot;
|
|
282
|
-
var rot = this.qRot
|
|
293
|
+
var rot = this.qRot
|
|
294
|
+
.slerp(Quat.IDENTITY, 1 - this.scaleRot * this.scaleRot * this.scaleRot)
|
|
295
|
+
.normalize();
|
|
283
296
|
if (!(rot.x || rot.y || rot.z)) {
|
|
284
297
|
this.scaleRot = 0;
|
|
285
298
|
}
|
|
@@ -301,6 +314,6 @@ class TouchNavigation extends Control {
|
|
|
301
314
|
this.planet._normalMapCreator.free(this._keyLock);
|
|
302
315
|
}
|
|
303
316
|
}
|
|
304
|
-
}
|
|
317
|
+
}
|
|
305
318
|
|
|
306
|
-
export { TouchNavigation };
|
|
319
|
+
export { TouchNavigation };
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* @module og/control/ZoomControl
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Control } from
|
|
8
|
-
import { Key } from
|
|
7
|
+
import { Control } from "./Control.js";
|
|
8
|
+
import { Key } from "../Lock.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Planet zoom buttons control.
|
|
12
12
|
* @class
|
|
13
|
-
* @extends {
|
|
13
|
+
* @extends {Control}
|
|
14
14
|
* @params {Object} [options] - Control options.
|
|
15
15
|
*/
|
|
16
16
|
class ZoomControl extends Control {
|
|
@@ -27,13 +27,13 @@ class ZoomControl extends Control {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
oninit() {
|
|
30
|
-
var zoomDiv = document.createElement(
|
|
31
|
-
btnZoomIn = document.createElement(
|
|
32
|
-
btnZoomOut = document.createElement(
|
|
30
|
+
var zoomDiv = document.createElement("div"),
|
|
31
|
+
btnZoomIn = document.createElement("button"),
|
|
32
|
+
btnZoomOut = document.createElement("button");
|
|
33
33
|
|
|
34
|
-
zoomDiv.className =
|
|
35
|
-
btnZoomIn.className =
|
|
36
|
-
btnZoomOut.className =
|
|
34
|
+
zoomDiv.className = "ogZoomControl";
|
|
35
|
+
btnZoomIn.className = "ogZoomButton ogZoomIn";
|
|
36
|
+
btnZoomOut.className = "ogZoomButton ogZoomOut";
|
|
37
37
|
|
|
38
38
|
zoomDiv.appendChild(btnZoomIn);
|
|
39
39
|
zoomDiv.appendChild(btnZoomOut);
|
|
@@ -46,23 +46,40 @@ class ZoomControl extends Control {
|
|
|
46
46
|
btnZoomOut.addEventListener("mousedown", (e) => this.zoomOut());
|
|
47
47
|
btnZoomOut.addEventListener("mouseup", (e) => this.stopZoom());
|
|
48
48
|
|
|
49
|
-
btnZoomIn.addEventListener(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
btnZoomIn.addEventListener("touchstart", (e) => {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
this.zoomIn();
|
|
52
|
+
});
|
|
53
|
+
btnZoomIn.addEventListener("touchend", (e) => {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
this.stopZoom();
|
|
56
|
+
});
|
|
57
|
+
btnZoomIn.addEventListener("touchcancel", (e) => {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
this.stopZoom();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
btnZoomOut.addEventListener("touchstart", (e) => {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
this.zoomOut();
|
|
65
|
+
});
|
|
66
|
+
btnZoomOut.addEventListener("touchend", (e) => {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
this.stopZoom();
|
|
69
|
+
});
|
|
70
|
+
btnZoomOut.addEventListener("touchcancel", (e) => {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
this.stopZoom();
|
|
73
|
+
});
|
|
56
74
|
|
|
57
75
|
this.renderer.events.on("draw", this._draw, this);
|
|
58
76
|
}
|
|
59
77
|
|
|
60
|
-
/**
|
|
78
|
+
/**
|
|
61
79
|
* Planet zoom in.
|
|
62
80
|
* @public
|
|
63
81
|
*/
|
|
64
82
|
zoomIn() {
|
|
65
|
-
|
|
66
83
|
this.planet.layerLock.lock(this._keyLock);
|
|
67
84
|
this.planet.terrainLock.lock(this._keyLock);
|
|
68
85
|
this.planet._normalMapCreator.lock(this._keyLock);
|
|
@@ -72,12 +89,11 @@ class ZoomControl extends Control {
|
|
|
72
89
|
this._move = 1;
|
|
73
90
|
}
|
|
74
91
|
|
|
75
|
-
/**
|
|
92
|
+
/**
|
|
76
93
|
* Planet zoom out.
|
|
77
94
|
* @public
|
|
78
95
|
*/
|
|
79
96
|
zoomOut() {
|
|
80
|
-
|
|
81
97
|
this.planet.layerLock.lock(this._keyLock);
|
|
82
98
|
this.planet.terrainLock.lock(this._keyLock);
|
|
83
99
|
this.planet._normalMapCreator.lock(this._keyLock);
|
|
@@ -87,7 +103,6 @@ class ZoomControl extends Control {
|
|
|
87
103
|
}
|
|
88
104
|
|
|
89
105
|
stopZoom() {
|
|
90
|
-
|
|
91
106
|
this._move = 0;
|
|
92
107
|
|
|
93
108
|
this.planet.layerLock.free(this._keyLock);
|
|
@@ -96,12 +111,13 @@ class ZoomControl extends Control {
|
|
|
96
111
|
}
|
|
97
112
|
|
|
98
113
|
_draw(e) {
|
|
99
|
-
|
|
100
114
|
var cam = this.renderer.activeCamera;
|
|
101
115
|
|
|
102
116
|
if (this._move !== 0) {
|
|
103
|
-
var d =
|
|
104
|
-
|
|
117
|
+
var d =
|
|
118
|
+
cam.eye.distance(
|
|
119
|
+
this.planet.getCartesianFromPixelTerrain(this._targetPoint, true)
|
|
120
|
+
) * 0.075;
|
|
105
121
|
cam.eye.addA(cam.getForward().scale(this._move * d));
|
|
106
122
|
cam.checkTerrainCollision();
|
|
107
123
|
cam.update();
|
package/src/og/control/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Control } from "./Control.js";
|
|
2
|
+
import { CompassButton } from "./CompassButton.js";
|
|
2
3
|
import { DebugInfo } from "./DebugInfo";
|
|
4
|
+
import { EarthNavigation } from "./EarthNavigation.js";
|
|
3
5
|
import { EarthCoordinates } from "./EarthCoordinates.js";
|
|
4
6
|
import { GeoImageDragControl } from "./GeoImageDragControl.js";
|
|
5
7
|
import { KeyboardNavigation } from "./KeyboardNavigation.js";
|
|
@@ -15,7 +17,9 @@ import { Lighting } from "./Lighting.js";
|
|
|
15
17
|
|
|
16
18
|
export {
|
|
17
19
|
Control,
|
|
20
|
+
CompassButton,
|
|
18
21
|
DebugInfo,
|
|
22
|
+
EarthNavigation,
|
|
19
23
|
EarthCoordinates,
|
|
20
24
|
GeoImageDragControl,
|
|
21
25
|
KeyboardNavigation,
|