@antv/l7-map 2.17.12 → 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.
Files changed (168) hide show
  1. package/package.json +4 -4
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -775
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -422
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -118
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -81
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -167
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -92
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -231
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -92
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -971
  21. package/es/handler/IHandler.d.ts +0 -34
  22. package/es/handler/IHandler.js +0 -1
  23. package/es/handler/blockable_map_event.d.ts +0 -17
  24. package/es/handler/blockable_map_event.js +0 -83
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -200
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -59
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -12
  31. package/es/handler/events/index.d.ts +0 -4
  32. package/es/handler/events/index.js +0 -4
  33. package/es/handler/events/map_mouse_event.d.ts +0 -34
  34. package/es/handler/events/map_mouse_event.js +0 -75
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -105
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -61
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -39
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -184
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -684
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -10
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -162
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -131
  51. package/es/handler/mouse/index.d.ts +0 -4
  52. package/es/handler/mouse/index.js +0 -4
  53. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  54. package/es/handler/mouse/mouse_handler.js +0 -131
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -54
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -56
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -56
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -12
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -353
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -72
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -96
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -80
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -130
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -120
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -114
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -62
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -115
  81. package/es/handler/touch/index.d.ts +0 -5
  82. package/es/handler/touch/index.js +0 -5
  83. package/es/handler/touch/touch_pan.d.ts +0 -30
  84. package/es/handler/touch/touch_pan.js +0 -128
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -110
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -88
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -67
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -138
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -156
  95. package/es/index.d.ts +0 -4
  96. package/es/index.js +0 -4
  97. package/es/interface.d.ts +0 -34
  98. package/es/interface.js +0 -1
  99. package/es/map.d.ts +0 -70
  100. package/es/map.js +0 -464
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -101
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -133
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -218
  107. package/es/utils/performance.d.ts +0 -17
  108. package/es/utils/performance.js +0 -62
  109. package/es/utils/primitives.d.ts +0 -6
  110. package/es/utils/primitives.js +0 -45
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -106
  113. package/lib/camera.js +0 -801
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -445
  116. package/lib/geo/edge_insets.js +0 -129
  117. package/lib/geo/lng_lat.js +0 -94
  118. package/lib/geo/lng_lat_bounds.js +0 -177
  119. package/lib/geo/mercator.js +0 -121
  120. package/lib/geo/point.js +0 -239
  121. package/lib/geo/simple.js +0 -123
  122. package/lib/geo/transform.js +0 -1013
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -92
  125. package/lib/handler/box_zoom.js +0 -217
  126. package/lib/handler/click_zoom.js +0 -67
  127. package/lib/handler/events/event.js +0 -23
  128. package/lib/handler/events/index.js +0 -31
  129. package/lib/handler/events/map_mouse_event.js +0 -87
  130. package/lib/handler/events/map_touch_event.js +0 -119
  131. package/lib/handler/events/map_wheel_event.js +0 -72
  132. package/lib/handler/events/render_event.js +0 -52
  133. package/lib/handler/handler_inertia.js +0 -193
  134. package/lib/handler/handler_manager.js +0 -714
  135. package/lib/handler/handler_util.js +0 -17
  136. package/lib/handler/keyboard.js +0 -172
  137. package/lib/handler/map_event.js +0 -140
  138. package/lib/handler/mouse/index.js +0 -31
  139. package/lib/handler/mouse/mouse_handler.js +0 -141
  140. package/lib/handler/mouse/mousepan_handler.js +0 -66
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -67
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -67
  143. package/lib/handler/mouse/util.js +0 -26
  144. package/lib/handler/scroll_zoom.js +0 -367
  145. package/lib/handler/shim/dblclick_zoom.js +0 -80
  146. package/lib/handler/shim/drag_pan.js +0 -105
  147. package/lib/handler/shim/drag_rotate.js +0 -88
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -139
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -131
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -124
  151. package/lib/handler/tap/tap_recognizer.js +0 -78
  152. package/lib/handler/tap/tap_zoom.js +0 -124
  153. package/lib/handler/touch/index.js +0 -39
  154. package/lib/handler/touch/touch_pan.js +0 -138
  155. package/lib/handler/touch/touch_pitch.js +0 -120
  156. package/lib/handler/touch/touch_rotate.js +0 -99
  157. package/lib/handler/touch/touch_zoom.js +0 -78
  158. package/lib/handler/touch/two_touch.js +0 -148
  159. package/lib/hash.js +0 -169
  160. package/lib/index.js +0 -57
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -489
  163. package/lib/util.js +0 -135
  164. package/lib/utils/Aabb.js +0 -143
  165. package/lib/utils/dom.js +0 -233
  166. package/lib/utils/performance.js +0 -72
  167. package/lib/utils/primitives.js +0 -57
  168. package/lib/utils/task_queue.js +0 -115
