@openglobus/og 0.12.4 → 0.13.0
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/README.md +0 -2
- 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 +7 -7
- package/src/og/Extent.js +3 -3
- package/src/og/Globe.js +277 -275
- package/src/og/ImageCanvas.js +3 -3
- package/src/og/LonLat.js +9 -9
- package/src/og/QueueArray.js +2 -2
- package/src/og/Rectangle.js +5 -5
- package/src/og/bv/Box.js +1 -1
- package/src/og/bv/Sphere.js +2 -2
- package/src/og/camera/Camera.js +1 -1
- package/src/og/camera/PlanetCamera.js +649 -646
- package/src/og/control/LayerSwitcher.js +1 -1
- package/src/og/control/MouseNavigation.js +22 -13
- package/src/og/control/MouseWheelZoomControl.js +2 -2
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/TouchNavigation.js +319 -319
- package/src/og/control/ZoomControl.js +132 -132
- package/src/og/control/visibleExtent/Segment.js +12 -12
- package/src/og/ellipsoid/Ellipsoid.js +577 -567
- package/src/og/entity/BillboardHandler.js +878 -1051
- package/src/og/entity/Entity.js +1 -1
- package/src/og/entity/EntityCollection.js +847 -857
- package/src/og/entity/GeoObjectHandler.js +2 -2
- package/src/og/entity/LabelHandler.js +888 -1040
- package/src/og/entity/LabelWorker.js +0 -6
- package/src/og/entity/PointCloud.js +495 -495
- package/src/og/entity/Polyline.js +2218 -2222
- package/src/og/entity/RayHandler.js +1 -1
- package/src/og/layer/CanvasTiles.js +6 -3
- package/src/og/layer/GeoImage.js +1 -1
- package/src/og/layer/KML.js +5 -5
- package/src/og/layer/Layer.js +800 -752
- package/src/og/layer/Vector.js +997 -1010
- package/src/og/layer/XYZ.js +359 -357
- package/src/og/math/Line2.js +4 -4
- package/src/og/math/Quat.js +2 -2
- package/src/og/math/Ray.js +2 -2
- package/src/og/math/Vec2.js +524 -524
- package/src/og/math/Vec3.js +900 -900
- package/src/og/math/Vec4.js +261 -261
- package/src/og/math.js +397 -398
- package/src/og/quadTree/EntityCollectionNode.js +389 -387
- package/src/og/renderer/Renderer.js +14 -20
- package/src/og/renderer/RendererEvents.js +1034 -1045
- package/src/og/scene/Planet.js +12 -9
- package/src/og/scene/RenderNode.js +347 -354
- package/src/og/segment/Segment.js +3 -1
- package/src/og/segment/SegmentLonLat.js +1 -4
- package/src/og/shaders/billboard.js +220 -204
- package/src/og/shaders/drawnode.js +603 -603
- package/src/og/shaders/label.js +596 -456
- package/src/og/shaders/polyline.js +365 -361
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/FontAtlas.js +209 -200
- package/src/og/utils/GeoImageCreator.js +4 -5
- package/src/og/utils/TextureAtlas.js +4 -4
- package/src/og/utils/VectorTileCreator.js +414 -414
- package/src/og/utils/shared.js +1 -1
- package/src/og/webgl/Handler.js +28 -60
- package/src/og/webgl/Multisample.js +260 -260
- package/src/og/webgl/Program.js +411 -396
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +1 -1
- package/types/camera/PlanetCamera.d.ts +3 -3
- package/types/control/LayerSwitcher.d.ts +1 -1
- package/types/ellipsoid/Ellipsoid.d.ts +9 -2
- package/types/entity/BillboardHandler.d.ts +0 -4
- package/types/entity/EntityCollection.d.ts +0 -8
- package/types/entity/LabelHandler.d.ts +0 -2
- package/types/entity/Polyline.d.ts +1 -1
- package/types/layer/KML.d.ts +11 -11
- package/types/layer/Layer.d.ts +4 -0
- package/types/layer/Vector.d.ts +1 -8
- package/types/math/Line2.d.ts +4 -4
- package/types/math/Ray.d.ts +2 -2
- package/types/math/Vec2.d.ts +1 -1
- package/types/math/Vec3.d.ts +1 -1
- package/types/math/Vec4.d.ts +2 -2
- package/types/math.d.ts +1 -1
- package/types/renderer/Renderer.d.ts +1 -1
- package/types/renderer/RendererEvents.d.ts +1 -1
- package/types/shaders/label.d.ts +1 -1
- package/types/utils/FontAtlas.d.ts +3 -2
- package/types/utils/TextureAtlas.d.ts +3 -3
- package/types/utils/VectorTileCreator.d.ts +4 -4
- package/types/utils/shared.d.ts +1 -1
- package/types/webgl/Handler.d.ts +6 -31
- package/types/webgl/Program.d.ts +2 -0
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/control/ZoomControl
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
"use strict";
|
|
6
|
-
|
|
7
|
-
import { Control } from "./Control.js";
|
|
8
|
-
import { Key } from "../Lock.js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Planet zoom buttons control.
|
|
12
|
-
* @class
|
|
13
|
-
* @extends {Control}
|
|
14
|
-
* @params {Object} [options] - Control options.
|
|
15
|
-
*/
|
|
16
|
-
class ZoomControl extends Control {
|
|
17
|
-
constructor(options) {
|
|
18
|
-
super(options);
|
|
19
|
-
|
|
20
|
-
options = options || {};
|
|
21
|
-
|
|
22
|
-
this._keyLock = new Key();
|
|
23
|
-
|
|
24
|
-
this.planet = null;
|
|
25
|
-
|
|
26
|
-
this._move = 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
oninit() {
|
|
30
|
-
var zoomDiv = document.createElement("div"),
|
|
31
|
-
btnZoomIn = document.createElement("button"),
|
|
32
|
-
btnZoomOut = document.createElement("button");
|
|
33
|
-
|
|
34
|
-
zoomDiv.className = "ogZoomControl";
|
|
35
|
-
btnZoomIn.className = "ogZoomButton ogZoomIn";
|
|
36
|
-
btnZoomOut.className = "ogZoomButton ogZoomOut";
|
|
37
|
-
|
|
38
|
-
zoomDiv.appendChild(btnZoomIn);
|
|
39
|
-
zoomDiv.appendChild(btnZoomOut);
|
|
40
|
-
|
|
41
|
-
this.renderer.div.appendChild(zoomDiv);
|
|
42
|
-
|
|
43
|
-
btnZoomIn.addEventListener("mousedown", (e) => this.zoomIn());
|
|
44
|
-
btnZoomIn.addEventListener("mouseup", (e) => this.stopZoom());
|
|
45
|
-
|
|
46
|
-
btnZoomOut.addEventListener("mousedown", (e) => this.zoomOut());
|
|
47
|
-
btnZoomOut.addEventListener("mouseup", (e) => this.stopZoom());
|
|
48
|
-
|
|
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
|
-
});
|
|
74
|
-
|
|
75
|
-
this.renderer.events.on("draw", this._draw, this);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Planet zoom in.
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
|
-
zoomIn() {
|
|
83
|
-
this.planet.layerLock.lock(this._keyLock);
|
|
84
|
-
this.planet.terrainLock.lock(this._keyLock);
|
|
85
|
-
this.planet._normalMapCreator.lock(this._keyLock);
|
|
86
|
-
|
|
87
|
-
this._targetPoint = this.renderer.getCenter();
|
|
88
|
-
|
|
89
|
-
this._move = 1;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Planet zoom out.
|
|
94
|
-
* @public
|
|
95
|
-
*/
|
|
96
|
-
zoomOut() {
|
|
97
|
-
this.planet.layerLock.lock(this._keyLock);
|
|
98
|
-
this.planet.terrainLock.lock(this._keyLock);
|
|
99
|
-
this.planet._normalMapCreator.lock(this._keyLock);
|
|
100
|
-
|
|
101
|
-
this._targetPoint = this.renderer.getCenter();
|
|
102
|
-
this._move = -1;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
stopZoom() {
|
|
106
|
-
this._move = 0;
|
|
107
|
-
|
|
108
|
-
this.planet.layerLock.free(this._keyLock);
|
|
109
|
-
this.planet.terrainLock.free(this._keyLock);
|
|
110
|
-
this.planet._normalMapCreator.free(this._keyLock);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
_draw(e) {
|
|
114
|
-
var cam = this.renderer.activeCamera;
|
|
115
|
-
|
|
116
|
-
if (this._move !== 0) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
) *
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export function zoomControl(options) {
|
|
129
|
-
return new ZoomControl(options);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { ZoomControl };
|
|
1
|
+
/**
|
|
2
|
+
* @module og/control/ZoomControl
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
import { Control } from "./Control.js";
|
|
8
|
+
import { Key } from "../Lock.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Planet zoom buttons control.
|
|
12
|
+
* @class
|
|
13
|
+
* @extends {Control}
|
|
14
|
+
* @params {Object} [options] - Control options.
|
|
15
|
+
*/
|
|
16
|
+
class ZoomControl extends Control {
|
|
17
|
+
constructor(options) {
|
|
18
|
+
super(options);
|
|
19
|
+
|
|
20
|
+
options = options || {};
|
|
21
|
+
|
|
22
|
+
this._keyLock = new Key();
|
|
23
|
+
|
|
24
|
+
this.planet = null;
|
|
25
|
+
|
|
26
|
+
this._move = 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
oninit() {
|
|
30
|
+
var zoomDiv = document.createElement("div"),
|
|
31
|
+
btnZoomIn = document.createElement("button"),
|
|
32
|
+
btnZoomOut = document.createElement("button");
|
|
33
|
+
|
|
34
|
+
zoomDiv.className = "ogZoomControl";
|
|
35
|
+
btnZoomIn.className = "ogZoomButton ogZoomIn";
|
|
36
|
+
btnZoomOut.className = "ogZoomButton ogZoomOut";
|
|
37
|
+
|
|
38
|
+
zoomDiv.appendChild(btnZoomIn);
|
|
39
|
+
zoomDiv.appendChild(btnZoomOut);
|
|
40
|
+
|
|
41
|
+
this.renderer.div.appendChild(zoomDiv);
|
|
42
|
+
|
|
43
|
+
btnZoomIn.addEventListener("mousedown", (e) => this.zoomIn());
|
|
44
|
+
btnZoomIn.addEventListener("mouseup", (e) => this.stopZoom());
|
|
45
|
+
|
|
46
|
+
btnZoomOut.addEventListener("mousedown", (e) => this.zoomOut());
|
|
47
|
+
btnZoomOut.addEventListener("mouseup", (e) => this.stopZoom());
|
|
48
|
+
|
|
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
|
+
});
|
|
74
|
+
|
|
75
|
+
this.renderer.events.on("draw", this._draw, this);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Planet zoom in.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
zoomIn() {
|
|
83
|
+
this.planet.layerLock.lock(this._keyLock);
|
|
84
|
+
this.planet.terrainLock.lock(this._keyLock);
|
|
85
|
+
this.planet._normalMapCreator.lock(this._keyLock);
|
|
86
|
+
|
|
87
|
+
this._targetPoint = this.renderer.getCenter();
|
|
88
|
+
|
|
89
|
+
this._move = 1;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Planet zoom out.
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
zoomOut() {
|
|
97
|
+
this.planet.layerLock.lock(this._keyLock);
|
|
98
|
+
this.planet.terrainLock.lock(this._keyLock);
|
|
99
|
+
this.planet._normalMapCreator.lock(this._keyLock);
|
|
100
|
+
|
|
101
|
+
this._targetPoint = this.renderer.getCenter();
|
|
102
|
+
this._move = -1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
stopZoom() {
|
|
106
|
+
this._move = 0;
|
|
107
|
+
|
|
108
|
+
this.planet.layerLock.free(this._keyLock);
|
|
109
|
+
this.planet.terrainLock.free(this._keyLock);
|
|
110
|
+
this.planet._normalMapCreator.free(this._keyLock);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
_draw(e) {
|
|
114
|
+
var cam = this.renderer.activeCamera;
|
|
115
|
+
|
|
116
|
+
if (this._move !== 0) {
|
|
117
|
+
let pos = this.planet.getCartesianFromPixelTerrain(this._targetPoint);
|
|
118
|
+
if (pos) {
|
|
119
|
+
let d = cam.eye.distance(pos) * 0.035;
|
|
120
|
+
cam.eye.addA(cam.getForward().scale(this._move * d));
|
|
121
|
+
cam.checkTerrainCollision();
|
|
122
|
+
cam.update();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function zoomControl(options) {
|
|
129
|
+
return new ZoomControl(options);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { ZoomControl };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import * as mercator from "
|
|
4
|
-
import { N, E, S, W, OPSIDE, NOTRENDERING } from "
|
|
5
|
-
import { EPSG3857 } from "
|
|
6
|
-
import { Extent } from "
|
|
7
|
-
import { Layer } from "
|
|
8
|
-
import { LonLat } from "
|
|
9
|
-
import { Ray } from "
|
|
10
|
-
import { Sphere } from "
|
|
11
|
-
import { Box } from "
|
|
12
|
-
import { Vec3 } from "
|
|
13
|
-
import * as segmentHelper from "
|
|
14
|
-
import { getMatrixSubArray } from "
|
|
3
|
+
import * as mercator from "../../mercator.js";
|
|
4
|
+
import { N, E, S, W, OPSIDE, NOTRENDERING } from "../../quadTree/quadTree.js";
|
|
5
|
+
import { EPSG3857 } from "../../proj/EPSG3857.js";
|
|
6
|
+
import { Extent } from "../../Extent.js";
|
|
7
|
+
import { Layer } from "../../layer/Layer.js";
|
|
8
|
+
import { LonLat } from "../../LonLat.js";
|
|
9
|
+
import { Ray } from "../../math/Ray.js";
|
|
10
|
+
import { Sphere } from "../../bv/Sphere.js";
|
|
11
|
+
import { Box } from "../../bv/Box.js";
|
|
12
|
+
import { Vec3 } from "../../math/Vec3.js";
|
|
13
|
+
import * as segmentHelper from "../../segment/segmentHelper.js";
|
|
14
|
+
import { getMatrixSubArray } from "../../utils/shared.js";
|
|
15
15
|
|
|
16
16
|
export const MAX_NORMAL_ZOOM = 7;
|
|
17
17
|
|