@antv/l7-map 2.17.12 → 2.18.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/es/camera.js +92 -149
- package/es/earthmap.js +15 -68
- package/es/geo/edge_insets.js +4 -14
- package/es/geo/lng_lat.js +5 -13
- package/es/geo/lng_lat_bounds.js +4 -17
- package/es/geo/mercator.js +2 -10
- package/es/geo/point.js +0 -7
- package/es/geo/simple.js +6 -11
- package/es/geo/transform.js +128 -138
- package/es/handler/blockable_map_event.js +7 -12
- package/es/handler/box_zoom.js +10 -30
- package/es/handler/click_zoom.js +0 -5
- package/es/handler/events/event.js +2 -3
- package/es/handler/events/map_mouse_event.js +2 -13
- package/es/handler/events/map_touch_event.js +2 -12
- package/es/handler/events/map_wheel_event.js +1 -12
- package/es/handler/events/render_event.js +0 -13
- package/es/handler/handler_inertia.js +8 -35
- package/es/handler/handler_manager.js +90 -197
- package/es/handler/handler_util.js +1 -2
- package/es/handler/keyboard.js +1 -20
- package/es/handler/map_event.js +3 -9
- package/es/handler/mouse/mouse_handler.js +11 -24
- package/es/handler/mouse/mousepan_handler.js +1 -11
- package/es/handler/mouse/mousepitch_hander.js +1 -11
- package/es/handler/mouse/mouserotate_hander.js +1 -11
- package/es/handler/mouse/util.js +2 -3
- package/es/handler/scroll_zoom.js +43 -71
- package/es/handler/shim/dblclick_zoom.js +4 -9
- package/es/handler/shim/drag_pan.js +6 -18
- package/es/handler/shim/drag_rotate.js +4 -10
- package/es/handler/shim/touch_zoom_rotate.js +8 -23
- package/es/handler/tap/single_tap_recognizer.js +8 -31
- package/es/handler/tap/tap_drag_zoom.js +7 -15
- package/es/handler/tap/tap_recognizer.js +3 -11
- package/es/handler/tap/tap_zoom.js +1 -7
- package/es/handler/touch/touch_pan.js +4 -22
- package/es/handler/touch/touch_pitch.js +10 -27
- package/es/handler/touch/touch_rotate.js +8 -19
- package/es/handler/touch/touch_zoom.js +5 -18
- package/es/handler/touch/two_touch.js +19 -32
- package/es/hash.js +13 -35
- package/es/map.js +30 -107
- package/es/util.d.ts +3 -3
- package/es/util.js +20 -33
- package/es/utils/Aabb.js +10 -31
- package/es/utils/dom.js +33 -111
- package/es/utils/performance.js +9 -9
- package/es/utils/primitives.js +13 -11
- package/es/utils/task_queue.js +6 -23
- package/lib/camera.js +102 -179
- package/lib/earthmap.js +14 -83
- package/lib/geo/edge_insets.js +3 -18
- package/lib/geo/lng_lat.js +5 -18
- package/lib/geo/lng_lat_bounds.js +4 -20
- package/lib/geo/mercator.js +1 -22
- package/lib/geo/point.js +0 -8
- package/lib/geo/simple.js +5 -24
- package/lib/geo/transform.js +128 -170
- package/lib/handler/blockable_map_event.js +6 -14
- package/lib/handler/box_zoom.js +8 -39
- package/lib/handler/click_zoom.js +0 -6
- package/lib/handler/events/event.js +4 -7
- package/lib/handler/events/index.js +0 -4
- package/lib/handler/events/map_mouse_event.js +5 -22
- package/lib/handler/events/map_touch_event.js +2 -21
- package/lib/handler/events/map_wheel_event.js +1 -16
- package/lib/handler/events/render_event.js +0 -19
- package/lib/handler/handler_inertia.js +13 -44
- package/lib/handler/handler_manager.js +92 -222
- package/lib/handler/handler_util.js +1 -3
- package/lib/handler/keyboard.js +1 -22
- package/lib/handler/map_event.js +2 -11
- package/lib/handler/mouse/index.js +0 -4
- package/lib/handler/mouse/mouse_handler.js +10 -27
- package/lib/handler/mouse/mousepan_handler.js +1 -18
- package/lib/handler/mouse/mousepitch_hander.js +1 -17
- package/lib/handler/mouse/mouserotate_hander.js +1 -17
- package/lib/handler/mouse/util.js +2 -6
- package/lib/handler/scroll_zoom.js +43 -77
- package/lib/handler/shim/dblclick_zoom.js +4 -10
- package/lib/handler/shim/drag_pan.js +6 -20
- package/lib/handler/shim/drag_rotate.js +4 -11
- package/lib/handler/shim/touch_zoom_rotate.js +8 -25
- package/lib/handler/tap/single_tap_recognizer.js +8 -33
- package/lib/handler/tap/tap_drag_zoom.js +6 -18
- package/lib/handler/tap/tap_recognizer.js +2 -17
- package/lib/handler/tap/tap_zoom.js +0 -9
- package/lib/handler/touch/index.js +0 -5
- package/lib/handler/touch/touch_pan.js +4 -25
- package/lib/handler/touch/touch_pitch.js +10 -32
- package/lib/handler/touch/touch_rotate.js +8 -25
- package/lib/handler/touch/touch_zoom.js +5 -24
- package/lib/handler/touch/two_touch.js +18 -35
- package/lib/hash.js +12 -38
- package/lib/index.js +0 -8
- package/lib/map.js +30 -125
- package/lib/util.js +19 -46
- package/lib/utils/Aabb.js +10 -34
- package/lib/utils/dom.js +32 -118
- package/lib/utils/performance.js +9 -11
- package/lib/utils/primitives.js +13 -16
- package/lib/utils/task_queue.js +6 -24
- package/package.json +4 -4
package/lib/map.js
CHANGED
|
@@ -1,98 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Map = void 0;
|
|
9
|
-
|
|
10
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
11
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
16
|
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
-
|
|
28
|
-
var _lodash = require("lodash");
|
|
29
|
-
|
|
30
17
|
var _camera = _interopRequireDefault(require("./camera"));
|
|
31
|
-
|
|
32
18
|
var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
|
|
33
|
-
|
|
34
19
|
var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
|
|
35
|
-
|
|
36
20
|
var _point = _interopRequireDefault(require("./geo/point"));
|
|
37
|
-
|
|
38
21
|
var _handler_manager = _interopRequireDefault(require("./handler/handler_manager"));
|
|
39
|
-
|
|
40
22
|
var _hash = _interopRequireDefault(require("./hash"));
|
|
41
|
-
|
|
42
23
|
var _util = require("./util");
|
|
43
|
-
|
|
44
24
|
var _performance = require("./utils/performance");
|
|
45
|
-
|
|
46
25
|
var _task_queue = _interopRequireDefault(require("./utils/task_queue"));
|
|
47
|
-
|
|
48
26
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
49
|
-
|
|
50
27
|
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; } }
|
|
51
|
-
|
|
52
28
|
function loadStyles(css, doc) {
|
|
53
29
|
var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
|
|
54
30
|
var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
|
|
55
|
-
|
|
56
31
|
if (isMiniAli || isWeChatMiniProgram) {
|
|
57
32
|
return;
|
|
58
33
|
}
|
|
59
|
-
|
|
60
34
|
if (!doc) doc = document;
|
|
61
|
-
|
|
62
35
|
if (!doc) {
|
|
63
36
|
return;
|
|
64
37
|
}
|
|
65
|
-
|
|
66
38
|
var head = doc.head || doc.getElementsByTagName('head')[0];
|
|
67
|
-
|
|
68
39
|
if (!head) {
|
|
69
40
|
head = doc.createElement('head');
|
|
70
41
|
var body = doc.body || doc.getElementsByTagName('body')[0];
|
|
71
|
-
|
|
72
42
|
if (body) {
|
|
73
43
|
body.parentNode.insertBefore(head, body);
|
|
74
44
|
} else {
|
|
75
45
|
doc.documentElement.appendChild(head);
|
|
76
46
|
}
|
|
77
47
|
}
|
|
78
|
-
|
|
79
48
|
var style = doc.createElement('style');
|
|
80
49
|
style.type = 'text/css';
|
|
81
|
-
|
|
82
50
|
if (style.styleSheet) {
|
|
83
51
|
style.styleSheet.cssText = css;
|
|
84
52
|
} else {
|
|
85
53
|
style.appendChild(doc.createTextNode(css));
|
|
86
54
|
}
|
|
87
|
-
|
|
88
55
|
head.appendChild(style);
|
|
89
56
|
return style;
|
|
90
57
|
}
|
|
91
|
-
|
|
92
|
-
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");
|
|
58
|
+
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"); // @ts-ignore
|
|
93
59
|
var defaultMinZoom = -2;
|
|
94
|
-
var defaultMaxZoom = 22;
|
|
95
|
-
|
|
60
|
+
var defaultMaxZoom = 22;
|
|
61
|
+
var merge = _l7Utils.lodashUtil.merge;
|
|
62
|
+
// the default values, but also the valid range
|
|
96
63
|
var defaultMinPitch = 0;
|
|
97
64
|
var defaultMaxPitch = 60;
|
|
98
65
|
var DefaultOptions = {
|
|
@@ -122,17 +89,13 @@ var DefaultOptions = {
|
|
|
122
89
|
pitchEnabled: true,
|
|
123
90
|
rotateEnabled: true
|
|
124
91
|
};
|
|
125
|
-
|
|
126
92
|
var Map = /*#__PURE__*/function (_Camera) {
|
|
127
93
|
(0, _inherits2.default)(Map, _Camera);
|
|
128
|
-
|
|
129
94
|
var _super = _createSuper(Map);
|
|
130
|
-
|
|
131
95
|
function Map(options) {
|
|
132
96
|
var _this;
|
|
133
|
-
|
|
134
97
|
(0, _classCallCheck2.default)(this, Map);
|
|
135
|
-
_this = _super.call(this,
|
|
98
|
+
_this = _super.call(this, merge({}, DefaultOptions, options));
|
|
136
99
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
|
|
137
100
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
|
|
138
101
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
|
|
@@ -145,32 +108,20 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
145
108
|
}).update();
|
|
146
109
|
}
|
|
147
110
|
});
|
|
148
|
-
|
|
149
|
-
if (_l7Utils.isMini) {
|
|
150
|
-
_this.initMiniContainer();
|
|
151
|
-
} else {
|
|
152
|
-
_this.initContainer();
|
|
153
|
-
}
|
|
154
|
-
|
|
111
|
+
_this.initContainer();
|
|
155
112
|
_this.resize();
|
|
156
|
-
|
|
157
113
|
_this.handlers = new _handler_manager.default((0, _assertThisInitialized2.default)(_this), _this.options);
|
|
158
|
-
|
|
159
114
|
if (typeof window !== 'undefined') {
|
|
160
115
|
window.addEventListener('online', _this.onWindowOnline, false);
|
|
161
116
|
window.addEventListener('resize', _this.onWindowResize, false);
|
|
162
117
|
window.addEventListener('orientationchange', _this.onWindowResize, false);
|
|
163
118
|
}
|
|
119
|
+
var hashName = typeof options.hash === 'string' && options.hash || undefined;
|
|
120
|
+
if (options.hash) {
|
|
121
|
+
_this.hash = new _hash.default(hashName).addTo((0, _assertThisInitialized2.default)(_this));
|
|
122
|
+
}
|
|
164
123
|
|
|
165
|
-
if
|
|
166
|
-
var hashName = typeof options.hash === 'string' && options.hash || undefined;
|
|
167
|
-
|
|
168
|
-
if (options.hash) {
|
|
169
|
-
_this.hash = new _hash.default(hashName).addTo((0, _assertThisInitialized2.default)(_this));
|
|
170
|
-
}
|
|
171
|
-
} // don't set position from options if set through hash
|
|
172
|
-
|
|
173
|
-
|
|
124
|
+
// don't set position from options if set through hash
|
|
174
125
|
if (!_this.hash || !_this.hash.onHashChange()) {
|
|
175
126
|
_this.jumpTo({
|
|
176
127
|
center: options.center,
|
|
@@ -178,47 +129,34 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
178
129
|
bearing: options.bearing,
|
|
179
130
|
pitch: options.pitch
|
|
180
131
|
});
|
|
181
|
-
|
|
182
132
|
if (options.bounds) {
|
|
183
133
|
_this.resize();
|
|
184
|
-
|
|
185
|
-
_this.fitBounds(options.bounds, (0, _lodash.merge)({}, options.fitBoundsOptions, {
|
|
134
|
+
_this.fitBounds(options.bounds, merge({}, options.fitBoundsOptions, {
|
|
186
135
|
duration: 0
|
|
187
136
|
}));
|
|
188
137
|
}
|
|
189
138
|
}
|
|
190
|
-
|
|
191
139
|
return _this;
|
|
192
140
|
}
|
|
193
|
-
|
|
194
141
|
(0, _createClass2.default)(Map, [{
|
|
195
142
|
key: "resize",
|
|
196
143
|
value: function resize(eventData) {
|
|
197
144
|
var _this$containerDimens = this.containerDimensions(),
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (_l7Utils.isMini) {
|
|
205
|
-
return this;
|
|
206
|
-
}
|
|
207
|
-
|
|
145
|
+
_this$containerDimens2 = (0, _slicedToArray2.default)(_this$containerDimens, 2),
|
|
146
|
+
width = _this$containerDimens2[0],
|
|
147
|
+
height = _this$containerDimens2[1];
|
|
148
|
+
this.transform.resize(width, height);
|
|
149
|
+
// 小程序环境不需要执行后续动作
|
|
208
150
|
var fireMoving = !this.moving;
|
|
209
|
-
|
|
210
151
|
if (fireMoving) {
|
|
211
152
|
this.stop();
|
|
212
|
-
this.emit('movestart', new
|
|
213
|
-
this.emit('move', new
|
|
153
|
+
this.emit('movestart', new window.Event('movestart', eventData));
|
|
154
|
+
this.emit('move', new window.Event('move', eventData));
|
|
214
155
|
}
|
|
215
|
-
|
|
216
|
-
this.emit('resize', new _l7Utils.$window.Event('resize', eventData));
|
|
217
|
-
|
|
156
|
+
this.emit('resize', new window.Event('resize', eventData));
|
|
218
157
|
if (fireMoving) {
|
|
219
|
-
this.emit('moveend', new
|
|
158
|
+
this.emit('moveend', new window.Event('moveend', eventData));
|
|
220
159
|
}
|
|
221
|
-
|
|
222
160
|
return this;
|
|
223
161
|
}
|
|
224
162
|
}, {
|
|
@@ -260,8 +198,9 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
260
198
|
key: "setMaxBounds",
|
|
261
199
|
value: function setMaxBounds(bounds) {
|
|
262
200
|
this.transform.setMaxBounds(_lng_lat_bounds.default.convert(bounds));
|
|
263
|
-
}
|
|
201
|
+
}
|
|
264
202
|
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
265
204
|
}, {
|
|
266
205
|
key: "setStyle",
|
|
267
206
|
value: function setStyle(style) {
|
|
@@ -271,14 +210,11 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
271
210
|
key: "setMinZoom",
|
|
272
211
|
value: function setMinZoom(minZoom) {
|
|
273
212
|
minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
|
|
274
|
-
|
|
275
213
|
if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
|
|
276
214
|
this.transform.minZoom = minZoom;
|
|
277
|
-
|
|
278
215
|
if (this.getZoom() < minZoom) {
|
|
279
216
|
this.setZoom(minZoom);
|
|
280
217
|
}
|
|
281
|
-
|
|
282
218
|
return this;
|
|
283
219
|
} else {
|
|
284
220
|
throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
|
|
@@ -293,14 +229,11 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
293
229
|
key: "setMaxZoom",
|
|
294
230
|
value: function setMaxZoom(maxZoom) {
|
|
295
231
|
maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
|
|
296
|
-
|
|
297
232
|
if (maxZoom >= this.transform.minZoom) {
|
|
298
233
|
this.transform.maxZoom = maxZoom;
|
|
299
|
-
|
|
300
234
|
if (this.getZoom() > maxZoom) {
|
|
301
235
|
this.setZoom(maxZoom);
|
|
302
236
|
}
|
|
303
|
-
|
|
304
237
|
return this;
|
|
305
238
|
} else {
|
|
306
239
|
throw new Error('maxZoom must be greater than the current minZoom');
|
|
@@ -315,18 +248,14 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
315
248
|
key: "setMinPitch",
|
|
316
249
|
value: function setMinPitch(minPitch) {
|
|
317
250
|
minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
|
|
318
|
-
|
|
319
251
|
if (minPitch < defaultMinPitch) {
|
|
320
252
|
throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
|
|
321
253
|
}
|
|
322
|
-
|
|
323
254
|
if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
|
|
324
255
|
this.transform.minPitch = minPitch;
|
|
325
|
-
|
|
326
256
|
if (this.getPitch() < minPitch) {
|
|
327
257
|
this.setPitch(minPitch);
|
|
328
258
|
}
|
|
329
|
-
|
|
330
259
|
return this;
|
|
331
260
|
} else {
|
|
332
261
|
throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
|
|
@@ -341,18 +270,14 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
341
270
|
key: "setMaxPitch",
|
|
342
271
|
value: function setMaxPitch(maxPitch) {
|
|
343
272
|
maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
|
|
344
|
-
|
|
345
273
|
if (maxPitch > defaultMaxPitch) {
|
|
346
274
|
throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
|
|
347
275
|
}
|
|
348
|
-
|
|
349
276
|
if (maxPitch >= this.transform.minPitch) {
|
|
350
277
|
this.transform.maxPitch = maxPitch;
|
|
351
|
-
|
|
352
278
|
if (this.getPitch() > maxPitch) {
|
|
353
279
|
this.setPitch(maxPitch);
|
|
354
280
|
}
|
|
355
|
-
|
|
356
281
|
return this;
|
|
357
282
|
} else {
|
|
358
283
|
throw new Error('maxPitch must be greater than the current minPitch');
|
|
@@ -376,15 +301,13 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
376
301
|
}, {
|
|
377
302
|
key: "remove",
|
|
378
303
|
value: function remove() {
|
|
379
|
-
this.container.removeChild(this.canvasContainer);
|
|
380
|
-
|
|
304
|
+
this.container.removeChild(this.canvasContainer);
|
|
305
|
+
// @ts-ignore
|
|
381
306
|
this.canvasContainer = null;
|
|
382
|
-
|
|
383
307
|
if (this.frame) {
|
|
384
308
|
this.frame.cancel();
|
|
385
309
|
this.frame = null;
|
|
386
310
|
}
|
|
387
|
-
|
|
388
311
|
this.renderTaskQueue.clear();
|
|
389
312
|
}
|
|
390
313
|
}, {
|
|
@@ -402,13 +325,10 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
402
325
|
key: "triggerRepaint",
|
|
403
326
|
value: function triggerRepaint() {
|
|
404
327
|
var _this2 = this;
|
|
405
|
-
|
|
406
328
|
if (!this.frame) {
|
|
407
329
|
this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
|
|
408
330
|
_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
409
|
-
|
|
410
331
|
_this2.frame = null;
|
|
411
|
-
|
|
412
332
|
_this2.update(paintStartTimeStamp);
|
|
413
333
|
});
|
|
414
334
|
}
|
|
@@ -417,13 +337,10 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
417
337
|
key: "update",
|
|
418
338
|
value: function update(time) {
|
|
419
339
|
var _this3 = this;
|
|
420
|
-
|
|
421
340
|
if (!this.frame) {
|
|
422
341
|
this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
|
|
423
342
|
_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
424
|
-
|
|
425
343
|
_this3.frame = null;
|
|
426
|
-
|
|
427
344
|
_this3.renderTaskQueue.run(time);
|
|
428
345
|
});
|
|
429
346
|
}
|
|
@@ -433,7 +350,6 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
433
350
|
value: function initContainer() {
|
|
434
351
|
if (typeof this.options.container === 'string') {
|
|
435
352
|
this.container = window.document.getElementById(this.options.container);
|
|
436
|
-
|
|
437
353
|
if (!this.container) {
|
|
438
354
|
throw new Error("Container '".concat(this.options.container, "' not found."));
|
|
439
355
|
}
|
|
@@ -442,20 +358,17 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
442
358
|
} else {
|
|
443
359
|
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
|
|
444
360
|
}
|
|
445
|
-
|
|
446
361
|
var container = this.container;
|
|
447
362
|
container.classList.add('l7-map');
|
|
448
|
-
|
|
449
363
|
var canvasContainer = this.canvasContainer = _l7Utils.DOM.create('div', 'l7-canvas-container', container);
|
|
450
|
-
|
|
451
364
|
if (this.options.interactive) {
|
|
452
365
|
canvasContainer.classList.add('l7-interactive');
|
|
453
366
|
}
|
|
454
367
|
}
|
|
368
|
+
|
|
455
369
|
/**
|
|
456
370
|
* 小程序环境构建容器
|
|
457
371
|
*/
|
|
458
|
-
|
|
459
372
|
}, {
|
|
460
373
|
key: "initMiniContainer",
|
|
461
374
|
value: function initMiniContainer() {
|
|
@@ -467,23 +380,15 @@ var Map = /*#__PURE__*/function (_Camera) {
|
|
|
467
380
|
value: function containerDimensions() {
|
|
468
381
|
var width = 0;
|
|
469
382
|
var height = 0;
|
|
470
|
-
|
|
471
383
|
if (this.container) {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
width = this.container.clientWidth;
|
|
477
|
-
height = this.container.clientHeight;
|
|
478
|
-
width = width === 0 ? 400 : width;
|
|
479
|
-
height = height === 0 ? 300 : height;
|
|
480
|
-
}
|
|
384
|
+
width = this.container.clientWidth;
|
|
385
|
+
height = this.container.clientHeight;
|
|
386
|
+
width = width === 0 ? 400 : width;
|
|
387
|
+
height = height === 0 ? 300 : height;
|
|
481
388
|
}
|
|
482
|
-
|
|
483
389
|
return [width, height];
|
|
484
390
|
}
|
|
485
391
|
}]);
|
|
486
392
|
return Map;
|
|
487
393
|
}(_camera.default);
|
|
488
|
-
|
|
489
394
|
exports.Map = Map;
|
package/lib/util.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -17,68 +16,45 @@ exports.prefersReducedMotion = prefersReducedMotion;
|
|
|
17
16
|
exports.raf = void 0;
|
|
18
17
|
exports.renderframe = renderframe;
|
|
19
18
|
exports.wrap = wrap;
|
|
20
|
-
|
|
21
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
22
|
-
|
|
23
19
|
var _unitbezier = _interopRequireDefault(require("@mapbox/unitbezier"));
|
|
24
|
-
|
|
25
20
|
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; } } }; }
|
|
26
|
-
|
|
27
21
|
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); }
|
|
28
|
-
|
|
29
|
-
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; }
|
|
30
|
-
|
|
22
|
+
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; } // @ts-ignore
|
|
31
23
|
var reducedMotionQuery;
|
|
32
|
-
|
|
33
24
|
function wrap(n, min, max) {
|
|
34
25
|
var d = max - min;
|
|
35
26
|
var w = ((n - min) % d + d) % d + min;
|
|
36
27
|
return w === min ? max : w;
|
|
37
28
|
}
|
|
38
|
-
|
|
39
29
|
function clamp(n, min, max) {
|
|
40
30
|
return Math.min(max, Math.max(min, n));
|
|
41
31
|
}
|
|
42
|
-
|
|
43
32
|
function interpolate(a, b, t) {
|
|
44
33
|
return a * (1 - t) + b * t;
|
|
45
34
|
}
|
|
46
|
-
|
|
47
35
|
function bezier(p1x, p1y, p2x, p2y) {
|
|
48
36
|
var bez = new _unitbezier.default(p1x, p1y, p2x, p2y);
|
|
49
37
|
return function (t) {
|
|
50
38
|
return bez.solve(t);
|
|
51
39
|
};
|
|
52
40
|
}
|
|
53
|
-
|
|
54
41
|
var ease = bezier(0.25, 0.1, 0.25, 1);
|
|
55
42
|
exports.ease = ease;
|
|
56
|
-
|
|
57
43
|
function prefersReducedMotion() {
|
|
58
|
-
//
|
|
59
|
-
if (_l7Utils.isMini || !_l7Utils.$window.matchMedia) {
|
|
60
|
-
return false;
|
|
61
|
-
} // Lazily initialize media query
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
// Lazily initialize media query
|
|
64
45
|
if (reducedMotionQuery == null) {
|
|
65
46
|
// @ts-ignore
|
|
66
|
-
reducedMotionQuery =
|
|
47
|
+
reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
67
48
|
}
|
|
68
|
-
|
|
69
49
|
return reducedMotionQuery.matches;
|
|
70
50
|
}
|
|
71
|
-
|
|
72
51
|
function pick(src, properties) {
|
|
73
52
|
var result = {};
|
|
74
|
-
|
|
75
53
|
var _iterator = _createForOfIteratorHelper(properties),
|
|
76
|
-
|
|
77
|
-
|
|
54
|
+
_step;
|
|
78
55
|
try {
|
|
79
56
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
80
57
|
var name = _step.value;
|
|
81
|
-
|
|
82
58
|
if (name in src) {
|
|
83
59
|
result[name] = src[name];
|
|
84
60
|
}
|
|
@@ -88,25 +64,26 @@ function pick(src, properties) {
|
|
|
88
64
|
} finally {
|
|
89
65
|
_iterator.f();
|
|
90
66
|
}
|
|
91
|
-
|
|
92
67
|
return result;
|
|
93
68
|
}
|
|
94
|
-
|
|
95
|
-
var now = _l7Utils.isMini ? Date.now.bind(Date) : _l7Utils.$window.performance && _l7Utils.$window.performance.now ? _l7Utils.$window.performance.now.bind(_l7Utils.$window.performance) : Date.now.bind(Date);
|
|
69
|
+
var now = window.performance && window.performance.now ? window.performance.now.bind(window.performance) : Date.now.bind(Date);
|
|
96
70
|
exports.now = now;
|
|
97
|
-
var raf =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
71
|
+
var raf = window.requestAnimationFrame ||
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
window.mozRequestAnimationFrame ||
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
window.webkitRequestAnimationFrame ||
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
window.msRequestAnimationFrame;
|
|
101
78
|
exports.raf = raf;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
79
|
+
var _cancel = window.cancelAnimationFrame ||
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
window.mozCancelAnimationFrame ||
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
window.webkitCancelAnimationFrame ||
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
window.msCancelAnimationFrame;
|
|
108
86
|
exports.cancel = _cancel;
|
|
109
|
-
|
|
110
87
|
function renderframe(fn) {
|
|
111
88
|
var frame = raf(fn);
|
|
112
89
|
return {
|
|
@@ -115,21 +92,17 @@ function renderframe(fn) {
|
|
|
115
92
|
}
|
|
116
93
|
};
|
|
117
94
|
}
|
|
118
|
-
|
|
119
95
|
function extend(dest) {
|
|
120
96
|
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
121
97
|
sources[_key - 1] = arguments[_key];
|
|
122
98
|
}
|
|
123
|
-
|
|
124
99
|
for (var _i = 0, _sources = sources; _i < _sources.length; _i++) {
|
|
125
100
|
var src = _sources[_i];
|
|
126
|
-
|
|
127
101
|
for (var k in src) {
|
|
128
102
|
if (src[k] !== undefined) {
|
|
129
103
|
dest[k] = src[k];
|
|
130
104
|
}
|
|
131
105
|
}
|
|
132
106
|
}
|
|
133
|
-
|
|
134
107
|
return dest;
|
|
135
108
|
}
|
package/lib/utils/Aabb.js
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _glMatrix = require("gl-matrix");
|
|
15
|
-
|
|
16
11
|
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; } } }; }
|
|
17
|
-
|
|
18
12
|
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); }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
13
|
+
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; }
|
|
22
14
|
var Aabb = /*#__PURE__*/function () {
|
|
23
15
|
function Aabb(min, max) {
|
|
24
16
|
(0, _classCallCheck2.default)(this, Aabb);
|
|
@@ -26,22 +18,17 @@ var Aabb = /*#__PURE__*/function () {
|
|
|
26
18
|
this.max = max;
|
|
27
19
|
this.center = _glMatrix.vec3.scale(new Float32Array(3), _glMatrix.vec3.add(new Float32Array(3), this.min, this.max), 0.5);
|
|
28
20
|
}
|
|
29
|
-
|
|
30
21
|
(0, _createClass2.default)(Aabb, [{
|
|
31
22
|
key: "quadrant",
|
|
32
23
|
value: function quadrant(index) {
|
|
33
24
|
var split = [index % 2 === 0, index < 2];
|
|
34
|
-
|
|
35
25
|
var qMin = _glMatrix.vec3.clone(this.min);
|
|
36
|
-
|
|
37
26
|
var qMax = _glMatrix.vec3.clone(this.max);
|
|
38
|
-
|
|
39
27
|
for (var axis = 0; axis < split.length; axis++) {
|
|
40
28
|
qMin[axis] = split[axis] ? this.min[axis] : this.center[axis];
|
|
41
29
|
qMax[axis] = split[axis] ? this.center[axis] : this.max[axis];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
}
|
|
31
|
+
// Elevation is always constant, hence quadrant.max.z = this.max.z
|
|
45
32
|
qMax[2] = this.max[2];
|
|
46
33
|
return new Aabb(qMin, qMax);
|
|
47
34
|
}
|
|
@@ -56,29 +43,27 @@ var Aabb = /*#__PURE__*/function () {
|
|
|
56
43
|
value: function distanceY(point) {
|
|
57
44
|
var pointOnAabb = Math.max(Math.min(this.max[1], point[1]), this.min[1]);
|
|
58
45
|
return pointOnAabb - point[1];
|
|
59
|
-
}
|
|
60
|
-
// 1 if shapes are intersecting and 2 if the aabb if fully inside the frustum.
|
|
46
|
+
}
|
|
61
47
|
|
|
48
|
+
// Performs a frustum-aabb intersection test. Returns 0 if there's no intersection,
|
|
49
|
+
// 1 if shapes are intersecting and 2 if the aabb if fully inside the frustum.
|
|
62
50
|
}, {
|
|
63
51
|
key: "intersects",
|
|
64
52
|
value: function intersects(frustum) {
|
|
65
53
|
// Execute separating axis test between two convex objects to find intersections
|
|
66
54
|
// Each frustum plane together with 3 major axes define the separating axes
|
|
67
55
|
// Note: test only 4 points as both min and max points have equal elevation
|
|
56
|
+
|
|
68
57
|
var aabbPoints = [[this.min[0], this.min[1], 0.0, 1], [this.max[0], this.min[1], 0.0, 1], [this.max[0], this.max[1], 0.0, 1], [this.min[0], this.max[1], 0.0, 1]];
|
|
69
58
|
var fullyInside = true;
|
|
70
|
-
|
|
71
59
|
var _iterator = _createForOfIteratorHelper(frustum.planes),
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
_step;
|
|
74
61
|
try {
|
|
75
62
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
76
63
|
var plane = _step.value;
|
|
77
64
|
var pointsInside = 0;
|
|
78
|
-
|
|
79
65
|
var _iterator3 = _createForOfIteratorHelper(aabbPoints),
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
_step3;
|
|
82
67
|
try {
|
|
83
68
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
84
69
|
var i = _step3.value;
|
|
@@ -90,11 +75,9 @@ var Aabb = /*#__PURE__*/function () {
|
|
|
90
75
|
} finally {
|
|
91
76
|
_iterator3.f();
|
|
92
77
|
}
|
|
93
|
-
|
|
94
78
|
if (pointsInside === 0) {
|
|
95
79
|
return 0;
|
|
96
80
|
}
|
|
97
|
-
|
|
98
81
|
if (pointsInside !== aabbPoints.length) {
|
|
99
82
|
fullyInside = false;
|
|
100
83
|
}
|
|
@@ -104,18 +87,14 @@ var Aabb = /*#__PURE__*/function () {
|
|
|
104
87
|
} finally {
|
|
105
88
|
_iterator.f();
|
|
106
89
|
}
|
|
107
|
-
|
|
108
90
|
if (fullyInside) {
|
|
109
91
|
return 2;
|
|
110
92
|
}
|
|
111
|
-
|
|
112
93
|
for (var axis = 0; axis < 3; axis++) {
|
|
113
94
|
var projMin = Number.MAX_VALUE;
|
|
114
95
|
var projMax = -Number.MAX_VALUE;
|
|
115
|
-
|
|
116
96
|
var _iterator2 = _createForOfIteratorHelper(frustum.points),
|
|
117
|
-
|
|
118
|
-
|
|
97
|
+
_step2;
|
|
119
98
|
try {
|
|
120
99
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
121
100
|
var p = _step2.value;
|
|
@@ -128,16 +107,13 @@ var Aabb = /*#__PURE__*/function () {
|
|
|
128
107
|
} finally {
|
|
129
108
|
_iterator2.f();
|
|
130
109
|
}
|
|
131
|
-
|
|
132
110
|
if (projMax < 0 || projMin > this.max[axis] - this.min[axis]) {
|
|
133
111
|
return 0;
|
|
134
112
|
}
|
|
135
113
|
}
|
|
136
|
-
|
|
137
114
|
return 1;
|
|
138
115
|
}
|
|
139
116
|
}]);
|
|
140
117
|
return Aabb;
|
|
141
118
|
}();
|
|
142
|
-
|
|
143
119
|
exports.default = Aabb;
|