@antv/l7-map 2.9.32-alpha.2 → 2.9.33

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/es/camera.d.ts +84 -0
  2. package/es/camera.js +765 -0
  3. package/es/css/l7.css +98 -0
  4. package/es/earthmap.d.ts +66 -0
  5. package/es/earthmap.js +421 -0
  6. package/es/geo/edge_insets.d.ts +54 -0
  7. package/es/geo/edge_insets.js +118 -0
  8. package/es/geo/lng_lat.d.ts +18 -0
  9. package/es/geo/lng_lat.js +81 -0
  10. package/es/geo/lng_lat_bounds.d.ts +24 -0
  11. package/es/geo/lng_lat_bounds.js +167 -0
  12. package/es/geo/mercator.d.ts +28 -0
  13. package/es/geo/mercator.js +91 -0
  14. package/es/geo/point.d.ts +40 -0
  15. package/es/geo/point.js +231 -0
  16. package/es/geo/simple.d.ts +28 -0
  17. package/es/geo/simple.js +90 -0
  18. package/es/geo/transform.d.ts +198 -0
  19. package/es/geo/transform.js +971 -0
  20. package/es/handler/IHandler.d.ts +34 -0
  21. package/es/handler/IHandler.js +1 -0
  22. package/es/handler/blockable_map_event.d.ts +17 -0
  23. package/es/handler/blockable_map_event.js +83 -0
  24. package/es/handler/box_zoom.d.ts +59 -0
  25. package/es/handler/box_zoom.js +200 -0
  26. package/es/handler/click_zoom.d.ts +16 -0
  27. package/es/handler/click_zoom.js +59 -0
  28. package/es/handler/events/event.d.ts +4 -0
  29. package/es/handler/events/event.js +12 -0
  30. package/es/handler/events/index.d.ts +4 -0
  31. package/es/handler/events/index.js +4 -0
  32. package/es/handler/events/map_mouse_event.d.ts +34 -0
  33. package/es/handler/events/map_mouse_event.js +75 -0
  34. package/es/handler/events/map_touch_event.d.ts +57 -0
  35. package/es/handler/events/map_touch_event.js +105 -0
  36. package/es/handler/events/map_wheel_event.d.ts +33 -0
  37. package/es/handler/events/map_wheel_event.js +61 -0
  38. package/es/handler/events/render_event.d.ts +5 -0
  39. package/es/handler/events/render_event.js +39 -0
  40. package/es/handler/handler_inertia.d.ts +23 -0
  41. package/es/handler/handler_inertia.js +184 -0
  42. package/es/handler/handler_manager.d.ts +61 -0
  43. package/es/handler/handler_manager.js +684 -0
  44. package/es/handler/handler_util.d.ts +4 -0
  45. package/es/handler/handler_util.js +10 -0
  46. package/es/handler/keyboard.d.ts +36 -0
  47. package/es/handler/keyboard.js +162 -0
  48. package/es/handler/map_event.d.ts +29 -0
  49. package/es/handler/map_event.js +131 -0
  50. package/es/handler/mouse/index.d.ts +4 -0
  51. package/es/handler/mouse/index.js +4 -0
  52. package/es/handler/mouse/mouse_handler.d.ts +22 -0
  53. package/es/handler/mouse/mouse_handler.js +129 -0
  54. package/es/handler/mouse/mousepan_handler.d.ts +10 -0
  55. package/es/handler/mouse/mousepan_handler.js +54 -0
  56. package/es/handler/mouse/mousepitch_hander.d.ts +9 -0
  57. package/es/handler/mouse/mousepitch_hander.js +56 -0
  58. package/es/handler/mouse/mouserotate_hander.d.ts +9 -0
  59. package/es/handler/mouse/mouserotate_hander.js +56 -0
  60. package/es/handler/mouse/util.d.ts +6 -0
  61. package/es/handler/mouse/util.js +12 -0
  62. package/es/handler/scroll_zoom.d.ts +93 -0
  63. package/es/handler/scroll_zoom.js +353 -0
  64. package/es/handler/shim/dblclick_zoom.d.ts +40 -0
  65. package/es/handler/shim/dblclick_zoom.js +72 -0
  66. package/es/handler/shim/drag_pan.d.ts +61 -0
  67. package/es/handler/shim/drag_pan.js +96 -0
  68. package/es/handler/shim/drag_rotate.d.ts +46 -0
  69. package/es/handler/shim/drag_rotate.js +80 -0
  70. package/es/handler/shim/touch_zoom_rotate.d.ts +70 -0
  71. package/es/handler/shim/touch_zoom_rotate.js +130 -0
  72. package/es/handler/tap/single_tap_recognizer.d.ts +20 -0
  73. package/es/handler/tap/single_tap_recognizer.js +120 -0
  74. package/es/handler/tap/tap_drag_zoom.d.ts +22 -0
  75. package/es/handler/tap/tap_drag_zoom.js +114 -0
  76. package/es/handler/tap/tap_recognizer.d.ts +17 -0
  77. package/es/handler/tap/tap_recognizer.js +62 -0
  78. package/es/handler/tap/tap_zoom.d.ts +22 -0
  79. package/es/handler/tap/tap_zoom.js +115 -0
  80. package/es/handler/touch/index.d.ts +5 -0
  81. package/es/handler/touch/index.js +5 -0
  82. package/es/handler/touch/touch_pan.d.ts +30 -0
  83. package/es/handler/touch/touch_pan.js +128 -0
  84. package/es/handler/touch/touch_pitch.d.ts +13 -0
  85. package/es/handler/touch/touch_pitch.js +110 -0
  86. package/es/handler/touch/touch_rotate.d.ts +12 -0
  87. package/es/handler/touch/touch_rotate.js +88 -0
  88. package/es/handler/touch/touch_zoom.d.ts +12 -0
  89. package/es/handler/touch/touch_zoom.js +67 -0
  90. package/es/handler/touch/two_touch.d.ts +23 -0
  91. package/es/handler/touch/two_touch.js +134 -0
  92. package/es/hash.d.ts +14 -0
  93. package/es/hash.js +156 -0
  94. package/es/index.d.ts +3 -0
  95. package/es/index.js +3 -0
  96. package/es/interface.d.ts +34 -0
  97. package/es/interface.js +1 -0
  98. package/es/map.d.ts +70 -0
  99. package/es/map.js +463 -0
  100. package/es/util.d.ts +18 -0
  101. package/es/util.js +84 -0
  102. package/es/utils/Aabb.d.ts +12 -0
  103. package/es/utils/Aabb.js +133 -0
  104. package/es/utils/dom.d.ts +4 -0
  105. package/es/utils/dom.js +218 -0
  106. package/es/utils/performance.d.ts +17 -0
  107. package/es/utils/performance.js +62 -0
  108. package/es/utils/primitives.d.ts +6 -0
  109. package/es/utils/primitives.js +45 -0
  110. package/es/utils/task_queue.d.ts +13 -0
  111. package/es/utils/task_queue.js +106 -0
  112. package/lib/camera.js +533 -0
  113. package/lib/css/l7.css +98 -0
  114. package/lib/earthmap.js +278 -0
  115. package/lib/geo/edge_insets.js +76 -0
  116. package/lib/geo/lng_lat.js +73 -0
  117. package/lib/geo/lng_lat_bounds.js +138 -0
  118. package/lib/geo/mercator.js +91 -0
  119. package/lib/geo/point.js +176 -0
  120. package/lib/geo/simple.js +87 -0
  121. package/lib/geo/transform.js +503 -0
  122. package/lib/handler/IHandler.js +17 -0
  123. package/lib/handler/blockable_map_event.js +71 -0
  124. package/lib/handler/box_zoom.js +139 -0
  125. package/lib/handler/click_zoom.js +59 -0
  126. package/lib/handler/events/event.js +38 -0
  127. package/lib/handler/events/index.js +38 -0
  128. package/lib/handler/events/map_mouse_event.js +44 -0
  129. package/lib/handler/events/map_touch_event.js +48 -0
  130. package/lib/handler/events/map_wheel_event.js +36 -0
  131. package/lib/handler/events/render_event.js +33 -0
  132. package/lib/handler/handler_inertia.js +149 -0
  133. package/lib/handler/handler_manager.js +455 -0
  134. package/lib/handler/handler_util.js +35 -0
  135. package/lib/handler/keyboard.js +131 -0
  136. package/lib/handler/map_event.js +91 -0
  137. package/lib/handler/mouse/index.js +38 -0
  138. package/lib/handler/mouse/mouse_handler.js +103 -0
  139. package/lib/handler/mouse/mousepan_handler.js +48 -0
  140. package/lib/handler/mouse/mousepitch_hander.js +47 -0
  141. package/lib/handler/mouse/mouserotate_hander.js +47 -0
  142. package/lib/handler/mouse/util.js +44 -0
  143. package/lib/handler/scroll_zoom.js +225 -0
  144. package/lib/handler/shim/dblclick_zoom.js +46 -0
  145. package/lib/handler/shim/drag_pan.js +55 -0
  146. package/lib/handler/shim/drag_rotate.js +49 -0
  147. package/lib/handler/shim/touch_zoom_rotate.js +71 -0
  148. package/lib/handler/tap/single_tap_recognizer.js +102 -0
  149. package/lib/handler/tap/tap_drag_zoom.js +106 -0
  150. package/lib/handler/tap/tap_recognizer.js +66 -0
  151. package/lib/handler/tap/tap_zoom.js +99 -0
  152. package/lib/handler/touch/index.js +41 -0
  153. package/lib/handler/touch/touch_pan.js +110 -0
  154. package/lib/handler/touch/touch_pitch.js +86 -0
  155. package/lib/handler/touch/touch_rotate.js +65 -0
  156. package/lib/handler/touch/touch_zoom.js +56 -0
  157. package/lib/handler/touch/two_touch.js +105 -0
  158. package/lib/hash.js +120 -0
  159. package/lib/index.js +21 -0
  160. package/lib/interface.js +17 -0
  161. package/lib/map.js +308 -0
  162. package/lib/util.js +97 -0
  163. package/lib/utils/Aabb.js +90 -0
  164. package/lib/utils/dom.js +159 -0
  165. package/lib/utils/performance.js +80 -0
  166. package/lib/utils/primitives.js +63 -0
  167. package/lib/utils/task_queue.js +72 -0
  168. package/package.json +3 -3
