@antv/l7-map 2.5.33 → 2.5.37-mini
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/camera.js.map +1 -1
- package/lib/earthmap.js +7 -26
- package/lib/earthmap.js.map +1 -1
- package/lib/handler/handler_manager.js +55 -33
- package/lib/handler/handler_manager.js.map +1 -1
- package/lib/handler/scroll_zoom.js +1 -1
- package/lib/handler/scroll_zoom.js.map +1 -1
- package/lib/handler/shim/drag_pan.js +10 -2
- package/lib/handler/shim/drag_pan.js.map +1 -1
- package/lib/handler/shim/touch_zoom_rotate.js +10 -2
- package/lib/handler/shim/touch_zoom_rotate.js.map +1 -1
- package/lib/hash.js +9 -4
- package/lib/hash.js.map +1 -1
- package/lib/map.js +39 -19
- package/lib/map.js.map +1 -1
- package/lib/util.js +7 -5
- package/lib/util.js.map +1 -1
- package/lib/utils/dom.js +66 -26
- package/lib/utils/dom.js.map +1 -1
- package/lib/utils/performance.js +4 -1
- package/lib/utils/performance.js.map +1 -1
- package/package.json +3 -3
- package/LICENSE.md +0 -21
- package/es/camera.d.ts +0 -82
- package/es/camera.js +0 -729
- package/es/camera.js.map +0 -1
- package/es/earthmap.d.ts +0 -67
- package/es/earthmap.js +0 -454
- package/es/earthmap.js.map +0 -1
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -88
- package/es/geo/edge_insets.js.map +0 -1
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -77
- package/es/geo/lng_lat.js.map +0 -1
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -170
- package/es/geo/lng_lat_bounds.js.map +0 -1
- package/es/geo/mercator.d.ts +0 -28
- package/es/geo/mercator.js +0 -79
- package/es/geo/mercator.js.map +0 -1
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -237
- package/es/geo/point.js.map +0 -1
- package/es/geo/simple.d.ts +0 -28
- package/es/geo/simple.js +0 -78
- package/es/geo/simple.js.map +0 -1
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -663
- package/es/geo/transform.js.map +0 -1
- package/es/handler/IHandler.d.ts +0 -34
- package/es/handler/IHandler.js +0 -2
- package/es/handler/IHandler.js.map +0 -1
- package/es/handler/blockable_map_event.d.ts +0 -17
- package/es/handler/blockable_map_event.js +0 -84
- package/es/handler/blockable_map_event.js.map +0 -1
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -184
- package/es/handler/box_zoom.js.map +0 -1
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -64
- package/es/handler/click_zoom.js.map +0 -1
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -14
- package/es/handler/events/event.js.map +0 -1
- package/es/handler/events/index.d.ts +0 -4
- package/es/handler/events/index.js +0 -5
- package/es/handler/events/index.js.map +0 -1
- package/es/handler/events/map_mouse_event.d.ts +0 -34
- package/es/handler/events/map_mouse_event.js +0 -65
- package/es/handler/events/map_mouse_event.js.map +0 -1
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -75
- package/es/handler/events/map_touch_event.js.map +0 -1
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -52
- package/es/handler/events/map_wheel_event.js.map +0 -1
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -41
- package/es/handler/events/render_event.js.map +0 -1
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -186
- package/es/handler/handler_inertia.js.map +0 -1
- package/es/handler/handler_manager.d.ts +0 -57
- package/es/handler/handler_manager.js +0 -655
- package/es/handler/handler_manager.js.map +0 -1
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -10
- package/es/handler/handler_util.js.map +0 -1
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -157
- package/es/handler/keyboard.js.map +0 -1
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -120
- package/es/handler/map_event.js.map +0 -1
- package/es/handler/mouse/index.d.ts +0 -4
- package/es/handler/mouse/index.js +0 -5
- package/es/handler/mouse/index.js.map +0 -1
- package/es/handler/mouse/mouse_handler.d.ts +0 -22
- package/es/handler/mouse/mouse_handler.js +0 -131
- package/es/handler/mouse/mouse_handler.js.map +0 -1
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -54
- package/es/handler/mouse/mousepan_handler.js.map +0 -1
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -54
- package/es/handler/mouse/mousepitch_hander.js.map +0 -1
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -54
- package/es/handler/mouse/mouserotate_hander.js.map +0 -1
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -12
- package/es/handler/mouse/util.js.map +0 -1
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -317
- package/es/handler/scroll_zoom.js.map +0 -1
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -45
- package/es/handler/shim/dblclick_zoom.js.map +0 -1
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -53
- package/es/handler/shim/drag_pan.js.map +0 -1
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -51
- package/es/handler/shim/drag_rotate.js.map +0 -1
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -80
- package/es/handler/shim/touch_zoom_rotate.js.map +0 -1
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -127
- package/es/handler/tap/single_tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -124
- package/es/handler/tap/tap_drag_zoom.js.map +0 -1
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -72
- package/es/handler/tap/tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -124
- package/es/handler/tap/tap_zoom.js.map +0 -1
- package/es/handler/touch/index.d.ts +0 -5
- package/es/handler/touch/index.js +0 -6
- package/es/handler/touch/index.js.map +0 -1
- package/es/handler/touch/touch_pan.d.ts +0 -30
- package/es/handler/touch/touch_pan.js +0 -139
- package/es/handler/touch/touch_pan.js.map +0 -1
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -120
- package/es/handler/touch/touch_pitch.js.map +0 -1
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -88
- package/es/handler/touch/touch_rotate.js.map +0 -1
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -79
- package/es/handler/touch/touch_zoom.js.map +0 -1
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -140
- package/es/handler/touch/two_touch.js.map +0 -1
- package/es/hash.d.ts +0 -15
- package/es/hash.js +0 -143
- package/es/hash.js.map +0 -1
- package/es/index.d.ts +0 -2
- package/es/index.js +0 -3
- package/es/index.js.map +0 -1
- package/es/interface.d.ts +0 -31
- package/es/interface.js +0 -2
- package/es/interface.js.map +0 -1
- package/es/map.d.ts +0 -67
- package/es/map.js +0 -454
- package/es/map.js.map +0 -1
- package/es/util.d.ts +0 -18
- package/es/util.js +0 -74
- package/es/util.js.map +0 -1
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -134
- package/es/utils/Aabb.js.map +0 -1
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -165
- package/es/utils/dom.js.map +0 -1
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -57
- package/es/utils/performance.js.map +0 -1
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -44
- package/es/utils/primitives.js.map +0 -1
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -113
- package/es/utils/task_queue.js.map +0 -1
package/es/map.js
DELETED
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import _merge from "lodash/merge";
|
|
9
|
-
|
|
10
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
|
|
12
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
|
|
14
|
-
import { DOM } from '@antv/l7-utils';
|
|
15
|
-
import Camera from './camera';
|
|
16
|
-
|
|
17
|
-
function loadStyles(css, doc) {
|
|
18
|
-
if (!doc) doc = document;
|
|
19
|
-
|
|
20
|
-
if (!doc) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var head = doc.head || doc.getElementsByTagName('head')[0];
|
|
25
|
-
|
|
26
|
-
if (!head) {
|
|
27
|
-
head = doc.createElement('head');
|
|
28
|
-
var body = doc.body || doc.getElementsByTagName('body')[0];
|
|
29
|
-
|
|
30
|
-
if (body) {
|
|
31
|
-
body.parentNode.insertBefore(head, body);
|
|
32
|
-
} else {
|
|
33
|
-
doc.documentElement.appendChild(head);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var style = doc.createElement('style');
|
|
38
|
-
style.type = 'text/css';
|
|
39
|
-
|
|
40
|
-
if (style.styleSheet) {
|
|
41
|
-
style.styleSheet.cssText = css;
|
|
42
|
-
} else {
|
|
43
|
-
style.appendChild(doc.createTextNode(css));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
head.appendChild(style);
|
|
47
|
-
return style;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
loadStyles(".l7-map {\n font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.l7-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.l7-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n\n.l7-canary {\n background-color: salmon;\n}\n\n.l7-canvas-container.l7-interactive,\n.l7-ctrl-group button.l7-ctrl-compass {\n cursor: -webkit-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.l7-canvas-container.l7-interactive.l7-track-pointer {\n cursor: pointer;\n}\n\n.l7-canvas-container.l7-interactive:active,\n.l7-ctrl-group button.l7-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate,\n.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.l7-canvas-container.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: pinch-zoom;\n touch-action: pinch-zoom;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.l7-ctrl-top-left,\n.l7-ctrl-top-right,\n.l7-ctrl-bottom-left,\n.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }\n.l7-ctrl-top-left { top: 0; left: 0; }\n.l7-ctrl-top-right { top: 0; right: 0; }\n.l7-ctrl-bottom-left { bottom: 0; left: 0; }\n.l7-ctrl-bottom-right { right: 0; bottom: 0; }\n\n.l7-ctrl {\n clear: both;\n pointer-events: auto;\n\n /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */\n -webkit-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }\n.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }\n.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }\n.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }\n\n\n.l7-crosshair,\n.l7-crosshair .l7-interactive,\n.l7-crosshair .l7-interactive:active {\n cursor: crosshair;\n}\n\n.l7-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: 0.5;\n z-index: 10;\n}\n");
|
|
51
|
-
import LngLat from './geo/lng_lat';
|
|
52
|
-
import LngLatBounds from './geo/lng_lat_bounds';
|
|
53
|
-
import Point from './geo/point';
|
|
54
|
-
import HandlerManager from './handler/handler_manager';
|
|
55
|
-
import Hash from './hash';
|
|
56
|
-
import { renderframe } from './util';
|
|
57
|
-
import { PerformanceUtils } from './utils/performance';
|
|
58
|
-
import TaskQueue from './utils/task_queue';
|
|
59
|
-
var defaultMinZoom = -2;
|
|
60
|
-
var defaultMaxZoom = 22;
|
|
61
|
-
var defaultMinPitch = 0;
|
|
62
|
-
var defaultMaxPitch = 60;
|
|
63
|
-
var DefaultOptions = {
|
|
64
|
-
hash: false,
|
|
65
|
-
zoom: -1,
|
|
66
|
-
center: [112, 32],
|
|
67
|
-
pitch: 0,
|
|
68
|
-
bearing: 0,
|
|
69
|
-
interactive: true,
|
|
70
|
-
minZoom: defaultMinZoom,
|
|
71
|
-
maxZoom: defaultMaxZoom,
|
|
72
|
-
minPitch: defaultMinPitch,
|
|
73
|
-
maxPitch: defaultMaxPitch,
|
|
74
|
-
scrollZoom: true,
|
|
75
|
-
boxZoom: true,
|
|
76
|
-
dragRotate: true,
|
|
77
|
-
dragPan: true,
|
|
78
|
-
keyboard: true,
|
|
79
|
-
doubleClickZoom: true,
|
|
80
|
-
touchZoomRotate: true,
|
|
81
|
-
touchPitch: true,
|
|
82
|
-
bearingSnap: 7,
|
|
83
|
-
clickTolerance: 3,
|
|
84
|
-
pitchWithRotate: true,
|
|
85
|
-
trackResize: true,
|
|
86
|
-
renderWorldCopies: true
|
|
87
|
-
};
|
|
88
|
-
export var Map = function (_Camera) {
|
|
89
|
-
_inherits(Map, _Camera);
|
|
90
|
-
|
|
91
|
-
var _super = _createSuper(Map);
|
|
92
|
-
|
|
93
|
-
function Map(options) {
|
|
94
|
-
var _this;
|
|
95
|
-
|
|
96
|
-
_classCallCheck(this, Map);
|
|
97
|
-
|
|
98
|
-
_this = _super.call(this, _merge({}, DefaultOptions, options));
|
|
99
|
-
|
|
100
|
-
_defineProperty(_assertThisInitialized(_this), "doubleClickZoom", void 0);
|
|
101
|
-
|
|
102
|
-
_defineProperty(_assertThisInitialized(_this), "dragRotate", void 0);
|
|
103
|
-
|
|
104
|
-
_defineProperty(_assertThisInitialized(_this), "dragPan", void 0);
|
|
105
|
-
|
|
106
|
-
_defineProperty(_assertThisInitialized(_this), "touchZoomRotate", void 0);
|
|
107
|
-
|
|
108
|
-
_defineProperty(_assertThisInitialized(_this), "scrollZoom", void 0);
|
|
109
|
-
|
|
110
|
-
_defineProperty(_assertThisInitialized(_this), "keyboard", void 0);
|
|
111
|
-
|
|
112
|
-
_defineProperty(_assertThisInitialized(_this), "touchPitch", void 0);
|
|
113
|
-
|
|
114
|
-
_defineProperty(_assertThisInitialized(_this), "boxZoom", void 0);
|
|
115
|
-
|
|
116
|
-
_defineProperty(_assertThisInitialized(_this), "handlers", void 0);
|
|
117
|
-
|
|
118
|
-
_defineProperty(_assertThisInitialized(_this), "container", void 0);
|
|
119
|
-
|
|
120
|
-
_defineProperty(_assertThisInitialized(_this), "canvas", void 0);
|
|
121
|
-
|
|
122
|
-
_defineProperty(_assertThisInitialized(_this), "canvasContainer", void 0);
|
|
123
|
-
|
|
124
|
-
_defineProperty(_assertThisInitialized(_this), "renderTaskQueue", new TaskQueue());
|
|
125
|
-
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "frame", void 0);
|
|
127
|
-
|
|
128
|
-
_defineProperty(_assertThisInitialized(_this), "trackResize", true);
|
|
129
|
-
|
|
130
|
-
_defineProperty(_assertThisInitialized(_this), "hash", void 0);
|
|
131
|
-
|
|
132
|
-
_defineProperty(_assertThisInitialized(_this), "onWindowOnline", function () {
|
|
133
|
-
_this.update();
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
_defineProperty(_assertThisInitialized(_this), "onWindowResize", function (event) {
|
|
137
|
-
if (_this.trackResize) {
|
|
138
|
-
_this.resize({
|
|
139
|
-
originalEvent: event
|
|
140
|
-
}).update();
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
_this.initContainer();
|
|
145
|
-
|
|
146
|
-
_this.resize();
|
|
147
|
-
|
|
148
|
-
_this.handlers = new HandlerManager(_assertThisInitialized(_this), _this.options);
|
|
149
|
-
|
|
150
|
-
if (typeof window !== 'undefined') {
|
|
151
|
-
window.addEventListener('online', _this.onWindowOnline, false);
|
|
152
|
-
window.addEventListener('resize', _this.onWindowResize, false);
|
|
153
|
-
window.addEventListener('orientationchange', _this.onWindowResize, false);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
var hashName = typeof options.hash === 'string' && options.hash || undefined;
|
|
157
|
-
|
|
158
|
-
if (options.hash) {
|
|
159
|
-
_this.hash = new Hash(hashName).addTo(_assertThisInitialized(_this));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (!_this.hash || !_this.hash.onHashChange()) {
|
|
163
|
-
_this.jumpTo({
|
|
164
|
-
center: options.center,
|
|
165
|
-
zoom: options.zoom,
|
|
166
|
-
bearing: options.bearing,
|
|
167
|
-
pitch: options.pitch
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
if (options.bounds) {
|
|
171
|
-
_this.resize();
|
|
172
|
-
|
|
173
|
-
_this.fitBounds(options.bounds, _merge({}, options.fitBoundsOptions, {
|
|
174
|
-
duration: 0
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return _this;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
_createClass(Map, [{
|
|
183
|
-
key: "resize",
|
|
184
|
-
value: function resize(eventData) {
|
|
185
|
-
var dimensions = this.containerDimensions();
|
|
186
|
-
var width = dimensions[0];
|
|
187
|
-
var height = dimensions[1];
|
|
188
|
-
this.transform.resize(width, height);
|
|
189
|
-
var fireMoving = !this.moving;
|
|
190
|
-
|
|
191
|
-
if (fireMoving) {
|
|
192
|
-
this.stop();
|
|
193
|
-
this.emit('movestart', new Event('movestart', eventData));
|
|
194
|
-
this.emit('move', new Event('move', eventData));
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
this.emit('resize', new Event('resize', eventData));
|
|
198
|
-
|
|
199
|
-
if (fireMoving) {
|
|
200
|
-
this.emit('moveend', new Event('moveend', eventData));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return this;
|
|
204
|
-
}
|
|
205
|
-
}, {
|
|
206
|
-
key: "getContainer",
|
|
207
|
-
value: function getContainer() {
|
|
208
|
-
return this.container;
|
|
209
|
-
}
|
|
210
|
-
}, {
|
|
211
|
-
key: "getCanvas",
|
|
212
|
-
value: function getCanvas() {
|
|
213
|
-
return this.canvas;
|
|
214
|
-
}
|
|
215
|
-
}, {
|
|
216
|
-
key: "getCanvasContainer",
|
|
217
|
-
value: function getCanvasContainer() {
|
|
218
|
-
return this.canvasContainer;
|
|
219
|
-
}
|
|
220
|
-
}, {
|
|
221
|
-
key: "project",
|
|
222
|
-
value: function project(lngLat) {
|
|
223
|
-
return this.transform.locationPoint(LngLat.convert(lngLat));
|
|
224
|
-
}
|
|
225
|
-
}, {
|
|
226
|
-
key: "unproject",
|
|
227
|
-
value: function unproject(point) {
|
|
228
|
-
return this.transform.pointLocation(Point.convert(point));
|
|
229
|
-
}
|
|
230
|
-
}, {
|
|
231
|
-
key: "getBounds",
|
|
232
|
-
value: function getBounds() {
|
|
233
|
-
return this.transform.getBounds();
|
|
234
|
-
}
|
|
235
|
-
}, {
|
|
236
|
-
key: "getMaxBounds",
|
|
237
|
-
value: function getMaxBounds() {
|
|
238
|
-
return this.transform.getMaxBounds();
|
|
239
|
-
}
|
|
240
|
-
}, {
|
|
241
|
-
key: "setMaxBounds",
|
|
242
|
-
value: function setMaxBounds(bounds) {
|
|
243
|
-
this.transform.setMaxBounds(LngLatBounds.convert(bounds));
|
|
244
|
-
}
|
|
245
|
-
}, {
|
|
246
|
-
key: "setStyle",
|
|
247
|
-
value: function setStyle(style) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
}, {
|
|
251
|
-
key: "setMinZoom",
|
|
252
|
-
value: function setMinZoom(minZoom) {
|
|
253
|
-
minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
|
|
254
|
-
|
|
255
|
-
if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
|
|
256
|
-
this.transform.minZoom = minZoom;
|
|
257
|
-
|
|
258
|
-
if (this.getZoom() < minZoom) {
|
|
259
|
-
this.setZoom(minZoom);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return this;
|
|
263
|
-
} else {
|
|
264
|
-
throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}, {
|
|
268
|
-
key: "getMinZoom",
|
|
269
|
-
value: function getMinZoom() {
|
|
270
|
-
return this.transform.minZoom;
|
|
271
|
-
}
|
|
272
|
-
}, {
|
|
273
|
-
key: "setMaxZoom",
|
|
274
|
-
value: function setMaxZoom(maxZoom) {
|
|
275
|
-
maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
|
|
276
|
-
|
|
277
|
-
if (maxZoom >= this.transform.minZoom) {
|
|
278
|
-
this.transform.maxZoom = maxZoom;
|
|
279
|
-
|
|
280
|
-
if (this.getZoom() > maxZoom) {
|
|
281
|
-
this.setZoom(maxZoom);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return this;
|
|
285
|
-
} else {
|
|
286
|
-
throw new Error('maxZoom must be greater than the current minZoom');
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}, {
|
|
290
|
-
key: "getMaxZoom",
|
|
291
|
-
value: function getMaxZoom() {
|
|
292
|
-
return this.transform.maxZoom;
|
|
293
|
-
}
|
|
294
|
-
}, {
|
|
295
|
-
key: "setMinPitch",
|
|
296
|
-
value: function setMinPitch(minPitch) {
|
|
297
|
-
minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
|
|
298
|
-
|
|
299
|
-
if (minPitch < defaultMinPitch) {
|
|
300
|
-
throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
|
|
304
|
-
this.transform.minPitch = minPitch;
|
|
305
|
-
|
|
306
|
-
if (this.getPitch() < minPitch) {
|
|
307
|
-
this.setPitch(minPitch);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
return this;
|
|
311
|
-
} else {
|
|
312
|
-
throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}, {
|
|
316
|
-
key: "getMinPitch",
|
|
317
|
-
value: function getMinPitch() {
|
|
318
|
-
return this.transform.minPitch;
|
|
319
|
-
}
|
|
320
|
-
}, {
|
|
321
|
-
key: "setMaxPitch",
|
|
322
|
-
value: function setMaxPitch(maxPitch) {
|
|
323
|
-
maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
|
|
324
|
-
|
|
325
|
-
if (maxPitch > defaultMaxPitch) {
|
|
326
|
-
throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
if (maxPitch >= this.transform.minPitch) {
|
|
330
|
-
this.transform.maxPitch = maxPitch;
|
|
331
|
-
|
|
332
|
-
if (this.getPitch() > maxPitch) {
|
|
333
|
-
this.setPitch(maxPitch);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return this;
|
|
337
|
-
} else {
|
|
338
|
-
throw new Error('maxPitch must be greater than the current minPitch');
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}, {
|
|
342
|
-
key: "getMaxPitch",
|
|
343
|
-
value: function getMaxPitch() {
|
|
344
|
-
return this.transform.maxPitch;
|
|
345
|
-
}
|
|
346
|
-
}, {
|
|
347
|
-
key: "getRenderWorldCopies",
|
|
348
|
-
value: function getRenderWorldCopies() {
|
|
349
|
-
return this.transform.renderWorldCopies;
|
|
350
|
-
}
|
|
351
|
-
}, {
|
|
352
|
-
key: "setRenderWorldCopies",
|
|
353
|
-
value: function setRenderWorldCopies(renderWorldCopies) {
|
|
354
|
-
this.transform.renderWorldCopies = !!renderWorldCopies;
|
|
355
|
-
}
|
|
356
|
-
}, {
|
|
357
|
-
key: "remove",
|
|
358
|
-
value: function remove() {
|
|
359
|
-
if (this.frame) {
|
|
360
|
-
this.frame.cancel();
|
|
361
|
-
this.frame = null;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
this.renderTaskQueue.clear();
|
|
365
|
-
}
|
|
366
|
-
}, {
|
|
367
|
-
key: "requestRenderFrame",
|
|
368
|
-
value: function requestRenderFrame(cb) {
|
|
369
|
-
this.update();
|
|
370
|
-
return this.renderTaskQueue.add(cb);
|
|
371
|
-
}
|
|
372
|
-
}, {
|
|
373
|
-
key: "cancelRenderFrame",
|
|
374
|
-
value: function cancelRenderFrame(id) {
|
|
375
|
-
return this.renderTaskQueue.remove(id);
|
|
376
|
-
}
|
|
377
|
-
}, {
|
|
378
|
-
key: "triggerRepaint",
|
|
379
|
-
value: function triggerRepaint() {
|
|
380
|
-
var _this2 = this;
|
|
381
|
-
|
|
382
|
-
if (!this.frame) {
|
|
383
|
-
this.frame = renderframe(function (paintStartTimeStamp) {
|
|
384
|
-
PerformanceUtils.frame(paintStartTimeStamp);
|
|
385
|
-
_this2.frame = null;
|
|
386
|
-
|
|
387
|
-
_this2.update(paintStartTimeStamp);
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}, {
|
|
392
|
-
key: "update",
|
|
393
|
-
value: function update(time) {
|
|
394
|
-
var _this3 = this;
|
|
395
|
-
|
|
396
|
-
if (!this.frame) {
|
|
397
|
-
this.frame = renderframe(function (paintStartTimeStamp) {
|
|
398
|
-
PerformanceUtils.frame(paintStartTimeStamp);
|
|
399
|
-
_this3.frame = null;
|
|
400
|
-
|
|
401
|
-
_this3.renderTaskQueue.run(time);
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}, {
|
|
406
|
-
key: "initContainer",
|
|
407
|
-
value: function initContainer() {
|
|
408
|
-
if (typeof this.options.container === 'string') {
|
|
409
|
-
this.container = window.document.getElementById(this.options.container);
|
|
410
|
-
|
|
411
|
-
if (!this.container) {
|
|
412
|
-
throw new Error("Container '".concat(this.options.container, "' not found."));
|
|
413
|
-
}
|
|
414
|
-
} else if (this.options.container instanceof HTMLElement) {
|
|
415
|
-
this.container = this.options.container;
|
|
416
|
-
} else {
|
|
417
|
-
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
var container = this.container;
|
|
421
|
-
container.classList.add('l7-map');
|
|
422
|
-
var canvasContainer = this.canvasContainer = DOM.create('div', 'l7-canvas-container', container);
|
|
423
|
-
|
|
424
|
-
if (this.options.interactive) {
|
|
425
|
-
canvasContainer.classList.add('l7-interactive');
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}, {
|
|
429
|
-
key: "containerDimensions",
|
|
430
|
-
value: function containerDimensions() {
|
|
431
|
-
var width = 0;
|
|
432
|
-
var height = 0;
|
|
433
|
-
|
|
434
|
-
if (this.container) {
|
|
435
|
-
width = this.container.clientWidth || 400;
|
|
436
|
-
height = this.container.clientHeight || 300;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
return [width, height];
|
|
440
|
-
}
|
|
441
|
-
}, {
|
|
442
|
-
key: "resizeCanvas",
|
|
443
|
-
value: function resizeCanvas(width, height) {
|
|
444
|
-
var pixelRatio = DOM.DPR || 1;
|
|
445
|
-
this.canvas.width = pixelRatio * width;
|
|
446
|
-
this.canvas.height = pixelRatio * height;
|
|
447
|
-
this.canvas.style.width = "".concat(width, "px");
|
|
448
|
-
this.canvas.style.height = "".concat(height, "px");
|
|
449
|
-
}
|
|
450
|
-
}]);
|
|
451
|
-
|
|
452
|
-
return Map;
|
|
453
|
-
}(Camera);
|
|
454
|
-
//# sourceMappingURL=map.js.map
|
package/es/map.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/map.ts"],"names":["DOM","Camera","LngLat","LngLatBounds","Point","HandlerManager","Hash","renderframe","PerformanceUtils","TaskQueue","defaultMinZoom","defaultMaxZoom","defaultMinPitch","defaultMaxPitch","DefaultOptions","hash","zoom","center","pitch","bearing","interactive","minZoom","maxZoom","minPitch","maxPitch","scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch","bearingSnap","clickTolerance","pitchWithRotate","trackResize","renderWorldCopies","Map","options","update","event","resize","originalEvent","initContainer","handlers","window","addEventListener","onWindowOnline","onWindowResize","hashName","undefined","addTo","onHashChange","jumpTo","bounds","fitBounds","fitBoundsOptions","duration","eventData","dimensions","containerDimensions","width","height","transform","fireMoving","moving","stop","emit","Event","container","canvas","canvasContainer","lngLat","locationPoint","convert","point","pointLocation","getBounds","getMaxBounds","setMaxBounds","style","getZoom","setZoom","Error","getPitch","setPitch","frame","cancel","renderTaskQueue","clear","cb","add","id","remove","paintStartTimeStamp","time","run","document","getElementById","HTMLElement","classList","create","clientWidth","clientHeight","pixelRatio","DPR"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,GAAT,QAAoB,gBAApB;AAEA,OAAOC,MAAP,MAAmB,UAAnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,MAAP,MAAmC,eAAnC;AACA,OAAOC,YAAP,MAA+C,sBAA/C;AAEA,OAAOC,KAAP,MAAiC,aAAjC;AAEA,OAAOC,cAAP,MAA2B,2BAA3B;AASA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,SAASC,WAAT,QAA4B,QAA5B;AACA,SAASC,gBAAT,QAAiC,qBAAjC;AACA,OAAOC,SAAP,MAAkC,oBAAlC;AAEA,IAAM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MAAAA,SAAS,CAAC+B,SAAV,CAAoBT,GAApB,CAAwB,QAAxB;AAEA,UAAMpB,eAAe,GAAI,KAAKA,eAAL,GAAuBxE,GAAG,CAACsG,MAAJ,CAC9C,KAD8C,EAE9C,qBAF8C,EAG9ChC,SAH8C,CAAhD;;AAKA,UAAI,KAAK/B,OAAL,CAAanB,WAAjB,EAA8B;AAC5BoD,QAAAA,eAAe,CAAC6B,SAAhB,CAA0BT,GAA1B,CAA8B,gBAA9B;AACD;AASF;AApSH;AAAA;AAAA,WAsSE,+BAAgD;AAC9C,UAAI9B,KAAK,GAAG,CAAZ;AACA,UAAIC,MAAM,GAAG,CAAb;;AACA,UAAI,KAAKO,SAAT,EAAoB;AAClBR,QAAAA,KAAK,GAAG,KAAKQ,SAAL,CAAeiC,WAAf,IAA8B,GAAtC;AACAxC,QAAAA,MAAM,GAAG,KAAKO,SAAL,CAAekC,YAAf,IAA+B,GAAxC;AACD;;AACD,aAAO,CAAC1C,KAAD,EAAQC,MAAR,CAAP;AACD;AA9SH;AAAA;AAAA,WAgTE,sBAAqBD,KAArB,EAAoCC,MAApC,EAAoD;AAClD,UAAM0C,UAAU,GAAGzG,GAAG,CAAC0G,GAAJ,IAAW,CAA9B;AACA,WAAKnC,MAAL,CAAYT,KAAZ,GAAoB2C,UAAU,GAAG3C,KAAjC;AACA,WAAKS,MAAL,CAAYR,MAAZ,GAAqB0C,UAAU,GAAG1C,MAAlC;AAGA,WAAKQ,MAAL,CAAYU,KAAZ,CAAkBnB,KAAlB,aAA6BA,KAA7B;AACA,WAAKS,MAAL,CAAYU,KAAZ,CAAkBlB,MAAlB,aAA8BA,MAA9B;AACD;AAxTH;;AAAA;AAAA,EAAyB9D,MAAzB","sourcesContent":["import { DOM } from '@antv/l7-utils';\nimport { merge } from 'lodash';\nimport Camera from './camera';\nimport './css/l7.css';\nimport LngLat, { LngLatLike } from './geo/lng_lat';\nimport LngLatBounds, { LngLatBoundsLike } from './geo/lng_lat_bounds';\n// @ts-ignore\nimport Point, { PointLike } from './geo/point';\nimport BoxZoomHandler from './handler/box_zoom';\nimport HandlerManager from './handler/handler_manager';\nimport KeyboardHandler from './handler/keyboard';\n\nimport ScrollZoomHandler from './handler/scroll_zoom';\nimport DoubleClickZoomHandler from './handler/shim/dblclick_zoom';\nimport DragPanHandler from './handler/shim/drag_pan';\nimport DragRotateHandler from './handler/shim/drag_rotate';\nimport TouchZoomRotateHandler from './handler/shim/touch_zoom_rotate';\nimport { TouchPitchHandler } from './handler/touch';\nimport Hash from './hash';\nimport { IMapOptions } from './interface';\nimport { renderframe } from './util';\nimport { PerformanceUtils } from './utils/performance';\nimport TaskQueue, { TaskID } from './utils/task_queue';\ntype CallBack = (_: number) => void;\nconst defaultMinZoom = -2;\nconst defaultMaxZoom = 22;\n\n// the default values, but also the valid range\nconst defaultMinPitch = 0;\nconst defaultMaxPitch = 60;\n\nconst DefaultOptions: IMapOptions = {\n hash: false,\n zoom: -1,\n center: [112, 32],\n pitch: 0,\n bearing: 0,\n interactive: true,\n minZoom: defaultMinZoom,\n maxZoom: defaultMaxZoom,\n minPitch: defaultMinPitch,\n maxPitch: defaultMaxPitch,\n scrollZoom: true,\n boxZoom: true,\n dragRotate: true,\n dragPan: true,\n keyboard: true,\n doubleClickZoom: true,\n touchZoomRotate: true,\n touchPitch: true,\n bearingSnap: 7,\n clickTolerance: 3,\n pitchWithRotate: true,\n trackResize: true,\n renderWorldCopies: true,\n};\nexport class Map extends Camera {\n public doubleClickZoom: DoubleClickZoomHandler;\n public dragRotate: DragRotateHandler;\n public dragPan: DragPanHandler;\n public touchZoomRotate: TouchZoomRotateHandler;\n public scrollZoom: ScrollZoomHandler;\n public keyboard: KeyboardHandler;\n public touchPitch: TouchPitchHandler;\n public boxZoom: BoxZoomHandler;\n public handlers: HandlerManager;\n\n private container: HTMLElement;\n private canvas: HTMLCanvasElement;\n private canvasContainer: HTMLElement;\n private renderTaskQueue: TaskQueue = new TaskQueue();\n private frame: { cancel: () => void } | null;\n private trackResize: boolean = true;\n private hash: Hash | undefined;\n constructor(options: Partial<IMapOptions>) {\n super(merge({}, DefaultOptions, options));\n this.initContainer();\n this.resize();\n this.handlers = new HandlerManager(this, this.options);\n // this.on('move', () => this.update());\n // this.on('moveend', () => this.update());\n // this.on('zoom', () => {\n // console.log('zoom');\n // });\n\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this.onWindowOnline, false);\n window.addEventListener('resize', this.onWindowResize, false);\n window.addEventListener('orientationchange', this.onWindowResize, false);\n }\n\n const hashName =\n (typeof options.hash === 'string' && options.hash) || undefined;\n if (options.hash) {\n this.hash = new Hash(hashName).addTo(this) as Hash;\n }\n\n // don't set position from options if set through hash\n if (!this.hash || !this.hash.onHashChange()) {\n this.jumpTo({\n center: options.center,\n zoom: options.zoom,\n bearing: options.bearing,\n pitch: options.pitch,\n });\n\n if (options.bounds) {\n this.resize();\n this.fitBounds(\n options.bounds,\n merge({}, options.fitBoundsOptions, { duration: 0 }),\n );\n }\n }\n }\n\n public resize(eventData?: any) {\n const dimensions = this.containerDimensions();\n const width = dimensions[0];\n const height = dimensions[1];\n\n // this.resizeCanvas(width, height);\n this.transform.resize(width, height);\n const fireMoving = !this.moving;\n if (fireMoving) {\n this.stop();\n this.emit('movestart', new Event('movestart', eventData));\n this.emit('move', new Event('move', eventData));\n }\n\n this.emit('resize', new Event('resize', eventData));\n\n if (fireMoving) {\n this.emit('moveend', new Event('moveend', eventData));\n }\n\n return this;\n }\n\n public getContainer() {\n return this.container;\n }\n\n public getCanvas() {\n return this.canvas;\n }\n\n public getCanvasContainer() {\n return this.canvasContainer;\n }\n\n public project(lngLat: LngLatLike) {\n return this.transform.locationPoint(LngLat.convert(lngLat));\n }\n\n public unproject(point: PointLike) {\n return this.transform.pointLocation(Point.convert(point));\n }\n\n public getBounds(): LngLatBounds {\n return this.transform.getBounds();\n }\n\n public getMaxBounds(): LngLatBounds | null {\n return this.transform.getMaxBounds();\n }\n\n public setMaxBounds(bounds: LngLatBoundsLike) {\n this.transform.setMaxBounds(LngLatBounds.convert(bounds));\n }\n\n public setStyle(style: any) {\n return;\n }\n public setMinZoom(minZoom?: number) {\n minZoom =\n minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;\n if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {\n this.transform.minZoom = minZoom;\n if (this.getZoom() < minZoom) {\n this.setZoom(minZoom);\n }\n\n return this;\n } else {\n throw new Error(\n `minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`,\n );\n }\n }\n\n public getMinZoom() {\n return this.transform.minZoom;\n }\n\n public setMaxZoom(maxZoom?: number) {\n maxZoom =\n maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;\n\n if (maxZoom >= this.transform.minZoom) {\n this.transform.maxZoom = maxZoom;\n if (this.getZoom() > maxZoom) {\n this.setZoom(maxZoom);\n }\n\n return this;\n } else {\n throw new Error('maxZoom must be greater than the current minZoom');\n }\n }\n public getMaxZoom() {\n return this.transform.maxZoom;\n }\n\n public setMinPitch(minPitch?: number) {\n minPitch =\n minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;\n\n if (minPitch < defaultMinPitch) {\n throw new Error(\n `minPitch must be greater than or equal to ${defaultMinPitch}`,\n );\n }\n\n if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {\n this.transform.minPitch = minPitch;\n if (this.getPitch() < minPitch) {\n this.setPitch(minPitch);\n }\n\n return this;\n } else {\n throw new Error(\n `minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`,\n );\n }\n }\n\n public getMinPitch() {\n return this.transform.minPitch;\n }\n\n public setMaxPitch(maxPitch?: number) {\n maxPitch =\n maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;\n\n if (maxPitch > defaultMaxPitch) {\n throw new Error(\n `maxPitch must be less than or equal to ${defaultMaxPitch}`,\n );\n }\n\n if (maxPitch >= this.transform.minPitch) {\n this.transform.maxPitch = maxPitch;\n if (this.getPitch() > maxPitch) {\n this.setPitch(maxPitch);\n }\n\n return this;\n } else {\n throw new Error('maxPitch must be greater than the current minPitch');\n }\n }\n\n public getMaxPitch() {\n return this.transform.maxPitch;\n }\n\n public getRenderWorldCopies() {\n return this.transform.renderWorldCopies;\n }\n\n public setRenderWorldCopies(renderWorldCopies?: boolean) {\n this.transform.renderWorldCopies = !!renderWorldCopies;\n }\n\n public remove() {\n if (this.frame) {\n this.frame.cancel();\n this.frame = null;\n }\n this.renderTaskQueue.clear();\n }\n\n public requestRenderFrame(cb: CallBack): TaskID {\n this.update();\n return this.renderTaskQueue.add(cb);\n }\n\n public cancelRenderFrame(id: TaskID) {\n return this.renderTaskQueue.remove(id);\n }\n\n public triggerRepaint() {\n if (!this.frame) {\n this.frame = renderframe((paintStartTimeStamp: number) => {\n PerformanceUtils.frame(paintStartTimeStamp);\n this.frame = null;\n this.update(paintStartTimeStamp);\n });\n }\n }\n\n public update(time?: number) {\n if (!this.frame) {\n this.frame = renderframe((paintStartTimeStamp: number) => {\n PerformanceUtils.frame(paintStartTimeStamp);\n this.frame = null;\n this.renderTaskQueue.run(time);\n });\n }\n }\n\n private initContainer() {\n if (typeof this.options.container === 'string') {\n this.container = window.document.getElementById(\n this.options.container,\n ) as HTMLElement;\n if (!this.container) {\n throw new Error(`Container '${this.options.container}' not found.`);\n }\n } else if (this.options.container instanceof HTMLElement) {\n this.container = this.options.container;\n } else {\n throw new Error(\n \"Invalid type: 'container' must be a String or HTMLElement.\",\n );\n }\n\n const container = this.container;\n container.classList.add('l7-map');\n\n const canvasContainer = (this.canvasContainer = DOM.create(\n 'div',\n 'l7-canvas-container',\n container,\n ));\n if (this.options.interactive) {\n canvasContainer.classList.add('l7-interactive');\n }\n\n // this.canvas = DOM.create(\n // 'canvas',\n // 'l7-canvas',\n // canvasContainer,\n // ) as HTMLCanvasElement;\n // this.canvas.setAttribute('tabindex', '-');\n // this.canvas.setAttribute('aria-label', 'Map');\n }\n\n private containerDimensions(): [number, number] {\n let width = 0;\n let height = 0;\n if (this.container) {\n width = this.container.clientWidth || 400;\n height = this.container.clientHeight || 300;\n }\n return [width, height];\n }\n\n private resizeCanvas(width: number, height: number) {\n const pixelRatio = DOM.DPR || 1;\n this.canvas.width = pixelRatio * width;\n this.canvas.height = pixelRatio * height;\n\n // Maintain the same canvas size, potentially downscaling it for HiDPI displays\n this.canvas.style.width = `${width}px`;\n this.canvas.style.height = `${height}px`;\n }\n\n private onWindowOnline = () => {\n this.update();\n };\n\n private onWindowResize = (event: Event) => {\n if (this.trackResize) {\n this.resize({ originalEvent: event }).update();\n }\n };\n}\n"],"file":"map.js"}
|
package/es/util.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface ICancelable {
|
|
2
|
-
cancel: () => void;
|
|
3
|
-
}
|
|
4
|
-
export declare function wrap(n: number, min: number, max: number): number;
|
|
5
|
-
export declare function clamp(n: number, min: number, max: number): number;
|
|
6
|
-
export declare function interpolate(a: number, b: number, t: number): number;
|
|
7
|
-
export declare function bezier(p1x: number, p1y: number, p2x: number, p2y: number): (t: number) => number;
|
|
8
|
-
export declare const ease: (t: number) => number;
|
|
9
|
-
export declare function prefersReducedMotion(): boolean;
|
|
10
|
-
export declare function pick(src: {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}, properties: string[]): {
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
};
|
|
15
|
-
export declare const now: () => number;
|
|
16
|
-
export declare const raf: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
|
|
17
|
-
export declare const cancel: ((handle: number) => void) & typeof cancelAnimationFrame;
|
|
18
|
-
export declare function renderframe(fn: (paintStartTimestamp: number) => void): ICancelable;
|
package/es/util.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
-
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
|
|
5
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6
|
-
|
|
7
|
-
import UnitBezier from '@mapbox/unitbezier';
|
|
8
|
-
var reducedMotionQuery;
|
|
9
|
-
export function wrap(n, min, max) {
|
|
10
|
-
var d = max - min;
|
|
11
|
-
var w = ((n - min) % d + d) % d + min;
|
|
12
|
-
return w === min ? max : w;
|
|
13
|
-
}
|
|
14
|
-
export function clamp(n, min, max) {
|
|
15
|
-
return Math.min(max, Math.max(min, n));
|
|
16
|
-
}
|
|
17
|
-
export function interpolate(a, b, t) {
|
|
18
|
-
return a * (1 - t) + b * t;
|
|
19
|
-
}
|
|
20
|
-
export function bezier(p1x, p1y, p2x, p2y) {
|
|
21
|
-
var bez = new UnitBezier(p1x, p1y, p2x, p2y);
|
|
22
|
-
return function (t) {
|
|
23
|
-
return bez.solve(t);
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export var ease = bezier(0.25, 0.1, 0.25, 1);
|
|
27
|
-
export function prefersReducedMotion() {
|
|
28
|
-
if (!window.matchMedia) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (reducedMotionQuery == null) {
|
|
33
|
-
reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return reducedMotionQuery.matches;
|
|
37
|
-
}
|
|
38
|
-
export function pick(src, properties) {
|
|
39
|
-
var result = {};
|
|
40
|
-
|
|
41
|
-
var _iterator = _createForOfIteratorHelper(properties),
|
|
42
|
-
_step;
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
46
|
-
var name = _step.value;
|
|
47
|
-
|
|
48
|
-
if (name in src) {
|
|
49
|
-
result[name] = src[name];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
} catch (err) {
|
|
53
|
-
_iterator.e(err);
|
|
54
|
-
} finally {
|
|
55
|
-
_iterator.f();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
export var now = window.performance && window.performance.now ? window.performance.now.bind(window.performance) : Date.now.bind(Date);
|
|
61
|
-
export var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
|
|
62
|
-
|
|
63
|
-
var _cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame;
|
|
64
|
-
|
|
65
|
-
export { _cancel as cancel };
|
|
66
|
-
export function renderframe(fn) {
|
|
67
|
-
var frame = raf(fn);
|
|
68
|
-
return {
|
|
69
|
-
cancel: function cancel() {
|
|
70
|
-
return _cancel(frame);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=util.js.map
|
package/es/util.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util.ts"],"names":["UnitBezier","reducedMotionQuery","wrap","n","min","max","d","w","clamp","Math","interpolate","a","b","t","bezier","p1x","p1y","p2x","p2y","bez","solve","ease","prefersReducedMotion","window","matchMedia","matches","pick","src","properties","result","name","now","performance","bind","Date","raf","requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","cancel","cancelAnimationFrame","mozCancelAnimationFrame","webkitCancelAnimationFrame","msCancelAnimationFrame","renderframe","fn","frame"],"mappings":";;;;;;AACA,OAAOA,UAAP,MAAuB,oBAAvB;AACA,IAAIC,kBAAJ;AAIA,OAAO,SAASC,IAAT,CAAcC,CAAd,EAAyBC,GAAzB,EAAsCC,GAAtC,EAA2D;AAChE,MAAMC,CAAC,GAAGD,GAAG,GAAGD,GAAhB;AACA,MAAMG,CAAC,GAAI,CAAE,CAACJ,CAAC,GAAGC,GAAL,IAAYE,CAAb,GAAkBA,CAAnB,IAAwBA,CAAzB,GAA8BF,GAAxC;AACA,SAAOG,CAAC,KAAKH,GAAN,GAAYC,GAAZ,GAAkBE,CAAzB;AACD;AAED,OAAO,SAASC,KAAT,CAAeL,CAAf,EAA0BC,GAA1B,EAAuCC,GAAvC,EAA4D;AACjE,SAAOI,IAAI,CAACL,GAAL,CAASC,GAAT,EAAcI,IAAI,CAACJ,GAAL,CAASD,GAAT,EAAcD,CAAd,CAAd,CAAP;AACD;AAED,OAAO,SAASO,WAAT,CAAqBC,CAArB,EAAgCC,CAAhC,EAA2CC,CAA3C,EAAsD;AAC3D,SAAOF,CAAC,IAAI,IAAIE,CAAR,CAAD,GAAcD,CAAC,GAAGC,CAAzB;AACD;AACD,OAAO,SAASC,MAAT,CACLC,GADK,EAELC,GAFK,EAGLC,GAHK,EAILC,GAJK,EAKkB;AACvB,MAAMC,GAAG,GAAG,IAAInB,UAAJ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A,IAAMC,OAAM,GACjBjB,MAAM,CAACkB,oBAAP,IAEAlB,MAAM,CAACmB,uBAFP,IAIAnB,MAAM,CAACoB,0BAJP,IAMApB,MAAM,CAACqB,sBAPF;;;AASP,OAAO,SAASC,WAAT,CACLC,EADK,EAEQ;AACb,MAAMC,KAAK,GAAGZ,GAAG,CAACW,EAAD,CAAjB;AACA,SAAO;AAAEN,IAAAA,MAAM,EAAE;AAAA,aAAMA,OAAM,CAACO,KAAD,CAAZ;AAAA;AAAV,GAAP;AACD","sourcesContent":["// @ts-ignore\nimport UnitBezier from '@mapbox/unitbezier';\nlet reducedMotionQuery: MediaQueryList;\nexport interface ICancelable {\n cancel: () => void;\n}\nexport function wrap(n: number, min: number, max: number): number {\n const d = max - min;\n const w = ((((n - min) % d) + d) % d) + min;\n return w === min ? max : w;\n}\n\nexport function clamp(n: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, n));\n}\n\nexport function interpolate(a: number, b: number, t: number) {\n return a * (1 - t) + b * t;\n}\nexport function bezier(\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number,\n): (t: number) => number {\n const bez = new UnitBezier(p1x, p1y, p2x, p2y);\n return (t: number) => {\n return bez.solve(t);\n };\n}\n\nexport const ease = bezier(0.25, 0.1, 0.25, 1);\n\nexport function prefersReducedMotion(): boolean {\n if (!window.matchMedia) {\n return false;\n }\n // Lazily initialize media query\n if (reducedMotionQuery == null) {\n reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n }\n return reducedMotionQuery.matches;\n}\n\nexport function pick(\n src: { [key: string]: any },\n properties: string[],\n): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n for (const name of properties) {\n if (name in src) {\n result[name] = src[name];\n }\n }\n return result;\n}\n\nexport const now =\n window.performance && window.performance.now\n ? window.performance.now.bind(window.performance)\n : Date.now.bind(Date);\n\nexport const raf =\n window.requestAnimationFrame ||\n // @ts-ignore\n window.mozRequestAnimationFrame ||\n // @ts-ignore\n window.webkitRequestAnimationFrame ||\n // @ts-ignore\n window.msRequestAnimationFrame;\n\nexport const cancel =\n window.cancelAnimationFrame ||\n // @ts-ignore\n window.mozCancelAnimationFrame ||\n // @ts-ignore\n window.webkitCancelAnimationFrame ||\n // @ts-ignore\n window.msCancelAnimationFrame;\n\nexport function renderframe(\n fn: (paintStartTimestamp: number) => void,\n): ICancelable {\n const frame = raf(fn);\n return { cancel: () => cancel(frame) };\n}\n"],"file":"util.js"}
|
package/es/utils/Aabb.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { vec3 } from 'gl-matrix';
|
|
2
|
-
import Frustum from './primitives';
|
|
3
|
-
export default class Aabb {
|
|
4
|
-
min: vec3;
|
|
5
|
-
max: vec3;
|
|
6
|
-
center: vec3;
|
|
7
|
-
constructor(min: vec3, max: vec3);
|
|
8
|
-
quadrant(index: number): Aabb;
|
|
9
|
-
distanceX(point: number[]): number;
|
|
10
|
-
distanceY(point: number[]): number;
|
|
11
|
-
intersects(frustum: Frustum): number;
|
|
12
|
-
}
|