@antv/l7-map 2.18.0 → 2.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/es/camera.d.ts +0 -85
- package/es/camera.js +0 -718
- package/es/css/l7.css +0 -98
- package/es/earthmap.d.ts +0 -66
- package/es/earthmap.js +0 -369
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -108
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -73
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -154
- package/es/geo/mercator.d.ts +0 -29
- package/es/geo/mercator.js +0 -84
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -224
- package/es/geo/simple.d.ts +0 -29
- package/es/geo/simple.js +0 -87
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -961
- package/es/handler/IHandler.d.ts +0 -34
- package/es/handler/IHandler.js +0 -1
- package/es/handler/blockable_map_event.d.ts +0 -17
- package/es/handler/blockable_map_event.js +0 -78
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -180
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -54
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -11
- package/es/handler/events/index.d.ts +0 -4
- package/es/handler/events/index.js +0 -4
- package/es/handler/events/map_mouse_event.d.ts +0 -34
- package/es/handler/events/map_mouse_event.js +0 -64
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -95
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -50
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -26
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -157
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -577
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -9
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -143
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -125
- package/es/handler/mouse/index.d.ts +0 -4
- package/es/handler/mouse/index.js +0 -4
- package/es/handler/mouse/mouse_handler.d.ts +0 -22
- package/es/handler/mouse/mouse_handler.js +0 -118
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -44
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -46
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -46
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -11
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -325
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -67
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -84
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -74
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -115
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -97
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -106
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -54
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -109
- package/es/handler/touch/index.d.ts +0 -5
- package/es/handler/touch/index.js +0 -5
- package/es/handler/touch/touch_pan.d.ts +0 -30
- package/es/handler/touch/touch_pan.js +0 -110
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -93
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -77
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -54
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -125
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -134
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -4
- package/es/interface.d.ts +0 -34
- package/es/interface.js +0 -1
- package/es/map.d.ts +0 -70
- package/es/map.js +0 -387
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -88
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -112
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -140
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -62
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -47
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -89
- package/lib/camera.js +0 -724
- package/lib/css/l7.css +0 -98
- package/lib/earthmap.js +0 -376
- package/lib/geo/edge_insets.js +0 -114
- package/lib/geo/lng_lat.js +0 -81
- package/lib/geo/lng_lat_bounds.js +0 -161
- package/lib/geo/mercator.js +0 -100
- package/lib/geo/point.js +0 -231
- package/lib/geo/simple.js +0 -104
- package/lib/geo/transform.js +0 -971
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.js +0 -84
- package/lib/handler/box_zoom.js +0 -186
- package/lib/handler/click_zoom.js +0 -61
- package/lib/handler/events/event.js +0 -20
- package/lib/handler/events/index.js +0 -27
- package/lib/handler/events/map_mouse_event.js +0 -70
- package/lib/handler/events/map_touch_event.js +0 -100
- package/lib/handler/events/map_wheel_event.js +0 -57
- package/lib/handler/events/render_event.js +0 -33
- package/lib/handler/handler_inertia.js +0 -162
- package/lib/handler/handler_manager.js +0 -584
- package/lib/handler/handler_util.js +0 -15
- package/lib/handler/keyboard.js +0 -151
- package/lib/handler/map_event.js +0 -131
- package/lib/handler/mouse/index.js +0 -27
- package/lib/handler/mouse/mouse_handler.js +0 -124
- package/lib/handler/mouse/mousepan_handler.js +0 -49
- package/lib/handler/mouse/mousepitch_hander.js +0 -51
- package/lib/handler/mouse/mouserotate_hander.js +0 -51
- package/lib/handler/mouse/util.js +0 -22
- package/lib/handler/scroll_zoom.js +0 -333
- package/lib/handler/shim/dblclick_zoom.js +0 -74
- package/lib/handler/shim/drag_pan.js +0 -91
- package/lib/handler/shim/drag_rotate.js +0 -81
- package/lib/handler/shim/touch_zoom_rotate.js +0 -122
- package/lib/handler/tap/single_tap_recognizer.js +0 -106
- package/lib/handler/tap/tap_drag_zoom.js +0 -112
- package/lib/handler/tap/tap_recognizer.js +0 -63
- package/lib/handler/tap/tap_zoom.js +0 -115
- package/lib/handler/touch/index.js +0 -34
- package/lib/handler/touch/touch_pan.js +0 -117
- package/lib/handler/touch/touch_pitch.js +0 -98
- package/lib/handler/touch/touch_rotate.js +0 -82
- package/lib/handler/touch/touch_zoom.js +0 -59
- package/lib/handler/touch/two_touch.js +0 -131
- package/lib/hash.js +0 -143
- package/lib/index.js +0 -49
- package/lib/interface.js +0 -5
- package/lib/map.js +0 -394
- package/lib/util.js +0 -108
- package/lib/utils/Aabb.js +0 -119
- package/lib/utils/dom.js +0 -147
- package/lib/utils/performance.js +0 -70
- package/lib/utils/primitives.js +0 -54
- package/lib/utils/task_queue.js +0 -97
package/lib/map.js
DELETED
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.Map = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
17
|
-
var _camera = _interopRequireDefault(require("./camera"));
|
|
18
|
-
var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
|
|
19
|
-
var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
|
|
20
|
-
var _point = _interopRequireDefault(require("./geo/point"));
|
|
21
|
-
var _handler_manager = _interopRequireDefault(require("./handler/handler_manager"));
|
|
22
|
-
var _hash = _interopRequireDefault(require("./hash"));
|
|
23
|
-
var _util = require("./util");
|
|
24
|
-
var _performance = require("./utils/performance");
|
|
25
|
-
var _task_queue = _interopRequireDefault(require("./utils/task_queue"));
|
|
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); }; }
|
|
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; } }
|
|
28
|
-
function loadStyles(css, doc) {
|
|
29
|
-
var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
|
|
30
|
-
var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
|
|
31
|
-
if (isMiniAli || isWeChatMiniProgram) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (!doc) doc = document;
|
|
35
|
-
if (!doc) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
var head = doc.head || doc.getElementsByTagName('head')[0];
|
|
39
|
-
if (!head) {
|
|
40
|
-
head = doc.createElement('head');
|
|
41
|
-
var body = doc.body || doc.getElementsByTagName('body')[0];
|
|
42
|
-
if (body) {
|
|
43
|
-
body.parentNode.insertBefore(head, body);
|
|
44
|
-
} else {
|
|
45
|
-
doc.documentElement.appendChild(head);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
var style = doc.createElement('style');
|
|
49
|
-
style.type = 'text/css';
|
|
50
|
-
if (style.styleSheet) {
|
|
51
|
-
style.styleSheet.cssText = css;
|
|
52
|
-
} else {
|
|
53
|
-
style.appendChild(doc.createTextNode(css));
|
|
54
|
-
}
|
|
55
|
-
head.appendChild(style);
|
|
56
|
-
return style;
|
|
57
|
-
}
|
|
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
|
|
59
|
-
var defaultMinZoom = -2;
|
|
60
|
-
var defaultMaxZoom = 22;
|
|
61
|
-
var merge = _l7Utils.lodashUtil.merge;
|
|
62
|
-
// the default values, but also the valid range
|
|
63
|
-
var defaultMinPitch = 0;
|
|
64
|
-
var defaultMaxPitch = 60;
|
|
65
|
-
var DefaultOptions = {
|
|
66
|
-
hash: false,
|
|
67
|
-
zoom: -1,
|
|
68
|
-
center: [112, 32],
|
|
69
|
-
pitch: 0,
|
|
70
|
-
bearing: 0,
|
|
71
|
-
interactive: true,
|
|
72
|
-
minZoom: defaultMinZoom,
|
|
73
|
-
maxZoom: defaultMaxZoom,
|
|
74
|
-
minPitch: defaultMinPitch,
|
|
75
|
-
maxPitch: defaultMaxPitch,
|
|
76
|
-
scrollZoom: true,
|
|
77
|
-
boxZoom: true,
|
|
78
|
-
dragRotate: true,
|
|
79
|
-
dragPan: true,
|
|
80
|
-
keyboard: true,
|
|
81
|
-
doubleClickZoom: true,
|
|
82
|
-
touchZoomRotate: true,
|
|
83
|
-
touchPitch: true,
|
|
84
|
-
bearingSnap: 7,
|
|
85
|
-
clickTolerance: 3,
|
|
86
|
-
pitchWithRotate: true,
|
|
87
|
-
trackResize: true,
|
|
88
|
-
renderWorldCopies: true,
|
|
89
|
-
pitchEnabled: true,
|
|
90
|
-
rotateEnabled: true
|
|
91
|
-
};
|
|
92
|
-
var Map = /*#__PURE__*/function (_Camera) {
|
|
93
|
-
(0, _inherits2.default)(Map, _Camera);
|
|
94
|
-
var _super = _createSuper(Map);
|
|
95
|
-
function Map(options) {
|
|
96
|
-
var _this;
|
|
97
|
-
(0, _classCallCheck2.default)(this, Map);
|
|
98
|
-
_this = _super.call(this, merge({}, DefaultOptions, options));
|
|
99
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
|
|
100
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
|
|
101
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
|
|
102
|
-
_this.update();
|
|
103
|
-
});
|
|
104
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowResize", function (event) {
|
|
105
|
-
if (_this.trackResize) {
|
|
106
|
-
_this.resize({
|
|
107
|
-
originalEvent: event
|
|
108
|
-
}).update();
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
_this.initContainer();
|
|
112
|
-
_this.resize();
|
|
113
|
-
_this.handlers = new _handler_manager.default((0, _assertThisInitialized2.default)(_this), _this.options);
|
|
114
|
-
if (typeof window !== 'undefined') {
|
|
115
|
-
window.addEventListener('online', _this.onWindowOnline, false);
|
|
116
|
-
window.addEventListener('resize', _this.onWindowResize, false);
|
|
117
|
-
window.addEventListener('orientationchange', _this.onWindowResize, false);
|
|
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
|
-
}
|
|
123
|
-
|
|
124
|
-
// don't set position from options if set through hash
|
|
125
|
-
if (!_this.hash || !_this.hash.onHashChange()) {
|
|
126
|
-
_this.jumpTo({
|
|
127
|
-
center: options.center,
|
|
128
|
-
zoom: options.zoom,
|
|
129
|
-
bearing: options.bearing,
|
|
130
|
-
pitch: options.pitch
|
|
131
|
-
});
|
|
132
|
-
if (options.bounds) {
|
|
133
|
-
_this.resize();
|
|
134
|
-
_this.fitBounds(options.bounds, merge({}, options.fitBoundsOptions, {
|
|
135
|
-
duration: 0
|
|
136
|
-
}));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return _this;
|
|
140
|
-
}
|
|
141
|
-
(0, _createClass2.default)(Map, [{
|
|
142
|
-
key: "resize",
|
|
143
|
-
value: function resize(eventData) {
|
|
144
|
-
var _this$containerDimens = this.containerDimensions(),
|
|
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
|
-
// 小程序环境不需要执行后续动作
|
|
150
|
-
var fireMoving = !this.moving;
|
|
151
|
-
if (fireMoving) {
|
|
152
|
-
this.stop();
|
|
153
|
-
this.emit('movestart', new window.Event('movestart', eventData));
|
|
154
|
-
this.emit('move', new window.Event('move', eventData));
|
|
155
|
-
}
|
|
156
|
-
this.emit('resize', new window.Event('resize', eventData));
|
|
157
|
-
if (fireMoving) {
|
|
158
|
-
this.emit('moveend', new window.Event('moveend', eventData));
|
|
159
|
-
}
|
|
160
|
-
return this;
|
|
161
|
-
}
|
|
162
|
-
}, {
|
|
163
|
-
key: "getContainer",
|
|
164
|
-
value: function getContainer() {
|
|
165
|
-
return this.container;
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
key: "getCanvas",
|
|
169
|
-
value: function getCanvas() {
|
|
170
|
-
return this.canvas;
|
|
171
|
-
}
|
|
172
|
-
}, {
|
|
173
|
-
key: "getCanvasContainer",
|
|
174
|
-
value: function getCanvasContainer() {
|
|
175
|
-
return this.canvasContainer;
|
|
176
|
-
}
|
|
177
|
-
}, {
|
|
178
|
-
key: "project",
|
|
179
|
-
value: function project(lngLat) {
|
|
180
|
-
return this.transform.locationPoint(_lng_lat.default.convert(lngLat));
|
|
181
|
-
}
|
|
182
|
-
}, {
|
|
183
|
-
key: "unproject",
|
|
184
|
-
value: function unproject(point) {
|
|
185
|
-
return this.transform.pointLocation(_point.default.convert(point));
|
|
186
|
-
}
|
|
187
|
-
}, {
|
|
188
|
-
key: "getBounds",
|
|
189
|
-
value: function getBounds() {
|
|
190
|
-
return this.transform.getBounds();
|
|
191
|
-
}
|
|
192
|
-
}, {
|
|
193
|
-
key: "getMaxBounds",
|
|
194
|
-
value: function getMaxBounds() {
|
|
195
|
-
return this.transform.getMaxBounds();
|
|
196
|
-
}
|
|
197
|
-
}, {
|
|
198
|
-
key: "setMaxBounds",
|
|
199
|
-
value: function setMaxBounds(bounds) {
|
|
200
|
-
this.transform.setMaxBounds(_lng_lat_bounds.default.convert(bounds));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
204
|
-
}, {
|
|
205
|
-
key: "setStyle",
|
|
206
|
-
value: function setStyle(style) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
}, {
|
|
210
|
-
key: "setMinZoom",
|
|
211
|
-
value: function setMinZoom(minZoom) {
|
|
212
|
-
minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
|
|
213
|
-
if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
|
|
214
|
-
this.transform.minZoom = minZoom;
|
|
215
|
-
if (this.getZoom() < minZoom) {
|
|
216
|
-
this.setZoom(minZoom);
|
|
217
|
-
}
|
|
218
|
-
return this;
|
|
219
|
-
} else {
|
|
220
|
-
throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}, {
|
|
224
|
-
key: "getMinZoom",
|
|
225
|
-
value: function getMinZoom() {
|
|
226
|
-
return this.transform.minZoom;
|
|
227
|
-
}
|
|
228
|
-
}, {
|
|
229
|
-
key: "setMaxZoom",
|
|
230
|
-
value: function setMaxZoom(maxZoom) {
|
|
231
|
-
maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
|
|
232
|
-
if (maxZoom >= this.transform.minZoom) {
|
|
233
|
-
this.transform.maxZoom = maxZoom;
|
|
234
|
-
if (this.getZoom() > maxZoom) {
|
|
235
|
-
this.setZoom(maxZoom);
|
|
236
|
-
}
|
|
237
|
-
return this;
|
|
238
|
-
} else {
|
|
239
|
-
throw new Error('maxZoom must be greater than the current minZoom');
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}, {
|
|
243
|
-
key: "getMaxZoom",
|
|
244
|
-
value: function getMaxZoom() {
|
|
245
|
-
return this.transform.maxZoom;
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "setMinPitch",
|
|
249
|
-
value: function setMinPitch(minPitch) {
|
|
250
|
-
minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
|
|
251
|
-
if (minPitch < defaultMinPitch) {
|
|
252
|
-
throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
|
|
253
|
-
}
|
|
254
|
-
if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
|
|
255
|
-
this.transform.minPitch = minPitch;
|
|
256
|
-
if (this.getPitch() < minPitch) {
|
|
257
|
-
this.setPitch(minPitch);
|
|
258
|
-
}
|
|
259
|
-
return this;
|
|
260
|
-
} else {
|
|
261
|
-
throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}, {
|
|
265
|
-
key: "getMinPitch",
|
|
266
|
-
value: function getMinPitch() {
|
|
267
|
-
return this.transform.minPitch;
|
|
268
|
-
}
|
|
269
|
-
}, {
|
|
270
|
-
key: "setMaxPitch",
|
|
271
|
-
value: function setMaxPitch(maxPitch) {
|
|
272
|
-
maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
|
|
273
|
-
if (maxPitch > defaultMaxPitch) {
|
|
274
|
-
throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
|
|
275
|
-
}
|
|
276
|
-
if (maxPitch >= this.transform.minPitch) {
|
|
277
|
-
this.transform.maxPitch = maxPitch;
|
|
278
|
-
if (this.getPitch() > maxPitch) {
|
|
279
|
-
this.setPitch(maxPitch);
|
|
280
|
-
}
|
|
281
|
-
return this;
|
|
282
|
-
} else {
|
|
283
|
-
throw new Error('maxPitch must be greater than the current minPitch');
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}, {
|
|
287
|
-
key: "getMaxPitch",
|
|
288
|
-
value: function getMaxPitch() {
|
|
289
|
-
return this.transform.maxPitch;
|
|
290
|
-
}
|
|
291
|
-
}, {
|
|
292
|
-
key: "getRenderWorldCopies",
|
|
293
|
-
value: function getRenderWorldCopies() {
|
|
294
|
-
return this.transform.renderWorldCopies;
|
|
295
|
-
}
|
|
296
|
-
}, {
|
|
297
|
-
key: "setRenderWorldCopies",
|
|
298
|
-
value: function setRenderWorldCopies(renderWorldCopies) {
|
|
299
|
-
this.transform.renderWorldCopies = !!renderWorldCopies;
|
|
300
|
-
}
|
|
301
|
-
}, {
|
|
302
|
-
key: "remove",
|
|
303
|
-
value: function remove() {
|
|
304
|
-
this.container.removeChild(this.canvasContainer);
|
|
305
|
-
// @ts-ignore
|
|
306
|
-
this.canvasContainer = null;
|
|
307
|
-
if (this.frame) {
|
|
308
|
-
this.frame.cancel();
|
|
309
|
-
this.frame = null;
|
|
310
|
-
}
|
|
311
|
-
this.renderTaskQueue.clear();
|
|
312
|
-
}
|
|
313
|
-
}, {
|
|
314
|
-
key: "requestRenderFrame",
|
|
315
|
-
value: function requestRenderFrame(cb) {
|
|
316
|
-
this.update();
|
|
317
|
-
return this.renderTaskQueue.add(cb);
|
|
318
|
-
}
|
|
319
|
-
}, {
|
|
320
|
-
key: "cancelRenderFrame",
|
|
321
|
-
value: function cancelRenderFrame(id) {
|
|
322
|
-
return this.renderTaskQueue.remove(id);
|
|
323
|
-
}
|
|
324
|
-
}, {
|
|
325
|
-
key: "triggerRepaint",
|
|
326
|
-
value: function triggerRepaint() {
|
|
327
|
-
var _this2 = this;
|
|
328
|
-
if (!this.frame) {
|
|
329
|
-
this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
|
|
330
|
-
_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
331
|
-
_this2.frame = null;
|
|
332
|
-
_this2.update(paintStartTimeStamp);
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}, {
|
|
337
|
-
key: "update",
|
|
338
|
-
value: function update(time) {
|
|
339
|
-
var _this3 = this;
|
|
340
|
-
if (!this.frame) {
|
|
341
|
-
this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
|
|
342
|
-
_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
343
|
-
_this3.frame = null;
|
|
344
|
-
_this3.renderTaskQueue.run(time);
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}, {
|
|
349
|
-
key: "initContainer",
|
|
350
|
-
value: function initContainer() {
|
|
351
|
-
if (typeof this.options.container === 'string') {
|
|
352
|
-
this.container = window.document.getElementById(this.options.container);
|
|
353
|
-
if (!this.container) {
|
|
354
|
-
throw new Error("Container '".concat(this.options.container, "' not found."));
|
|
355
|
-
}
|
|
356
|
-
} else if (this.options.container instanceof HTMLElement) {
|
|
357
|
-
this.container = this.options.container;
|
|
358
|
-
} else {
|
|
359
|
-
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
|
|
360
|
-
}
|
|
361
|
-
var container = this.container;
|
|
362
|
-
container.classList.add('l7-map');
|
|
363
|
-
var canvasContainer = this.canvasContainer = _l7Utils.DOM.create('div', 'l7-canvas-container', container);
|
|
364
|
-
if (this.options.interactive) {
|
|
365
|
-
canvasContainer.classList.add('l7-interactive');
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* 小程序环境构建容器
|
|
371
|
-
*/
|
|
372
|
-
}, {
|
|
373
|
-
key: "initMiniContainer",
|
|
374
|
-
value: function initMiniContainer() {
|
|
375
|
-
this.container = this.options.canvas;
|
|
376
|
-
this.canvasContainer = this.container;
|
|
377
|
-
}
|
|
378
|
-
}, {
|
|
379
|
-
key: "containerDimensions",
|
|
380
|
-
value: function containerDimensions() {
|
|
381
|
-
var width = 0;
|
|
382
|
-
var height = 0;
|
|
383
|
-
if (this.container) {
|
|
384
|
-
width = this.container.clientWidth;
|
|
385
|
-
height = this.container.clientHeight;
|
|
386
|
-
width = width === 0 ? 400 : width;
|
|
387
|
-
height = height === 0 ? 300 : height;
|
|
388
|
-
}
|
|
389
|
-
return [width, height];
|
|
390
|
-
}
|
|
391
|
-
}]);
|
|
392
|
-
return Map;
|
|
393
|
-
}(_camera.default);
|
|
394
|
-
exports.Map = Map;
|
package/lib/util.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.bezier = bezier;
|
|
8
|
-
exports.cancel = void 0;
|
|
9
|
-
exports.clamp = clamp;
|
|
10
|
-
exports.ease = void 0;
|
|
11
|
-
exports.extend = extend;
|
|
12
|
-
exports.interpolate = interpolate;
|
|
13
|
-
exports.now = void 0;
|
|
14
|
-
exports.pick = pick;
|
|
15
|
-
exports.prefersReducedMotion = prefersReducedMotion;
|
|
16
|
-
exports.raf = void 0;
|
|
17
|
-
exports.renderframe = renderframe;
|
|
18
|
-
exports.wrap = wrap;
|
|
19
|
-
var _unitbezier = _interopRequireDefault(require("@mapbox/unitbezier"));
|
|
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; } } }; }
|
|
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); }
|
|
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
|
|
23
|
-
var reducedMotionQuery;
|
|
24
|
-
function wrap(n, min, max) {
|
|
25
|
-
var d = max - min;
|
|
26
|
-
var w = ((n - min) % d + d) % d + min;
|
|
27
|
-
return w === min ? max : w;
|
|
28
|
-
}
|
|
29
|
-
function clamp(n, min, max) {
|
|
30
|
-
return Math.min(max, Math.max(min, n));
|
|
31
|
-
}
|
|
32
|
-
function interpolate(a, b, t) {
|
|
33
|
-
return a * (1 - t) + b * t;
|
|
34
|
-
}
|
|
35
|
-
function bezier(p1x, p1y, p2x, p2y) {
|
|
36
|
-
var bez = new _unitbezier.default(p1x, p1y, p2x, p2y);
|
|
37
|
-
return function (t) {
|
|
38
|
-
return bez.solve(t);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var ease = bezier(0.25, 0.1, 0.25, 1);
|
|
42
|
-
exports.ease = ease;
|
|
43
|
-
function prefersReducedMotion() {
|
|
44
|
-
// Lazily initialize media query
|
|
45
|
-
if (reducedMotionQuery == null) {
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
48
|
-
}
|
|
49
|
-
return reducedMotionQuery.matches;
|
|
50
|
-
}
|
|
51
|
-
function pick(src, properties) {
|
|
52
|
-
var result = {};
|
|
53
|
-
var _iterator = _createForOfIteratorHelper(properties),
|
|
54
|
-
_step;
|
|
55
|
-
try {
|
|
56
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
57
|
-
var name = _step.value;
|
|
58
|
-
if (name in src) {
|
|
59
|
-
result[name] = src[name];
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
} catch (err) {
|
|
63
|
-
_iterator.e(err);
|
|
64
|
-
} finally {
|
|
65
|
-
_iterator.f();
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
var now = window.performance && window.performance.now ? window.performance.now.bind(window.performance) : Date.now.bind(Date);
|
|
70
|
-
exports.now = now;
|
|
71
|
-
var raf = window.requestAnimationFrame ||
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
window.mozRequestAnimationFrame ||
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
window.webkitRequestAnimationFrame ||
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
window.msRequestAnimationFrame;
|
|
78
|
-
exports.raf = raf;
|
|
79
|
-
var _cancel = window.cancelAnimationFrame ||
|
|
80
|
-
// @ts-ignore
|
|
81
|
-
window.mozCancelAnimationFrame ||
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
window.webkitCancelAnimationFrame ||
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
window.msCancelAnimationFrame;
|
|
86
|
-
exports.cancel = _cancel;
|
|
87
|
-
function renderframe(fn) {
|
|
88
|
-
var frame = raf(fn);
|
|
89
|
-
return {
|
|
90
|
-
cancel: function cancel() {
|
|
91
|
-
return _cancel(frame);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function extend(dest) {
|
|
96
|
-
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
97
|
-
sources[_key - 1] = arguments[_key];
|
|
98
|
-
}
|
|
99
|
-
for (var _i = 0, _sources = sources; _i < _sources.length; _i++) {
|
|
100
|
-
var src = _sources[_i];
|
|
101
|
-
for (var k in src) {
|
|
102
|
-
if (src[k] !== undefined) {
|
|
103
|
-
dest[k] = src[k];
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return dest;
|
|
108
|
-
}
|
package/lib/utils/Aabb.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _glMatrix = require("gl-matrix");
|
|
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; } } }; }
|
|
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); }
|
|
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; }
|
|
14
|
-
var Aabb = /*#__PURE__*/function () {
|
|
15
|
-
function Aabb(min, max) {
|
|
16
|
-
(0, _classCallCheck2.default)(this, Aabb);
|
|
17
|
-
this.min = min;
|
|
18
|
-
this.max = max;
|
|
19
|
-
this.center = _glMatrix.vec3.scale(new Float32Array(3), _glMatrix.vec3.add(new Float32Array(3), this.min, this.max), 0.5);
|
|
20
|
-
}
|
|
21
|
-
(0, _createClass2.default)(Aabb, [{
|
|
22
|
-
key: "quadrant",
|
|
23
|
-
value: function quadrant(index) {
|
|
24
|
-
var split = [index % 2 === 0, index < 2];
|
|
25
|
-
var qMin = _glMatrix.vec3.clone(this.min);
|
|
26
|
-
var qMax = _glMatrix.vec3.clone(this.max);
|
|
27
|
-
for (var axis = 0; axis < split.length; axis++) {
|
|
28
|
-
qMin[axis] = split[axis] ? this.min[axis] : this.center[axis];
|
|
29
|
-
qMax[axis] = split[axis] ? this.center[axis] : this.max[axis];
|
|
30
|
-
}
|
|
31
|
-
// Elevation is always constant, hence quadrant.max.z = this.max.z
|
|
32
|
-
qMax[2] = this.max[2];
|
|
33
|
-
return new Aabb(qMin, qMax);
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
key: "distanceX",
|
|
37
|
-
value: function distanceX(point) {
|
|
38
|
-
var pointOnAabb = Math.max(Math.min(this.max[0], point[0]), this.min[0]);
|
|
39
|
-
return pointOnAabb - point[0];
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "distanceY",
|
|
43
|
-
value: function distanceY(point) {
|
|
44
|
-
var pointOnAabb = Math.max(Math.min(this.max[1], point[1]), this.min[1]);
|
|
45
|
-
return pointOnAabb - point[1];
|
|
46
|
-
}
|
|
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.
|
|
50
|
-
}, {
|
|
51
|
-
key: "intersects",
|
|
52
|
-
value: function intersects(frustum) {
|
|
53
|
-
// Execute separating axis test between two convex objects to find intersections
|
|
54
|
-
// Each frustum plane together with 3 major axes define the separating axes
|
|
55
|
-
// Note: test only 4 points as both min and max points have equal elevation
|
|
56
|
-
|
|
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]];
|
|
58
|
-
var fullyInside = true;
|
|
59
|
-
var _iterator = _createForOfIteratorHelper(frustum.planes),
|
|
60
|
-
_step;
|
|
61
|
-
try {
|
|
62
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
63
|
-
var plane = _step.value;
|
|
64
|
-
var pointsInside = 0;
|
|
65
|
-
var _iterator3 = _createForOfIteratorHelper(aabbPoints),
|
|
66
|
-
_step3;
|
|
67
|
-
try {
|
|
68
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
69
|
-
var i = _step3.value;
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
pointsInside += _glMatrix.vec4.dot(plane, i) >= 0;
|
|
72
|
-
}
|
|
73
|
-
} catch (err) {
|
|
74
|
-
_iterator3.e(err);
|
|
75
|
-
} finally {
|
|
76
|
-
_iterator3.f();
|
|
77
|
-
}
|
|
78
|
-
if (pointsInside === 0) {
|
|
79
|
-
return 0;
|
|
80
|
-
}
|
|
81
|
-
if (pointsInside !== aabbPoints.length) {
|
|
82
|
-
fullyInside = false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch (err) {
|
|
86
|
-
_iterator.e(err);
|
|
87
|
-
} finally {
|
|
88
|
-
_iterator.f();
|
|
89
|
-
}
|
|
90
|
-
if (fullyInside) {
|
|
91
|
-
return 2;
|
|
92
|
-
}
|
|
93
|
-
for (var axis = 0; axis < 3; axis++) {
|
|
94
|
-
var projMin = Number.MAX_VALUE;
|
|
95
|
-
var projMax = -Number.MAX_VALUE;
|
|
96
|
-
var _iterator2 = _createForOfIteratorHelper(frustum.points),
|
|
97
|
-
_step2;
|
|
98
|
-
try {
|
|
99
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
100
|
-
var p = _step2.value;
|
|
101
|
-
var projectedPoint = p[axis] - this.min[axis];
|
|
102
|
-
projMin = Math.min(projMin, projectedPoint);
|
|
103
|
-
projMax = Math.max(projMax, projectedPoint);
|
|
104
|
-
}
|
|
105
|
-
} catch (err) {
|
|
106
|
-
_iterator2.e(err);
|
|
107
|
-
} finally {
|
|
108
|
-
_iterator2.f();
|
|
109
|
-
}
|
|
110
|
-
if (projMax < 0 || projMin > this.max[axis] - this.min[axis]) {
|
|
111
|
-
return 0;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return 1;
|
|
115
|
-
}
|
|
116
|
-
}]);
|
|
117
|
-
return Aabb;
|
|
118
|
-
}();
|
|
119
|
-
exports.default = Aabb;
|