@antv/l7-map 2.9.37-alpha.1 → 2.9.37-alpha.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 +3 -3
  2. package/es/camera.d.ts +0 -84
  3. package/es/camera.js +0 -767
  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 -28
  14. package/es/geo/mercator.js +0 -91
  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 -3
  96. package/es/index.js +0 -3
  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 -18
  102. package/es/util.js +0 -84
  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 -793
  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 -120
  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 -44
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -489
  163. package/lib/util.js +0 -116
  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/hash.js DELETED
@@ -1,169 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
- var _l7Utils = require("@antv/l7-utils");
17
-
18
- var _lodash = require("lodash");
19
-
20
- // @ts-ignore
21
- // tslint:disable-next-line:no-submodule-imports
22
-
23
- /*
24
- * Adds the map's position to its page's location hash.
25
- * Passed as an option to the map object.
26
- *
27
- * @returns {Hash} `this`
28
- */
29
- var Hash = /*#__PURE__*/function () {
30
- function Hash(hashName) {
31
- var _this = this;
32
-
33
- (0, _classCallCheck2.default)(this, Hash);
34
- (0, _defineProperty2.default)(this, "onHashChange", function () {
35
- var loc = _this.getCurrentHash();
36
-
37
- if (loc.length >= 3 && !loc.some(function (v) {
38
- return isNaN(+v);
39
- })) {
40
- var bearing = _this.map.dragRotate.isEnabled() && _this.map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : _this.map.getBearing();
41
-
42
- _this.map.jumpTo({
43
- center: [+loc[2], +loc[1]],
44
- zoom: +loc[0],
45
- bearing: bearing,
46
- pitch: +(loc[4] || 0)
47
- });
48
-
49
- return true;
50
- }
51
-
52
- return false;
53
- });
54
- (0, _defineProperty2.default)(this, "getCurrentHash", function () {
55
- // Get the current hash from location, stripped from its number sign
56
- var hash = window.location.hash.replace('#', '');
57
-
58
- if (_this.hashName) {
59
- // Split the parameter-styled hash into parts and find the value we need
60
- var keyval;
61
- hash.split('&').map(function (part) {
62
- return part.split('=');
63
- }).forEach(function (part) {
64
- if (part[0] === _this.hashName) {
65
- keyval = part;
66
- }
67
- });
68
- return (keyval ? keyval[1] || '' : '').split('/');
69
- }
70
-
71
- return hash.split('/');
72
- });
73
- (0, _defineProperty2.default)(this, "updateHashUnthrottled", function () {
74
- var hash = _this.getHashString();
75
-
76
- try {
77
- window.history.replaceState(window.history.state, '', hash);
78
- } catch (SecurityError) {// IE11 does not allow this if the page is within an iframe created
79
- // with iframe.contentWindow.document.write(...).
80
- // https://github.com/mapbox/mapbox-gl-js/issues/7410
81
- }
82
- });
83
- this.hashName = hashName && encodeURIComponent(hashName); // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
84
-
85
- this.updateHash = (0, _lodash.throttle)(this.updateHashUnthrottled, 30 * 1000 / 100);
86
- }
87
-
88
- (0, _createClass2.default)(Hash, [{
89
- key: "addTo",
90
- value: function addTo(map) {
91
- this.map = map;
92
-
93
- _l7Utils.$window.addEventListener('hashchange', this.onHashChange, false);
94
-
95
- this.map.on('moveend', this.updateHash);
96
- return this;
97
- }
98
- }, {
99
- key: "remove",
100
- value: function remove() {
101
- _l7Utils.$window.removeEventListener('hashchange', this.onHashChange, false);
102
-
103
- this.map.off('moveend', this.updateHash); // clearTimeout(this.updateHash());
104
- // @ts-ignore
105
-
106
- delete this.map;
107
- return this;
108
- }
109
- }, {
110
- key: "getHashString",
111
- value: function getHashString(mapFeedback) {
112
- var center = this.map.getCenter();
113
- var zoom = Math.round(this.map.getZoom() * 100) / 100; // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px
114
-
115
- var precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10);
116
- var m = Math.pow(10, precision);
117
- var lng = Math.round(center.lng * m) / m;
118
- var lat = Math.round(center.lat * m) / m;
119
- var bearing = this.map.getBearing();
120
- var pitch = this.map.getPitch();
121
- var hash = '';
122
-
123
- if (mapFeedback) {
124
- // new map feedback site has some constraints that don't allow
125
- // us to use the same hash format as we do for the Map hash option.
126
- hash += "/".concat(lng, "/").concat(lat, "/").concat(zoom);
127
- } else {
128
- hash += "".concat(zoom, "/").concat(lat, "/").concat(lng);
129
- }
130
-
131
- if (bearing || pitch) {
132
- hash += "/".concat(Math.round(bearing * 10) / 10);
133
- }
134
-
135
- if (pitch) {
136
- hash += "/".concat(Math.round(pitch));
137
- }
138
-
139
- if (this.hashName) {
140
- var hashName = this.hashName;
141
- var found = false;
142
- var parts = window.location.hash.slice(1).split('&').map(function (part) {
143
- var key = part.split('=')[0];
144
-
145
- if (key === hashName) {
146
- found = true;
147
- return "".concat(key, "=").concat(hash);
148
- }
149
-
150
- return part;
151
- }).filter(function (a) {
152
- return a;
153
- });
154
-
155
- if (!found) {
156
- parts.push("".concat(hashName, "=").concat(hash));
157
- }
158
-
159
- return "#".concat(parts.join('&'));
160
- }
161
-
162
- return "#".concat(hash);
163
- }
164
- }]);
165
- return Hash;
166
- }();
167
-
168
- var _default = Hash;
169
- exports.default = _default;
package/lib/index.js DELETED
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _map = require("./map");
8
-
9
- Object.keys(_map).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _map[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function get() {
15
- return _map[key];
16
- }
17
- });
18
- });
19
-
20
- var _earthmap = require("./earthmap");
21
-
22
- Object.keys(_earthmap).forEach(function (key) {
23
- if (key === "default" || key === "__esModule") return;
24
- if (key in exports && exports[key] === _earthmap[key]) return;
25
- Object.defineProperty(exports, key, {
26
- enumerable: true,
27
- get: function get() {
28
- return _earthmap[key];
29
- }
30
- });
31
- });
32
-
33
- var _interface = require("./interface");
34
-
35
- Object.keys(_interface).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (key in exports && exports[key] === _interface[key]) return;
38
- Object.defineProperty(exports, key, {
39
- enumerable: true,
40
- get: function get() {
41
- return _interface[key];
42
- }
43
- });
44
- });
package/lib/interface.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
package/lib/map.js DELETED
@@ -1,489 +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.Map = void 0;
9
-
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
- var _l7Utils = require("@antv/l7-utils");
27
-
28
- var _lodash = require("lodash");
29
-
30
- var _camera = _interopRequireDefault(require("./camera"));
31
-
32
- var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
33
-
34
- var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
35
-
36
- var _point = _interopRequireDefault(require("./geo/point"));
37
-
38
- var _handler_manager = _interopRequireDefault(require("./handler/handler_manager"));
39
-
40
- var _hash = _interopRequireDefault(require("./hash"));
41
-
42
- var _util = require("./util");
43
-
44
- var _performance = require("./utils/performance");
45
-
46
- var _task_queue = _interopRequireDefault(require("./utils/task_queue"));
47
-
48
- 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
- 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
- function loadStyles(css, doc) {
53
- var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
54
- var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
55
-
56
- if (isMiniAli || isWeChatMiniProgram) {
57
- return;
58
- }
59
-
60
- if (!doc) doc = document;
61
-
62
- if (!doc) {
63
- return;
64
- }
65
-
66
- var head = doc.head || doc.getElementsByTagName('head')[0];
67
-
68
- if (!head) {
69
- head = doc.createElement('head');
70
- var body = doc.body || doc.getElementsByTagName('body')[0];
71
-
72
- if (body) {
73
- body.parentNode.insertBefore(head, body);
74
- } else {
75
- doc.documentElement.appendChild(head);
76
- }
77
- }
78
-
79
- var style = doc.createElement('style');
80
- style.type = 'text/css';
81
-
82
- if (style.styleSheet) {
83
- style.styleSheet.cssText = css;
84
- } else {
85
- style.appendChild(doc.createTextNode(css));
86
- }
87
-
88
- head.appendChild(style);
89
- return style;
90
- }
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");
93
- var defaultMinZoom = -2;
94
- var defaultMaxZoom = 22; // the default values, but also the valid range
95
-
96
- var defaultMinPitch = 0;
97
- var defaultMaxPitch = 60;
98
- var DefaultOptions = {
99
- hash: false,
100
- zoom: -1,
101
- center: [112, 32],
102
- pitch: 0,
103
- bearing: 0,
104
- interactive: true,
105
- minZoom: defaultMinZoom,
106
- maxZoom: defaultMaxZoom,
107
- minPitch: defaultMinPitch,
108
- maxPitch: defaultMaxPitch,
109
- scrollZoom: true,
110
- boxZoom: true,
111
- dragRotate: true,
112
- dragPan: true,
113
- keyboard: true,
114
- doubleClickZoom: true,
115
- touchZoomRotate: true,
116
- touchPitch: true,
117
- bearingSnap: 7,
118
- clickTolerance: 3,
119
- pitchWithRotate: true,
120
- trackResize: true,
121
- renderWorldCopies: true,
122
- pitchEnabled: true,
123
- rotateEnabled: true
124
- };
125
-
126
- var Map = /*#__PURE__*/function (_Camera) {
127
- (0, _inherits2.default)(Map, _Camera);
128
-
129
- var _super = _createSuper(Map);
130
-
131
- function Map(options) {
132
- var _this;
133
-
134
- (0, _classCallCheck2.default)(this, Map);
135
- _this = _super.call(this, (0, _lodash.merge)({}, DefaultOptions, options));
136
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
137
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
138
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
139
- _this.update();
140
- });
141
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowResize", function (event) {
142
- if (_this.trackResize) {
143
- _this.resize({
144
- originalEvent: event
145
- }).update();
146
- }
147
- });
148
-
149
- if (_l7Utils.isMini) {
150
- _this.initMiniContainer();
151
- } else {
152
- _this.initContainer();
153
- }
154
-
155
- _this.resize();
156
-
157
- _this.handlers = new _handler_manager.default((0, _assertThisInitialized2.default)(_this), _this.options);
158
-
159
- if (typeof window !== 'undefined') {
160
- window.addEventListener('online', _this.onWindowOnline, false);
161
- window.addEventListener('resize', _this.onWindowResize, false);
162
- window.addEventListener('orientationchange', _this.onWindowResize, false);
163
- }
164
-
165
- if (!_l7Utils.isMini) {
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
-
174
- if (!_this.hash || !_this.hash.onHashChange()) {
175
- _this.jumpTo({
176
- center: options.center,
177
- zoom: options.zoom,
178
- bearing: options.bearing,
179
- pitch: options.pitch
180
- });
181
-
182
- if (options.bounds) {
183
- _this.resize();
184
-
185
- _this.fitBounds(options.bounds, (0, _lodash.merge)({}, options.fitBoundsOptions, {
186
- duration: 0
187
- }));
188
- }
189
- }
190
-
191
- return _this;
192
- }
193
-
194
- (0, _createClass2.default)(Map, [{
195
- key: "resize",
196
- value: function resize(eventData) {
197
- var _this$containerDimens = this.containerDimensions(),
198
- _this$containerDimens2 = (0, _slicedToArray2.default)(_this$containerDimens, 2),
199
- width = _this$containerDimens2[0],
200
- height = _this$containerDimens2[1];
201
-
202
- this.transform.resize(width, height); // 小程序环境不需要执行后续动作
203
-
204
- if (_l7Utils.isMini) {
205
- return this;
206
- }
207
-
208
- var fireMoving = !this.moving;
209
-
210
- if (fireMoving) {
211
- this.stop();
212
- this.emit('movestart', new _l7Utils.$window.Event('movestart', eventData));
213
- this.emit('move', new _l7Utils.$window.Event('move', eventData));
214
- }
215
-
216
- this.emit('resize', new _l7Utils.$window.Event('resize', eventData));
217
-
218
- if (fireMoving) {
219
- this.emit('moveend', new _l7Utils.$window.Event('moveend', eventData));
220
- }
221
-
222
- return this;
223
- }
224
- }, {
225
- key: "getContainer",
226
- value: function getContainer() {
227
- return this.container;
228
- }
229
- }, {
230
- key: "getCanvas",
231
- value: function getCanvas() {
232
- return this.canvas;
233
- }
234
- }, {
235
- key: "getCanvasContainer",
236
- value: function getCanvasContainer() {
237
- return this.canvasContainer;
238
- }
239
- }, {
240
- key: "project",
241
- value: function project(lngLat) {
242
- return this.transform.locationPoint(_lng_lat.default.convert(lngLat));
243
- }
244
- }, {
245
- key: "unproject",
246
- value: function unproject(point) {
247
- return this.transform.pointLocation(_point.default.convert(point));
248
- }
249
- }, {
250
- key: "getBounds",
251
- value: function getBounds() {
252
- return this.transform.getBounds();
253
- }
254
- }, {
255
- key: "getMaxBounds",
256
- value: function getMaxBounds() {
257
- return this.transform.getMaxBounds();
258
- }
259
- }, {
260
- key: "setMaxBounds",
261
- value: function setMaxBounds(bounds) {
262
- this.transform.setMaxBounds(_lng_lat_bounds.default.convert(bounds));
263
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
264
-
265
- }, {
266
- key: "setStyle",
267
- value: function setStyle(style) {
268
- return;
269
- }
270
- }, {
271
- key: "setMinZoom",
272
- value: function setMinZoom(minZoom) {
273
- minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
274
-
275
- if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
276
- this.transform.minZoom = minZoom;
277
-
278
- if (this.getZoom() < minZoom) {
279
- this.setZoom(minZoom);
280
- }
281
-
282
- return this;
283
- } else {
284
- throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
285
- }
286
- }
287
- }, {
288
- key: "getMinZoom",
289
- value: function getMinZoom() {
290
- return this.transform.minZoom;
291
- }
292
- }, {
293
- key: "setMaxZoom",
294
- value: function setMaxZoom(maxZoom) {
295
- maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
296
-
297
- if (maxZoom >= this.transform.minZoom) {
298
- this.transform.maxZoom = maxZoom;
299
-
300
- if (this.getZoom() > maxZoom) {
301
- this.setZoom(maxZoom);
302
- }
303
-
304
- return this;
305
- } else {
306
- throw new Error('maxZoom must be greater than the current minZoom');
307
- }
308
- }
309
- }, {
310
- key: "getMaxZoom",
311
- value: function getMaxZoom() {
312
- return this.transform.maxZoom;
313
- }
314
- }, {
315
- key: "setMinPitch",
316
- value: function setMinPitch(minPitch) {
317
- minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
318
-
319
- if (minPitch < defaultMinPitch) {
320
- throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
321
- }
322
-
323
- if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
324
- this.transform.minPitch = minPitch;
325
-
326
- if (this.getPitch() < minPitch) {
327
- this.setPitch(minPitch);
328
- }
329
-
330
- return this;
331
- } else {
332
- throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
333
- }
334
- }
335
- }, {
336
- key: "getMinPitch",
337
- value: function getMinPitch() {
338
- return this.transform.minPitch;
339
- }
340
- }, {
341
- key: "setMaxPitch",
342
- value: function setMaxPitch(maxPitch) {
343
- maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
344
-
345
- if (maxPitch > defaultMaxPitch) {
346
- throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
347
- }
348
-
349
- if (maxPitch >= this.transform.minPitch) {
350
- this.transform.maxPitch = maxPitch;
351
-
352
- if (this.getPitch() > maxPitch) {
353
- this.setPitch(maxPitch);
354
- }
355
-
356
- return this;
357
- } else {
358
- throw new Error('maxPitch must be greater than the current minPitch');
359
- }
360
- }
361
- }, {
362
- key: "getMaxPitch",
363
- value: function getMaxPitch() {
364
- return this.transform.maxPitch;
365
- }
366
- }, {
367
- key: "getRenderWorldCopies",
368
- value: function getRenderWorldCopies() {
369
- return this.transform.renderWorldCopies;
370
- }
371
- }, {
372
- key: "setRenderWorldCopies",
373
- value: function setRenderWorldCopies(renderWorldCopies) {
374
- this.transform.renderWorldCopies = !!renderWorldCopies;
375
- }
376
- }, {
377
- key: "remove",
378
- value: function remove() {
379
- this.container.removeChild(this.canvasContainer); // @ts-ignore
380
-
381
- this.canvasContainer = null;
382
-
383
- if (this.frame) {
384
- this.frame.cancel();
385
- this.frame = null;
386
- }
387
-
388
- this.renderTaskQueue.clear();
389
- }
390
- }, {
391
- key: "requestRenderFrame",
392
- value: function requestRenderFrame(cb) {
393
- this.update();
394
- return this.renderTaskQueue.add(cb);
395
- }
396
- }, {
397
- key: "cancelRenderFrame",
398
- value: function cancelRenderFrame(id) {
399
- return this.renderTaskQueue.remove(id);
400
- }
401
- }, {
402
- key: "triggerRepaint",
403
- value: function triggerRepaint() {
404
- var _this2 = this;
405
-
406
- if (!this.frame) {
407
- this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
408
- _performance.PerformanceUtils.frame(paintStartTimeStamp);
409
-
410
- _this2.frame = null;
411
-
412
- _this2.update(paintStartTimeStamp);
413
- });
414
- }
415
- }
416
- }, {
417
- key: "update",
418
- value: function update(time) {
419
- var _this3 = this;
420
-
421
- if (!this.frame) {
422
- this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
423
- _performance.PerformanceUtils.frame(paintStartTimeStamp);
424
-
425
- _this3.frame = null;
426
-
427
- _this3.renderTaskQueue.run(time);
428
- });
429
- }
430
- }
431
- }, {
432
- key: "initContainer",
433
- value: function initContainer() {
434
- if (typeof this.options.container === 'string') {
435
- this.container = window.document.getElementById(this.options.container);
436
-
437
- if (!this.container) {
438
- throw new Error("Container '".concat(this.options.container, "' not found."));
439
- }
440
- } else if (this.options.container instanceof HTMLElement) {
441
- this.container = this.options.container;
442
- } else {
443
- throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
444
- }
445
-
446
- var container = this.container;
447
- container.classList.add('l7-map');
448
-
449
- var canvasContainer = this.canvasContainer = _l7Utils.DOM.create('div', 'l7-canvas-container', container);
450
-
451
- if (this.options.interactive) {
452
- canvasContainer.classList.add('l7-interactive');
453
- }
454
- }
455
- /**
456
- * 小程序环境构建容器
457
- */
458
-
459
- }, {
460
- key: "initMiniContainer",
461
- value: function initMiniContainer() {
462
- this.container = this.options.canvas;
463
- this.canvasContainer = this.container;
464
- }
465
- }, {
466
- key: "containerDimensions",
467
- value: function containerDimensions() {
468
- var width = 0;
469
- var height = 0;
470
-
471
- if (this.container) {
472
- if (_l7Utils.isMini) {
473
- width = this.container.width / _l7Utils.$window.devicePixelRatio;
474
- height = this.container.height / _l7Utils.$window.devicePixelRatio;
475
- } else {
476
- width = this.container.clientWidth;
477
- height = this.container.clientHeight;
478
- width = width === 0 ? 400 : width;
479
- height = height === 0 ? 300 : height;
480
- }
481
- }
482
-
483
- return [width, height];
484
- }
485
- }]);
486
- return Map;
487
- }(_camera.default);
488
-
489
- exports.Map = Map;