package/lib/css/l7.css DELETED
@@ -1,98 +0,0 @@
1
- .l7-map {
2
- font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
3
- overflow: hidden;
4
- position: relative;
5
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
6
- }
7
-
8
- .l7-canvas {
9
- position: absolute;
10
- left: 0;
11
- top: 0;
12
- }
13
-
14
- .l7-map:-webkit-full-screen {
15
- width: 100%;
16
- height: 100%;
17
- }
18
-
19
- .l7-canary {
20
- background-color: salmon;
21
- }
22
-
23
- .l7-canvas-container.l7-interactive,
24
- .l7-ctrl-group button.l7-ctrl-compass {
25
- cursor: -webkit-grab;
26
- cursor: -moz-grab;
27
- cursor: grab;
28
- -moz-user-select: none;
29
- -webkit-user-select: none;
30
- -ms-user-select: none;
31
- user-select: none;
32
- }
33
-
34
- .l7-canvas-container.l7-interactive.l7-track-pointer {
35
- cursor: pointer;
36
- }
37
-
38
- .l7-canvas-container.l7-interactive:active,
39
- .l7-ctrl-group button.l7-ctrl-compass:active {
40
- cursor: -webkit-grabbing;
41
- cursor: -moz-grabbing;
42
- cursor: grabbing;
43
- }
44
-
45
- .l7-canvas-container.l7-touch-zoom-rotate,
46
- .l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {
47
- touch-action: pan-x pan-y;
48
- }
49
-
50
- .l7-canvas-container.l7-touch-drag-pan,
51
- .l7-canvas-container.l7-touch-drag-pan .l7-canvas {
52
- touch-action: pinch-zoom;
53
- }
54
-
55
- .l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,
56
- .l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {
57
- touch-action: none;
58
- }
59
-
60
- .l7-ctrl-top-left,
61
- .l7-ctrl-top-right,
62
- .l7-ctrl-bottom-left,
63
- .l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }
64
- .l7-ctrl-top-left { top: 0; left: 0; }
65
- .l7-ctrl-top-right { top: 0; right: 0; }
66
- .l7-ctrl-bottom-left { bottom: 0; left: 0; }
67
- .l7-ctrl-bottom-right { right: 0; bottom: 0; }
68
-
69
- .l7-ctrl {
70
- clear: both;
71
- pointer-events: auto;
72
-
73
- /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */
74
- transform: translate(0, 0);
75
- }
76
- .l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }
77
- .l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }
78
- .l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }
79
- .l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }
80
-
81
-
82
- .l7-crosshair,
83
- .l7-crosshair .l7-interactive,
84
- .l7-crosshair .l7-interactive:active {
85
- cursor: crosshair;
86
- }
87
-
88
- .l7-boxzoom {
89
- position: absolute;
90
- top: 0;
91
- left: 0;
92
- width: 0;
93
- height: 0;
94
- background: #fff;
95
- border: 2px dotted #202020;
96
- opacity: 0.5;
97
- z-index: 10;
98
- }
package/lib/earthmap.js DELETED
@@ -1,445 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.EarthMap = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
- var _l7Utils = require("@antv/l7-utils");
25
-
26
- var _lodash = require("lodash");
27
-
28
- var _camera = _interopRequireDefault(require("./camera"));
29
-
30
- var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
31
-
32
- var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
33
-
34
- var _point = _interopRequireDefault(require("./geo/point"));
35
-
36
- var _handler_manager = _interopRequireDefault(require("./handler/handler_manager"));
37
-
38
- var _util = require("./util");
39
-
40
- var _performance = require("./utils/performance");
41
-
42
- var _task_queue = _interopRequireDefault(require("./utils/task_queue"));
43
-
44
- 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); }; }
45
-
46
- 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; } }
47
-
48
- function loadStyles(css, doc) {
49
- var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
50
- var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
51
-
52
- if (isMiniAli || isWeChatMiniProgram) {
53
- return;
54
- }
55
-
56
- if (!doc) doc = document;
57
-
58
- if (!doc) {
59
- return;
60
- }
61
-
62
- var head = doc.head || doc.getElementsByTagName('head')[0];
63
-
64
- if (!head) {
65
- head = doc.createElement('head');
66
- var body = doc.body || doc.getElementsByTagName('body')[0];
67
-
68
- if (body) {
69
- body.parentNode.insertBefore(head, body);
70
- } else {
71
- doc.documentElement.appendChild(head);
72
- }
73
- }
74
-
75
- var style = doc.createElement('style');
76
- style.type = 'text/css';
77
-
78
- if (style.styleSheet) {
79
- style.styleSheet.cssText = css;
80
- } else {
81
- style.appendChild(doc.createTextNode(css));
82
- }
83
-
84
- head.appendChild(style);
85
- return style;
86
- }
87
-
88
- 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");
89
- var defaultMinZoom = -2;
90
- var defaultMaxZoom = 22; // the default values, but also the valid range
91
-
92
- var defaultMinPitch = 0;
93
- var defaultMaxPitch = 60;
94
- var DefaultOptions = {
95
- hash: false,
96
- zoom: -1,
97
- center: [112, 32],
98
- pitch: 0,
99
- bearing: 0,
100
- interactive: true,
101
- minZoom: defaultMinZoom,
102
- maxZoom: defaultMaxZoom,
103
- minPitch: defaultMinPitch,
104
- maxPitch: defaultMaxPitch,
105
- scrollZoom: true,
106
- boxZoom: true,
107
- dragRotate: true,
108
- dragPan: true,
109
- keyboard: true,
110
- doubleClickZoom: true,
111
- touchZoomRotate: true,
112
- touchPitch: true,
113
- bearingSnap: 7,
114
- clickTolerance: 3,
115
- pitchWithRotate: true,
116
- trackResize: true,
117
- renderWorldCopies: true,
118
- pitchEnabled: true,
119
- rotateEnabled: true
120
- };
121
-
122
- var EarthMap = /*#__PURE__*/function (_Camera) {
123
- (0, _inherits2.default)(EarthMap, _Camera);
124
-
125
- var _super = _createSuper(EarthMap);
126
-
127
- function EarthMap(options) {
128
- var _this;
129
-
130
- (0, _classCallCheck2.default)(this, EarthMap);
131
- _this = _super.call(this, (0, _lodash.merge)({}, DefaultOptions, options));
132
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
133
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
134
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
135
- _this.update();
136
- });
137
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowResize", function (event) {
138
- if (_this.trackResize) {
139
- _this.resize({
140
- originalEvent: event
141
- }).update();
142
- }
143
- });
144
-
145
- _this.initContainer();
146
-
147
- _this.resize();
148
-
149
- _this.handlers = new _handler_manager.default((0, _assertThisInitialized2.default)(_this), _this.options);
150
-
151
- if (typeof window !== 'undefined') {
152
- window.addEventListener('online', _this.onWindowOnline, false);
153
- window.addEventListener('resize', _this.onWindowResize, false);
154
- window.addEventListener('orientationchange', _this.onWindowResize, false);
155
- }
156
-
157
- return _this;
158
- }
159
-
160
- (0, _createClass2.default)(EarthMap, [{
161
- key: "resize",
162
- value: function resize(eventData) {
163
- var dimensions = this.containerDimensions();
164
- var width = dimensions[0];
165
- var height = dimensions[1]; // this.resizeCanvas(width, height);
166
-
167
- this.transform.resize(width, height);
168
- var fireMoving = !this.moving;
169
-
170
- if (fireMoving) {
171
- this.stop();
172
- this.emit('movestart', new Event('movestart', eventData));
173
- this.emit('move', new Event('move', eventData));
174
- }
175
-
176
- this.emit('resize', new Event('resize', eventData));
177
-
178
- if (fireMoving) {
179
- this.emit('moveend', new Event('moveend', eventData));
180
- }
181
-
182
- return this;
183
- }
184
- }, {
185
- key: "getContainer",
186
- value: function getContainer() {
187
- return this.container;
188
- }
189
- }, {
190
- key: "getCanvas",
191
- value: function getCanvas() {
192
- return this.canvas;
193
- }
194
- }, {
195
- key: "getCanvasContainer",
196
- value: function getCanvasContainer() {
197
- return this.canvasContainer;
198
- }
199
- }, {
200
- key: "project",
201
- value: function project(lngLat) {
202
- return this.transform.locationPoint(_lng_lat.default.convert(lngLat));
203
- }
204
- }, {
205
- key: "unproject",
206
- value: function unproject(point) {
207
- return this.transform.pointLocation(_point.default.convert(point));
208
- }
209
- }, {
210
- key: "getBounds",
211
- value: function getBounds() {
212
- return this.transform.getBounds();
213
- }
214
- }, {
215
- key: "getMaxBounds",
216
- value: function getMaxBounds() {
217
- return this.transform.getMaxBounds();
218
- }
219
- }, {
220
- key: "setMaxBounds",
221
- value: function setMaxBounds(bounds) {
222
- this.transform.setMaxBounds(_lng_lat_bounds.default.convert(bounds));
223
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
224
-
225
- }, {
226
- key: "setStyle",
227
- value: function setStyle(style) {
228
- return;
229
- }
230
- }, {
231
- key: "setMinZoom",
232
- value: function setMinZoom(minZoom) {
233
- minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
234
-
235
- if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
236
- this.transform.minZoom = minZoom;
237
-
238
- if (this.getZoom() < minZoom) {
239
- this.setZoom(minZoom);
240
- }
241
-
242
- return this;
243
- } else {
244
- throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
245
- }
246
- }
247
- }, {
248
- key: "getMinZoom",
249
- value: function getMinZoom() {
250
- return this.transform.minZoom;
251
- }
252
- }, {
253
- key: "setMaxZoom",
254
- value: function setMaxZoom(maxZoom) {
255
- maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
256
-
257
- if (maxZoom >= this.transform.minZoom) {
258
- this.transform.maxZoom = maxZoom;
259
-
260
- if (this.getZoom() > maxZoom) {
261
- this.setZoom(maxZoom);
262
- }
263
-
264
- return this;
265
- } else {
266
- throw new Error('maxZoom must be greater than the current minZoom');
267
- }
268
- }
269
- }, {
270
- key: "getMaxZoom",
271
- value: function getMaxZoom() {
272
- return this.transform.maxZoom;
273
- }
274
- }, {
275
- key: "setMinPitch",
276
- value: function setMinPitch(minPitch) {
277
- minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
278
-
279
- if (minPitch < defaultMinPitch) {
280
- throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
281
- }
282
-
283
- if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
284
- this.transform.minPitch = minPitch;
285
-
286
- if (this.getPitch() < minPitch) {
287
- this.setPitch(minPitch);
288
- }
289
-
290
- return this;
291
- } else {
292
- throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
293
- }
294
- }
295
- }, {
296
- key: "getMinPitch",
297
- value: function getMinPitch() {
298
- return this.transform.minPitch;
299
- }
300
- }, {
301
- key: "setMaxPitch",
302
- value: function setMaxPitch(maxPitch) {
303
- maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
304
-
305
- if (maxPitch > defaultMaxPitch) {
306
- throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
307
- }
308
-
309
- if (maxPitch >= this.transform.minPitch) {
310
- this.transform.maxPitch = maxPitch;
311
-
312
- if (this.getPitch() > maxPitch) {
313
- this.setPitch(maxPitch);
314
- }
315
-
316
- return this;
317
- } else {
318
- throw new Error('maxPitch must be greater than the current minPitch');
319
- }
320
- }
321
- }, {
322
- key: "getMaxPitch",
323
- value: function getMaxPitch() {
324
- return this.transform.maxPitch;
325
- }
326
- }, {
327
- key: "getRenderWorldCopies",
328
- value: function getRenderWorldCopies() {
329
- return this.transform.renderWorldCopies;
330
- }
331
- }, {
332
- key: "setRenderWorldCopies",
333
- value: function setRenderWorldCopies(renderWorldCopies) {
334
- this.transform.renderWorldCopies = !!renderWorldCopies;
335
- }
336
- }, {
337
- key: "remove",
338
- value: function remove() {
339
- if (this.frame) {
340
- this.frame.cancel();
341
- this.frame = null;
342
- }
343
-
344
- this.renderTaskQueue.clear();
345
- }
346
- }, {
347
- key: "requestRenderFrame",
348
- value: function requestRenderFrame(cb) {
349
- this.update();
350
- return this.renderTaskQueue.add(cb);
351
- }
352
- }, {
353
- key: "cancelRenderFrame",
354
- value: function cancelRenderFrame(id) {
355
- return this.renderTaskQueue.remove(id);
356
- }
357
- }, {
358
- key: "triggerRepaint",
359
- value: function triggerRepaint() {
360
- var _this2 = this;
361
-
362
- if (!this.frame) {
363
- this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
364
- _performance.PerformanceUtils.frame(paintStartTimeStamp);
365
-
366
- _this2.frame = null;
367
-
368
- _this2.update(paintStartTimeStamp);
369
- });
370
- }
371
- }
372
- }, {
373
- key: "update",
374
- value: function update(time) {
375
- var _this3 = this;
376
-
377
- if (!this.frame) {
378
- this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
379
- _performance.PerformanceUtils.frame(paintStartTimeStamp);
380
-
381
- _this3.frame = null;
382
-
383
- _this3.renderTaskQueue.run(time);
384
- });
385
- }
386
- }
387
- }, {
388
- key: "initContainer",
389
- value: function initContainer() {
390
- if (typeof this.options.container === 'string') {
391
- this.container = window.document.getElementById(this.options.container);
392
-
393
- if (!this.container) {
394
- throw new Error("Container '".concat(this.options.container, "' not found."));
395
- }
396
- } else if (this.options.container instanceof HTMLElement) {
397
- this.container = this.options.container;
398
- } else {
399
- throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
400
- }
401
-
402
- var container = this.container;
403
- container.classList.add('l7-map');
404
-
405
- var canvasContainer = this.canvasContainer = _l7Utils.DOM.create('div', 'l7-canvas-container', container);
406
-
407
- if (this.options.interactive) {
408
- canvasContainer.classList.add('l7-interactive');
409
- } // this.canvas = DOM.create(
410
- // 'canvas',
411
- // 'l7-canvas',
412
- // canvasContainer,
413
- // ) as HTMLCanvasElement;
414
- // this.canvas.setAttribute('tabindex', '-');
415
- // this.canvas.setAttribute('aria-label', 'Map');
416
-
417
- }
418
- }, {
419
- key: "containerDimensions",
420
- value: function containerDimensions() {
421
- var width = 0;
422
- var height = 0;
423
-
424
- if (this.container) {
425
- width = this.container.clientWidth || 400;
426
- height = this.container.clientHeight || 300;
427
- }
428
-
429
- return [width, height];
430
- }
431
- }, {
432
- key: "resizeCanvas",
433
- value: function resizeCanvas(width, height) {
434
- var pixelRatio = _l7Utils.DOM.DPR || 1;
435
- this.canvas.width = pixelRatio * width;
436
- this.canvas.height = pixelRatio * height; // Maintain the same canvas size, potentially downscaling it for HiDPI displays
437
-
438
- this.canvas.style.width = "".concat(width, "px");
439
- this.canvas.style.height = "".concat(height, "px");
440
- }
441
- }]);
442
- return EarthMap;
443
- }(_camera.default);
444
-
445
- exports.EarthMap = EarthMap;
@@ -1,129 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _util = require("../util");
15
-
16
- var _point = _interopRequireDefault(require("./point"));
17
-
18
- // @ts-ignore
19
-
20
- /**
21
- * An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
22
- * This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
23
- * on top of the map and having the vanishing point shift as UI elements resize.
24
- *
25
- * @param {number} [top=0]
26
- * @param {number} [bottom=0]
27
- * @param {number} [left=0]
28
- * @param {number} [right=0]
29
- */
30
- var EdgeInsets = /*#__PURE__*/function () {
31
- function EdgeInsets() {
32
- var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
33
- var bottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
34
- var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
35
- var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
36
- (0, _classCallCheck2.default)(this, EdgeInsets);
37
-
38
- if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {
39
- throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');
40
- }
41
-
42
- this.top = top;
43
- this.bottom = bottom;
44
- this.left = left;
45
- this.right = right;
46
- }
47
- /**
48
- * Interpolates the inset in-place.
49
- * This maintains the current inset value for any inset not present in `target`.
50
- *
51
- * @param {PaddingOptions} target
52
- * @param {number} t
53
- * @returns {EdgeInsets}
54
- * @memberof EdgeInsets
55
- */
56
-
57
-
58
- (0, _createClass2.default)(EdgeInsets, [{
59
- key: "interpolate",
60
- value: function interpolate(start, target, t) {
61
- if (target.top != null && start.top != null) {
62
- this.top = (0, _util.interpolate)(start.top, target.top, t);
63
- }
64
-
65
- if (target.bottom != null && start.bottom != null) {
66
- this.bottom = (0, _util.interpolate)(start.bottom, target.bottom, t);
67
- }
68
-
69
- if (target.left != null && start.left != null) {
70
- this.left = (0, _util.interpolate)(start.left, target.left, t);
71
- }
72
-
73
- if (target.right != null && start.right != null) {
74
- this.right = (0, _util.interpolate)(start.right, target.right, t);
75
- }
76
-
77
- return this;
78
- }
79
- /**
80
- * Utility method that computes the new apprent center or vanishing point after applying insets.
81
- * This is in pixels and with the top left being (0.0) and +y being downwards.
82
- *
83
- * @param {number} width
84
- * @param {number} height
85
- * @returns {Point}
86
- * @memberof EdgeInsets
87
- */
88
-
89
- }, {
90
- key: "getCenter",
91
- value: function getCenter(width, height) {
92
- // Clamp insets so they never overflow width/height and always calculate a valid center
93
- var x = (0, _util.clamp)((this.left + width - this.right) / 2, 0, width);
94
- var y = (0, _util.clamp)((this.top + height - this.bottom) / 2, 0, height);
95
- return new _point.default(x, y);
96
- }
97
- }, {
98
- key: "equals",
99
- value: function equals(other) {
100
- return this.top === other.top && this.bottom === other.bottom && this.left === other.left && this.right === other.right;
101
- }
102
- }, {
103
- key: "clone",
104
- value: function clone() {
105
- return new EdgeInsets(this.top, this.bottom, this.left, this.right);
106
- }
107
- /**
108
- * Returns the current sdtate as json, useful when you want to have a
109
- * read-only representation of the inset.
110
- *
111
- * @returns {PaddingOptions}
112
- * @memberof EdgeInsets
113
- */
114
-
115
- }, {
116
- key: "toJSON",
117
- value: function toJSON() {
118
- return {
119
- top: this.top,
120
- bottom: this.bottom,
121
- left: this.left,
122
- right: this.right
123
- };
124
- }
125
- }]);
126
- return EdgeInsets;
127
- }();
128
-
129
- exports.default = EdgeInsets;