@@ -0,0 +1,67 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _get from "@babel/runtime/helpers/get";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+
8
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
+
10
+ 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; } }
11
+
12
+ // @ts-ignore
13
+ import TwoTouchHandler from "./two_touch";
14
+ var ZOOM_THRESHOLD = 0.1;
15
+
16
+ function getZoomDelta(distance, lastDistance) {
17
+ return Math.log(distance / lastDistance) / Math.LN2;
18
+ }
19
+
20
+ var TouchZoomHandler = /*#__PURE__*/function (_TwoTouchHandler) {
21
+ _inherits(TouchZoomHandler, _TwoTouchHandler);
22
+
23
+ var _super = _createSuper(TouchZoomHandler);
24
+
25
+ function TouchZoomHandler() {
26
+ _classCallCheck(this, TouchZoomHandler);
27
+
28
+ return _super.apply(this, arguments);
29
+ }
30
+
31
+ _createClass(TouchZoomHandler, [{
32
+ key: "reset",
33
+ value: function reset() {
34
+ _get(_getPrototypeOf(TouchZoomHandler.prototype), "reset", this).call(this); //@ts-ignore
35
+
36
+
37
+ delete this.distance; //@ts-ignore
38
+
39
+ delete this.startDistance;
40
+ }
41
+ }, {
42
+ key: "start",
43
+ value: function start(points) {
44
+ this.startDistance = this.distance = points[0].dist(points[1]);
45
+ }
46
+ }, {
47
+ key: "move",
48
+ value: function move(points, pinchAround) {
49
+ var lastDistance = this.distance;
50
+ this.distance = points[0].dist(points[1]);
51
+
52
+ if (!this.active && Math.abs(getZoomDelta(this.distance, this.startDistance)) < ZOOM_THRESHOLD) {
53
+ return;
54
+ }
55
+
56
+ this.active = true;
57
+ return {
58
+ zoomDelta: getZoomDelta(this.distance, lastDistance),
59
+ pinchAround: pinchAround
60
+ };
61
+ }
62
+ }]);
63
+
64
+ return TouchZoomHandler;
65
+ }(TwoTouchHandler);
66
+
67
+ export { TouchZoomHandler as default };
@@ -0,0 +1,23 @@
1
+ import Point from '../../geo/point';
2
+ export default class TwoTouchHandler {
3
+ protected enabled: boolean;
4
+ protected active: boolean;
5
+ protected firstTwoTouches: [number, number];
6
+ protected vector: Point;
7
+ protected startVector: Point;
8
+ protected aroundCenter: boolean;
9
+ constructor();
10
+ reset(): void;
11
+ start(points: [Point, Point]): void;
12
+ move(points: [Point, Point], pinchAround: Point | null, e: TouchEvent): void;
13
+ touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
14
+ touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
15
+ touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
16
+ touchcancel(): void;
17
+ enable(options?: {
18
+ around?: 'center';
19
+ }): void;
20
+ disable(): void;
21
+ isEnabled(): boolean;
22
+ isActive(): boolean;
23
+ }
@@ -0,0 +1,134 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ // @ts-ignore
5
+ import DOM from "../../utils/dom";
6
+
7
+ var TwoTouchHandler = /*#__PURE__*/function () {
8
+ function TwoTouchHandler() {
9
+ _classCallCheck(this, TwoTouchHandler);
10
+
11
+ this.reset();
12
+ }
13
+
14
+ _createClass(TwoTouchHandler, [{
15
+ key: "reset",
16
+ value: function reset() {
17
+ this.active = false; //@ts-ignore
18
+
19
+ delete this.firstTwoTouches;
20
+ }
21
+ }, {
22
+ key: "start",
23
+ value: function start(points) {
24
+ return;
25
+ } // eslint-disable-line
26
+
27
+ }, {
28
+ key: "move",
29
+ value: function move(points, pinchAround, e) {
30
+ return;
31
+ } // eslint-disable-line
32
+
33
+ }, {
34
+ key: "touchstart",
35
+ value: function touchstart(e, points, mapTouches) {
36
+ // console.log(e.target, e.targetTouches.length ? e.targetTouches[0].target : null);
37
+ // log('touchstart', points, e.target.innerHTML, e.targetTouches.length ? e.targetTouches[0].target.innerHTML: undefined);
38
+ if (this.firstTwoTouches || mapTouches.length < 2) {
39
+ return;
40
+ }
41
+
42
+ this.firstTwoTouches = [mapTouches[0].identifier, mapTouches[1].identifier]; // implemented by child classes
43
+
44
+ this.start([points[0], points[1]]);
45
+ }
46
+ }, {
47
+ key: "touchmove",
48
+ value: function touchmove(e, points, mapTouches) {
49
+ if (!this.firstTwoTouches) {
50
+ return;
51
+ }
52
+
53
+ e.preventDefault();
54
+
55
+ var _this$firstTwoTouches = _slicedToArray(this.firstTwoTouches, 2),
56
+ idA = _this$firstTwoTouches[0],
57
+ idB = _this$firstTwoTouches[1];
58
+
59
+ var a = getTouchById(mapTouches, points, idA);
60
+ var b = getTouchById(mapTouches, points, idB);
61
+
62
+ if (!a || !b) {
63
+ return;
64
+ }
65
+
66
+ var pinchAround = this.aroundCenter ? null : a.add(b).div(2); // implemented by child classes
67
+
68
+ return this.move([a, b], pinchAround, e);
69
+ }
70
+ }, {
71
+ key: "touchend",
72
+ value: function touchend(e, points, mapTouches) {
73
+ if (!this.firstTwoTouches) {
74
+ return;
75
+ }
76
+
77
+ var _this$firstTwoTouches2 = _slicedToArray(this.firstTwoTouches, 2),
78
+ idA = _this$firstTwoTouches2[0],
79
+ idB = _this$firstTwoTouches2[1];
80
+
81
+ var a = getTouchById(mapTouches, points, idA);
82
+ var b = getTouchById(mapTouches, points, idB);
83
+
84
+ if (a && b) {
85
+ return;
86
+ }
87
+
88
+ if (this.active) {
89
+ DOM.suppressClick();
90
+ }
91
+
92
+ this.reset();
93
+ }
94
+ }, {
95
+ key: "touchcancel",
96
+ value: function touchcancel() {
97
+ this.reset();
98
+ }
99
+ }, {
100
+ key: "enable",
101
+ value: function enable(options) {
102
+ this.enabled = true;
103
+ this.aroundCenter = !!options && options.around === 'center';
104
+ }
105
+ }, {
106
+ key: "disable",
107
+ value: function disable() {
108
+ this.enabled = false;
109
+ this.reset();
110
+ }
111
+ }, {
112
+ key: "isEnabled",
113
+ value: function isEnabled() {
114
+ return this.enabled;
115
+ }
116
+ }, {
117
+ key: "isActive",
118
+ value: function isActive() {
119
+ return this.active;
120
+ }
121
+ }]);
122
+
123
+ return TwoTouchHandler;
124
+ }();
125
+
126
+ export { TwoTouchHandler as default };
127
+
128
+ function getTouchById(mapTouches, points, identifier) {
129
+ for (var i = 0; i < mapTouches.length; i++) {
130
+ if (mapTouches[i].identifier === identifier) {
131
+ return points[i];
132
+ }
133
+ }
134
+ }
package/es/hash.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { Map } from './map';
2
+ declare class Hash {
3
+ private map;
4
+ private updateHash;
5
+ private hashName?;
6
+ constructor(hashName?: string);
7
+ addTo(map: Map): this;
8
+ remove(): this;
9
+ onHashChange: () => boolean;
10
+ private getCurrentHash;
11
+ private getHashString;
12
+ private updateHashUnthrottled;
13
+ }
14
+ export default Hash;
package/es/hash.js ADDED
@@ -0,0 +1,156 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ // @ts-ignore
5
+ // tslint:disable-next-line:no-submodule-imports
6
+ import { $window } from '@antv/l7-utils';
7
+ import { throttle } from 'lodash';
8
+
9
+ /*
10
+ * Adds the map's position to its page's location hash.
11
+ * Passed as an option to the map object.
12
+ *
13
+ * @returns {Hash} `this`
14
+ */
15
+ var Hash = /*#__PURE__*/function () {
16
+ function Hash(hashName) {
17
+ var _this = this;
18
+
19
+ _classCallCheck(this, Hash);
20
+
21
+ _defineProperty(this, "onHashChange", function () {
22
+ var loc = _this.getCurrentHash();
23
+
24
+ if (loc.length >= 3 && !loc.some(function (v) {
25
+ return isNaN(+v);
26
+ })) {
27
+ var bearing = _this.map.dragRotate.isEnabled() && _this.map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : _this.map.getBearing();
28
+
29
+ _this.map.jumpTo({
30
+ center: [+loc[2], +loc[1]],
31
+ zoom: +loc[0],
32
+ bearing: bearing,
33
+ pitch: +(loc[4] || 0)
34
+ });
35
+
36
+ return true;
37
+ }
38
+
39
+ return false;
40
+ });
41
+
42
+ _defineProperty(this, "getCurrentHash", function () {
43
+ // Get the current hash from location, stripped from its number sign
44
+ var hash = window.location.hash.replace('#', '');
45
+
46
+ if (_this.hashName) {
47
+ // Split the parameter-styled hash into parts and find the value we need
48
+ var keyval;
49
+ hash.split('&').map(function (part) {
50
+ return part.split('=');
51
+ }).forEach(function (part) {
52
+ if (part[0] === _this.hashName) {
53
+ keyval = part;
54
+ }
55
+ });
56
+ return (keyval ? keyval[1] || '' : '').split('/');
57
+ }
58
+
59
+ return hash.split('/');
60
+ });
61
+
62
+ _defineProperty(this, "updateHashUnthrottled", function () {
63
+ var hash = _this.getHashString();
64
+
65
+ try {
66
+ window.history.replaceState(window.history.state, '', hash);
67
+ } catch (SecurityError) {// IE11 does not allow this if the page is within an iframe created
68
+ // with iframe.contentWindow.document.write(...).
69
+ // https://github.com/mapbox/mapbox-gl-js/issues/7410
70
+ }
71
+ });
72
+
73
+ this.hashName = hashName && encodeURIComponent(hashName); // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
74
+
75
+ this.updateHash = throttle(this.updateHashUnthrottled, 30 * 1000 / 100);
76
+ }
77
+
78
+ _createClass(Hash, [{
79
+ key: "addTo",
80
+ value: function addTo(map) {
81
+ this.map = map;
82
+ $window.addEventListener('hashchange', this.onHashChange, false);
83
+ this.map.on('moveend', this.updateHash);
84
+ return this;
85
+ }
86
+ }, {
87
+ key: "remove",
88
+ value: function remove() {
89
+ $window.removeEventListener('hashchange', this.onHashChange, false);
90
+ this.map.off('moveend', this.updateHash); // clearTimeout(this.updateHash());
91
+ // @ts-ignore
92
+
93
+ delete this.map;
94
+ return this;
95
+ }
96
+ }, {
97
+ key: "getHashString",
98
+ value: function getHashString(mapFeedback) {
99
+ var center = this.map.getCenter();
100
+ var zoom = Math.round(this.map.getZoom() * 100) / 100; // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px
101
+
102
+ var precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10);
103
+ var m = Math.pow(10, precision);
104
+ var lng = Math.round(center.lng * m) / m;
105
+ var lat = Math.round(center.lat * m) / m;
106
+ var bearing = this.map.getBearing();
107
+ var pitch = this.map.getPitch();
108
+ var hash = '';
109
+
110
+ if (mapFeedback) {
111
+ // new map feedback site has some constraints that don't allow
112
+ // us to use the same hash format as we do for the Map hash option.
113
+ hash += "/".concat(lng, "/").concat(lat, "/").concat(zoom);
114
+ } else {
115
+ hash += "".concat(zoom, "/").concat(lat, "/").concat(lng);
116
+ }
117
+
118
+ if (bearing || pitch) {
119
+ hash += "/".concat(Math.round(bearing * 10) / 10);
120
+ }
121
+
122
+ if (pitch) {
123
+ hash += "/".concat(Math.round(pitch));
124
+ }
125
+
126
+ if (this.hashName) {
127
+ var hashName = this.hashName;
128
+ var found = false;
129
+ var parts = window.location.hash.slice(1).split('&').map(function (part) {
130
+ var key = part.split('=')[0];
131
+
132
+ if (key === hashName) {
133
+ found = true;
134
+ return "".concat(key, "=").concat(hash);
135
+ }
136
+
137
+ return part;
138
+ }).filter(function (a) {
139
+ return a;
140
+ });
141
+
142
+ if (!found) {
143
+ parts.push("".concat(hashName, "=").concat(hash));
144
+ }
145
+
146
+ return "#".concat(parts.join('&'));
147
+ }
148
+
149
+ return "#".concat(hash);
150
+ }
151
+ }]);
152
+
153
+ return Hash;
154
+ }();
155
+
156
+ export default Hash;
package/es/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './map';
2
+ export * from './earthmap';
3
+ export * from './interface';
package/es/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./map";
2
+ export * from "./earthmap";
3
+ export * from "./interface";
@@ -0,0 +1,34 @@
1
+ import { LngLatBoundsLike } from './geo/lng_lat_bounds';
2
+ export interface IMapOptions {
3
+ hash: boolean;
4
+ style?: any;
5
+ container?: HTMLElement | string;
6
+ canvas?: HTMLCanvasElement;
7
+ center: [number, number];
8
+ zoom: number;
9
+ bearing: number;
10
+ pitch: number;
11
+ interactive: boolean;
12
+ scrollZoom: boolean;
13
+ bounds?: LngLatBoundsLike;
14
+ maxBounds?: LngLatBoundsLike;
15
+ fitBoundsOptions?: any;
16
+ minZoom: number;
17
+ maxZoom: number;
18
+ minPitch: number;
19
+ maxPitch: number;
20
+ boxZoom: boolean;
21
+ dragRotate: boolean;
22
+ dragPan: boolean;
23
+ keyboard: boolean;
24
+ doubleClickZoom: boolean;
25
+ touchZoomRotate: boolean;
26
+ touchPitch: boolean;
27
+ trackResize: boolean;
28
+ renderWorldCopies: boolean;
29
+ bearingSnap: number;
30
+ clickTolerance: number;
31
+ pitchWithRotate: boolean;
32
+ pitchEnabled: boolean;
33
+ rotateEnabled: boolean;
34
+ }
@@ -0,0 +1 @@
1
+ export {};
package/es/map.d.ts ADDED
@@ -0,0 +1,70 @@
1
+ import Camera from './camera';
2
+ import './css/l7.css';
3
+ import LngLat, { LngLatLike } from './geo/lng_lat';
4
+ import LngLatBounds, { LngLatBoundsLike } from './geo/lng_lat_bounds';
5
+ import Point, { PointLike } from './geo/point';
6
+ import BoxZoomHandler from './handler/box_zoom';
7
+ import HandlerManager from './handler/handler_manager';
8
+ import KeyboardHandler from './handler/keyboard';
9
+ import ScrollZoomHandler from './handler/scroll_zoom';
10
+ import DoubleClickZoomHandler from './handler/shim/dblclick_zoom';
11
+ import DragPanHandler from './handler/shim/drag_pan';
12
+ import DragRotateHandler from './handler/shim/drag_rotate';
13
+ import TouchZoomRotateHandler from './handler/shim/touch_zoom_rotate';
14
+ import { TouchPitchHandler } from './handler/touch';
15
+ import { IMapOptions } from './interface';
16
+ import { TaskID } from './utils/task_queue';
17
+ declare type CallBack = (_: number) => void;
18
+ export declare class Map extends Camera {
19
+ doubleClickZoom: DoubleClickZoomHandler;
20
+ dragRotate: DragRotateHandler;
21
+ dragPan: DragPanHandler;
22
+ touchZoomRotate: TouchZoomRotateHandler;
23
+ scrollZoom: ScrollZoomHandler;
24
+ keyboard: KeyboardHandler;
25
+ touchPitch: TouchPitchHandler;
26
+ boxZoom: BoxZoomHandler;
27
+ handlers: HandlerManager;
28
+ private container;
29
+ private canvas;
30
+ private canvasContainer;
31
+ private renderTaskQueue;
32
+ private frame;
33
+ private trackResize;
34
+ private hash;
35
+ constructor(options: Partial<IMapOptions>);
36
+ resize(eventData?: any): this;
37
+ getContainer(): HTMLElement;
38
+ getCanvas(): HTMLCanvasElement;
39
+ getCanvasContainer(): HTMLElement;
40
+ project(lngLat: LngLatLike): Point;
41
+ unproject(point: PointLike): LngLat;
42
+ getBounds(): LngLatBounds;
43
+ getMaxBounds(): LngLatBounds | null;
44
+ setMaxBounds(bounds: LngLatBoundsLike): void;
45
+ setStyle(style: any): void;
46
+ setMinZoom(minZoom?: number): this;
47
+ getMinZoom(): number;
48
+ setMaxZoom(maxZoom?: number): this;
49
+ getMaxZoom(): number;
50
+ setMinPitch(minPitch?: number): this;
51
+ getMinPitch(): number;
52
+ setMaxPitch(maxPitch?: number): this;
53
+ getMaxPitch(): number;
54
+ getRenderWorldCopies(): boolean;
55
+ setRenderWorldCopies(renderWorldCopies?: boolean): void;
56
+ remove(): void;
57
+ requestRenderFrame(cb: CallBack): TaskID;
58
+ cancelRenderFrame(id: TaskID): void;
59
+ triggerRepaint(): void;
60
+ update(time?: number): void;
61
+ private initContainer;
62
+ /**
63
+ * 小程序环境构建容器
64
+ */
65
+ private initMiniContainer;
66
+ private containerDimensions;
67
+ private onWindowOnline;
68
+ private onWindowResize;
69
+ }
70
+ export {};