@antv/l7-map 2.5.36 → 2.5.37-mini

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 (186) hide show
  1. package/lib/camera.js.map +1 -1
  2. package/lib/earthmap.js +7 -26
  3. package/lib/earthmap.js.map +1 -1
  4. package/lib/handler/handler_manager.js +55 -33
  5. package/lib/handler/handler_manager.js.map +1 -1
  6. package/lib/handler/shim/drag_pan.js +10 -2
  7. package/lib/handler/shim/drag_pan.js.map +1 -1
  8. package/lib/handler/shim/touch_zoom_rotate.js +10 -2
  9. package/lib/handler/shim/touch_zoom_rotate.js.map +1 -1
  10. package/lib/hash.js +9 -4
  11. package/lib/hash.js.map +1 -1
  12. package/lib/map.js +39 -19
  13. package/lib/map.js.map +1 -1
  14. package/lib/util.js +7 -5
  15. package/lib/util.js.map +1 -1
  16. package/lib/utils/dom.js +66 -26
  17. package/lib/utils/dom.js.map +1 -1
  18. package/lib/utils/performance.js +4 -1
  19. package/lib/utils/performance.js.map +1 -1
  20. package/package.json +3 -3
  21. package/LICENSE.md +0 -21
  22. package/es/camera.d.ts +0 -82
  23. package/es/camera.js +0 -729
  24. package/es/camera.js.map +0 -1
  25. package/es/earthmap.d.ts +0 -67
  26. package/es/earthmap.js +0 -454
  27. package/es/earthmap.js.map +0 -1
  28. package/es/geo/edge_insets.d.ts +0 -54
  29. package/es/geo/edge_insets.js +0 -88
  30. package/es/geo/edge_insets.js.map +0 -1
  31. package/es/geo/lng_lat.d.ts +0 -18
  32. package/es/geo/lng_lat.js +0 -77
  33. package/es/geo/lng_lat.js.map +0 -1
  34. package/es/geo/lng_lat_bounds.d.ts +0 -24
  35. package/es/geo/lng_lat_bounds.js +0 -170
  36. package/es/geo/lng_lat_bounds.js.map +0 -1
  37. package/es/geo/mercator.d.ts +0 -28
  38. package/es/geo/mercator.js +0 -79
  39. package/es/geo/mercator.js.map +0 -1
  40. package/es/geo/point.d.ts +0 -40
  41. package/es/geo/point.js +0 -237
  42. package/es/geo/point.js.map +0 -1
  43. package/es/geo/simple.d.ts +0 -28
  44. package/es/geo/simple.js +0 -78
  45. package/es/geo/simple.js.map +0 -1
  46. package/es/geo/transform.d.ts +0 -198
  47. package/es/geo/transform.js +0 -663
  48. package/es/geo/transform.js.map +0 -1
  49. package/es/handler/IHandler.d.ts +0 -34
  50. package/es/handler/IHandler.js +0 -2
  51. package/es/handler/IHandler.js.map +0 -1
  52. package/es/handler/blockable_map_event.d.ts +0 -17
  53. package/es/handler/blockable_map_event.js +0 -84
  54. package/es/handler/blockable_map_event.js.map +0 -1
  55. package/es/handler/box_zoom.d.ts +0 -59
  56. package/es/handler/box_zoom.js +0 -184
  57. package/es/handler/box_zoom.js.map +0 -1
  58. package/es/handler/click_zoom.d.ts +0 -16
  59. package/es/handler/click_zoom.js +0 -64
  60. package/es/handler/click_zoom.js.map +0 -1
  61. package/es/handler/events/event.d.ts +0 -4
  62. package/es/handler/events/event.js +0 -14
  63. package/es/handler/events/event.js.map +0 -1
  64. package/es/handler/events/index.d.ts +0 -4
  65. package/es/handler/events/index.js +0 -5
  66. package/es/handler/events/index.js.map +0 -1
  67. package/es/handler/events/map_mouse_event.d.ts +0 -34
  68. package/es/handler/events/map_mouse_event.js +0 -65
  69. package/es/handler/events/map_mouse_event.js.map +0 -1
  70. package/es/handler/events/map_touch_event.d.ts +0 -57
  71. package/es/handler/events/map_touch_event.js +0 -75
  72. package/es/handler/events/map_touch_event.js.map +0 -1
  73. package/es/handler/events/map_wheel_event.d.ts +0 -33
  74. package/es/handler/events/map_wheel_event.js +0 -52
  75. package/es/handler/events/map_wheel_event.js.map +0 -1
  76. package/es/handler/events/render_event.d.ts +0 -5
  77. package/es/handler/events/render_event.js +0 -41
  78. package/es/handler/events/render_event.js.map +0 -1
  79. package/es/handler/handler_inertia.d.ts +0 -23
  80. package/es/handler/handler_inertia.js +0 -186
  81. package/es/handler/handler_inertia.js.map +0 -1
  82. package/es/handler/handler_manager.d.ts +0 -57
  83. package/es/handler/handler_manager.js +0 -655
  84. package/es/handler/handler_manager.js.map +0 -1
  85. package/es/handler/handler_util.d.ts +0 -4
  86. package/es/handler/handler_util.js +0 -10
  87. package/es/handler/handler_util.js.map +0 -1
  88. package/es/handler/keyboard.d.ts +0 -36
  89. package/es/handler/keyboard.js +0 -157
  90. package/es/handler/keyboard.js.map +0 -1
  91. package/es/handler/map_event.d.ts +0 -29
  92. package/es/handler/map_event.js +0 -120
  93. package/es/handler/map_event.js.map +0 -1
  94. package/es/handler/mouse/index.d.ts +0 -4
  95. package/es/handler/mouse/index.js +0 -5
  96. package/es/handler/mouse/index.js.map +0 -1
  97. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  98. package/es/handler/mouse/mouse_handler.js +0 -131
  99. package/es/handler/mouse/mouse_handler.js.map +0 -1
  100. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  101. package/es/handler/mouse/mousepan_handler.js +0 -54
  102. package/es/handler/mouse/mousepan_handler.js.map +0 -1
  103. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  104. package/es/handler/mouse/mousepitch_hander.js +0 -54
  105. package/es/handler/mouse/mousepitch_hander.js.map +0 -1
  106. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  107. package/es/handler/mouse/mouserotate_hander.js +0 -54
  108. package/es/handler/mouse/mouserotate_hander.js.map +0 -1
  109. package/es/handler/mouse/util.d.ts +0 -6
  110. package/es/handler/mouse/util.js +0 -12
  111. package/es/handler/mouse/util.js.map +0 -1
  112. package/es/handler/scroll_zoom.d.ts +0 -93
  113. package/es/handler/scroll_zoom.js +0 -317
  114. package/es/handler/scroll_zoom.js.map +0 -1
  115. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  116. package/es/handler/shim/dblclick_zoom.js +0 -45
  117. package/es/handler/shim/dblclick_zoom.js.map +0 -1
  118. package/es/handler/shim/drag_pan.d.ts +0 -61
  119. package/es/handler/shim/drag_pan.js +0 -53
  120. package/es/handler/shim/drag_pan.js.map +0 -1
  121. package/es/handler/shim/drag_rotate.d.ts +0 -46
  122. package/es/handler/shim/drag_rotate.js +0 -51
  123. package/es/handler/shim/drag_rotate.js.map +0 -1
  124. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  125. package/es/handler/shim/touch_zoom_rotate.js +0 -80
  126. package/es/handler/shim/touch_zoom_rotate.js.map +0 -1
  127. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  128. package/es/handler/tap/single_tap_recognizer.js +0 -127
  129. package/es/handler/tap/single_tap_recognizer.js.map +0 -1
  130. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  131. package/es/handler/tap/tap_drag_zoom.js +0 -124
  132. package/es/handler/tap/tap_drag_zoom.js.map +0 -1
  133. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  134. package/es/handler/tap/tap_recognizer.js +0 -72
  135. package/es/handler/tap/tap_recognizer.js.map +0 -1
  136. package/es/handler/tap/tap_zoom.d.ts +0 -22
  137. package/es/handler/tap/tap_zoom.js +0 -124
  138. package/es/handler/tap/tap_zoom.js.map +0 -1
  139. package/es/handler/touch/index.d.ts +0 -5
  140. package/es/handler/touch/index.js +0 -6
  141. package/es/handler/touch/index.js.map +0 -1
  142. package/es/handler/touch/touch_pan.d.ts +0 -30
  143. package/es/handler/touch/touch_pan.js +0 -139
  144. package/es/handler/touch/touch_pan.js.map +0 -1
  145. package/es/handler/touch/touch_pitch.d.ts +0 -13
  146. package/es/handler/touch/touch_pitch.js +0 -120
  147. package/es/handler/touch/touch_pitch.js.map +0 -1
  148. package/es/handler/touch/touch_rotate.d.ts +0 -12
  149. package/es/handler/touch/touch_rotate.js +0 -88
  150. package/es/handler/touch/touch_rotate.js.map +0 -1
  151. package/es/handler/touch/touch_zoom.d.ts +0 -12
  152. package/es/handler/touch/touch_zoom.js +0 -79
  153. package/es/handler/touch/touch_zoom.js.map +0 -1
  154. package/es/handler/touch/two_touch.d.ts +0 -23
  155. package/es/handler/touch/two_touch.js +0 -140
  156. package/es/handler/touch/two_touch.js.map +0 -1
  157. package/es/hash.d.ts +0 -15
  158. package/es/hash.js +0 -143
  159. package/es/hash.js.map +0 -1
  160. package/es/index.d.ts +0 -2
  161. package/es/index.js +0 -3
  162. package/es/index.js.map +0 -1
  163. package/es/interface.d.ts +0 -31
  164. package/es/interface.js +0 -2
  165. package/es/interface.js.map +0 -1
  166. package/es/map.d.ts +0 -67
  167. package/es/map.js +0 -454
  168. package/es/map.js.map +0 -1
  169. package/es/util.d.ts +0 -18
  170. package/es/util.js +0 -74
  171. package/es/util.js.map +0 -1
  172. package/es/utils/Aabb.d.ts +0 -12
  173. package/es/utils/Aabb.js +0 -134
  174. package/es/utils/Aabb.js.map +0 -1
  175. package/es/utils/dom.d.ts +0 -4
  176. package/es/utils/dom.js +0 -165
  177. package/es/utils/dom.js.map +0 -1
  178. package/es/utils/performance.d.ts +0 -17
  179. package/es/utils/performance.js +0 -57
  180. package/es/utils/performance.js.map +0 -1
  181. package/es/utils/primitives.d.ts +0 -6
  182. package/es/utils/primitives.js +0 -44
  183. package/es/utils/primitives.js.map +0 -1
  184. package/es/utils/task_queue.d.ts +0 -13
  185. package/es/utils/task_queue.js +0 -113
  186. package/es/utils/task_queue.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/handler/touch/two_touch.ts"],"names":["DOM","TwoTouchHandler","reset","active","firstTwoTouches","points","pinchAround","e","mapTouches","length","identifier","start","preventDefault","idA","idB","a","getTouchById","b","aroundCenter","add","div","move","suppressClick","options","enabled","around","i"],"mappings":";;;;AAEA,OAAOA,GAAP,MAAgB,iBAAhB;;IAEqBC,e;AAQnB,6BAAc;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACZ,SAAKC,KAAL;AACD;;;;WAED,iBAAe;AACb,WAAKC,MAAL,GAAc,KAAd;AACA,aAAO,KAAKC,eAAZ;AACD;;;WACD,eAAaC,MAAb,EAAqC;AACnC;AACD;;;WACD,cACEA,MADF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,GAAP;AAAA,UAAYC,GAAZ;;AACA,UAAMC,CAAC,GAAGC,YAAY,CAACR,UAAD,EAAaH,MAAb,EAAqBQ,GAArB,CAAtB;AACA,UAAMI,CAAC,GAAGD,YAAY,CAACR,UAAD,EAAaH,MAAb,EAAqBS,GAArB,CAAtB;;AACA,UAAIC,CAAC,IAAIE,CAAT,EAAY;AACV;AACD;;AAED,UAAI,KAAKd,MAAT,EAAiB;AACfH,QAAAA,GAAG,CAACsB,aAAJ;AACD;;AAED,WAAKpB,KAAL;AACD;;;WAED,uBAAqB;AACnB,WAAKA,KAAL;AACD;;;WAED,gBAAcqB,OAAd,EAA+C;AAC7C,WAAKC,OAAL,GAAe,IAAf;AACA,WAAKN,YAAL,GAAoB,CAAC,CAACK,OAAF,IAAaA,OAAO,CAACE,MAAR,KAAmB,QAApD;AACD;;;WAED,mBAAiB;AACf,WAAKD,OAAL,GAAe,KAAf;AACA,WAAKtB,KAAL;AACD;;;WAED,qBAAmB;AACjB,aAAO,KAAKsB,OAAZ;AACD;;;WAED,oBAAkB;AAChB,aAAO,KAAKrB,MAAZ;AACD;;;;;;SAlGkBF,e;;AAqGrB,SAASe,YAAT,CACER,UADF,EAEEH,MAFF,EAGEK,UAHF,EAIE;AACA,OAAK,IAAIgB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGlB,UAAU,CAACC,MAA/B,EAAuCiB,CAAC,EAAxC,EAA4C;AAC1C,QAAIlB,UAAU,CAACkB,CAAD,CAAV,CAAchB,UAAd,KAA6BA,UAAjC,EAA6C;AAC3C,aAAOL,MAAM,CAACqB,CAAD,CAAb;AACD;AACF;AACF","sourcesContent":["// @ts-ignore\nimport Point from '../../geo/point';\nimport DOM from '../../utils/dom';\n\nexport default class TwoTouchHandler {\n protected enabled: boolean;\n protected active: boolean;\n protected firstTwoTouches: [number, number];\n protected vector: Point;\n protected startVector: Point;\n protected aroundCenter: boolean;\n\n constructor() {\n this.reset();\n }\n\n public reset() {\n this.active = false;\n delete this.firstTwoTouches;\n }\n public start(points: [Point, Point]) {\n return;\n } // eslint-disable-line\n public move(\n points: [Point, Point],\n pinchAround: Point | null,\n e: TouchEvent,\n ) {\n return;\n } // eslint-disable-line\n\n public touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]) {\n // console.log(e.target, e.targetTouches.length ? e.targetTouches[0].target : null);\n // log('touchstart', points, e.target.innerHTML, e.targetTouches.length ? e.targetTouches[0].target.innerHTML: undefined);\n if (this.firstTwoTouches || mapTouches.length < 2) {\n return;\n }\n\n this.firstTwoTouches = [mapTouches[0].identifier, mapTouches[1].identifier];\n\n // implemented by child classes\n this.start([points[0], points[1]]);\n }\n\n public touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]) {\n if (!this.firstTwoTouches) {\n return;\n }\n\n e.preventDefault();\n\n const [idA, idB] = this.firstTwoTouches;\n const a = getTouchById(mapTouches, points, idA);\n const b = getTouchById(mapTouches, points, idB);\n if (!a || !b) {\n return;\n }\n const pinchAround = this.aroundCenter ? null : a.add(b).div(2);\n\n // implemented by child classes\n return this.move([a, b], pinchAround, e);\n }\n\n public touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]) {\n if (!this.firstTwoTouches) {\n return;\n }\n\n const [idA, idB] = this.firstTwoTouches;\n const a = getTouchById(mapTouches, points, idA);\n const b = getTouchById(mapTouches, points, idB);\n if (a && b) {\n return;\n }\n\n if (this.active) {\n DOM.suppressClick();\n }\n\n this.reset();\n }\n\n public touchcancel() {\n this.reset();\n }\n\n public enable(options?: { around?: 'center' }) {\n this.enabled = true;\n this.aroundCenter = !!options && options.around === 'center';\n }\n\n public disable() {\n this.enabled = false;\n this.reset();\n }\n\n public isEnabled() {\n return this.enabled;\n }\n\n public isActive() {\n return this.active;\n }\n}\n\nfunction getTouchById(\n mapTouches: Touch[],\n points: Point[],\n identifier: number,\n) {\n for (let i = 0; i < mapTouches.length; i++) {\n if (mapTouches[i].identifier === identifier) {\n return points[i];\n }\n }\n}\n"],"file":"two_touch.js"}
package/es/hash.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { EarthMap } from './earthmap';
2
- import { Map } from './map';
3
- declare class Hash {
4
- private map;
5
- private updateHash;
6
- private hashName?;
7
- constructor(hashName?: string);
8
- addTo(map: Map | EarthMap): this;
9
- remove(): this;
10
- onHashChange: () => boolean;
11
- private getCurrentHash;
12
- private getHashString;
13
- private updateHashUnthrottled;
14
- }
15
- export default Hash;
package/es/hash.js DELETED
@@ -1,143 +0,0 @@
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
- import throttle from 'lodash/throttle';
5
-
6
- var Hash = function () {
7
- function Hash(hashName) {
8
- var _this = this;
9
-
10
- _classCallCheck(this, Hash);
11
-
12
- _defineProperty(this, "map", void 0);
13
-
14
- _defineProperty(this, "updateHash", void 0);
15
-
16
- _defineProperty(this, "hashName", void 0);
17
-
18
- _defineProperty(this, "onHashChange", function () {
19
- var loc = _this.getCurrentHash();
20
-
21
- if (loc.length >= 3 && !loc.some(function (v) {
22
- return isNaN(+v);
23
- })) {
24
- var bearing = _this.map.dragRotate.isEnabled() && _this.map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : _this.map.getBearing();
25
-
26
- _this.map.jumpTo({
27
- center: [+loc[2], +loc[1]],
28
- zoom: +loc[0],
29
- bearing: bearing,
30
- pitch: +(loc[4] || 0)
31
- });
32
-
33
- return true;
34
- }
35
-
36
- return false;
37
- });
38
-
39
- _defineProperty(this, "getCurrentHash", function () {
40
- var hash = window.location.hash.replace('#', '');
41
-
42
- if (_this.hashName) {
43
- var keyval;
44
- hash.split('&').map(function (part) {
45
- return part.split('=');
46
- }).forEach(function (part) {
47
- if (part[0] === _this.hashName) {
48
- keyval = part;
49
- }
50
- });
51
- return (keyval ? keyval[1] || '' : '').split('/');
52
- }
53
-
54
- return hash.split('/');
55
- });
56
-
57
- _defineProperty(this, "updateHashUnthrottled", function () {
58
- var hash = _this.getHashString();
59
-
60
- try {
61
- window.history.replaceState(window.history.state, '', hash);
62
- } catch (SecurityError) {}
63
- });
64
-
65
- this.hashName = hashName && encodeURIComponent(hashName);
66
- this.updateHash = throttle(this.updateHashUnthrottled, 30 * 1000 / 100);
67
- }
68
-
69
- _createClass(Hash, [{
70
- key: "addTo",
71
- value: function addTo(map) {
72
- this.map = map;
73
- window.addEventListener('hashchange', this.onHashChange, false);
74
- this.map.on('moveend', this.updateHash);
75
- return this;
76
- }
77
- }, {
78
- key: "remove",
79
- value: function remove() {
80
- window.removeEventListener('hashchange', this.onHashChange, false);
81
- this.map.off('moveend', this.updateHash);
82
- delete this.map;
83
- return this;
84
- }
85
- }, {
86
- key: "getHashString",
87
- value: function getHashString(mapFeedback) {
88
- var center = this.map.getCenter();
89
- var zoom = Math.round(this.map.getZoom() * 100) / 100;
90
- var precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10);
91
- var m = Math.pow(10, precision);
92
- var lng = Math.round(center.lng * m) / m;
93
- var lat = Math.round(center.lat * m) / m;
94
- var bearing = this.map.getBearing();
95
- var pitch = this.map.getPitch();
96
- var hash = '';
97
-
98
- if (mapFeedback) {
99
- hash += "/".concat(lng, "/").concat(lat, "/").concat(zoom);
100
- } else {
101
- hash += "".concat(zoom, "/").concat(lat, "/").concat(lng);
102
- }
103
-
104
- if (bearing || pitch) {
105
- hash += "/".concat(Math.round(bearing * 10) / 10);
106
- }
107
-
108
- if (pitch) {
109
- hash += "/".concat(Math.round(pitch));
110
- }
111
-
112
- if (this.hashName) {
113
- var hashName = this.hashName;
114
- var found = false;
115
- var parts = window.location.hash.slice(1).split('&').map(function (part) {
116
- var key = part.split('=')[0];
117
-
118
- if (key === hashName) {
119
- found = true;
120
- return "".concat(key, "=").concat(hash);
121
- }
122
-
123
- return part;
124
- }).filter(function (a) {
125
- return a;
126
- });
127
-
128
- if (!found) {
129
- parts.push("".concat(hashName, "=").concat(hash));
130
- }
131
-
132
- return "#".concat(parts.join('&'));
133
- }
134
-
135
- return "#".concat(hash);
136
- }
137
- }]);
138
-
139
- return Hash;
140
- }();
141
-
142
- export default Hash;
143
- //# sourceMappingURL=hash.js.map
package/es/hash.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hash.ts"],"names":["throttle","Hash","hashName","loc","getCurrentHash","length","some","v","isNaN","bearing","map","dragRotate","isEnabled","touchZoomRotate","getBearing","jumpTo","center","zoom","pitch","hash","window","location","replace","keyval","split","part","forEach","getHashString","history","replaceState","state","SecurityError","encodeURIComponent","updateHash","updateHashUnthrottled","addEventListener","onHashChange","on","removeEventListener","off","mapFeedback","getCenter","Math","round","getZoom","precision","ceil","LN2","log","LN10","m","pow","lng","lat","getPitch","found","parts","slice","key","filter","a","push","join"],"mappings":";;;AAEA,OAAOA,QAAP,MAAqB,iBAArB;;IAUMC,I;AAKJ,gBAAYC,QAAZ,EAA+B;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,0CAuBT,YAAM;AAC1B,UAAMC,GAAG,GAAG,KAAI,CAACC,cAAL,EAAZ;;AACA,UAAID,GAAG,CAACE,MAAJ,IAAc,CAAd,IAAmB,CAACF,GAAG,CAACG,IAAJ,CAAS,UAACC,CAAD;AAAA,eAAeC,KAAK,CAAC,CAACD,CAAF,CAApB;AAAA,OAAT,CAAxB,EAA4D;AAC1D,YAAME,OAAO,GACX,KAAI,CAACC,GAAL,CAASC,UAAT,CAAoBC,SAApB,MAAmC,KAAI,CAACF,GAAL,CAASG,eAAT,CAAyBD,SAAzB,EAAnC,GACI,EAAET,GAAG,CAAC,CAAD,CAAH,IAAU,CAAZ,CADJ,GAEI,KAAI,CAACO,GAAL,CAASI,UAAT,EAHN;;AAIA,QAAA,KAAI,CAACJ,GAAL,CAASK,MAAT,CAAgB;AACdC,UAAAA,MAAM,EAAE,CAAC,CAACb,GAAG,CAAC,CAAD,CAAL,EAAU,CAACA,GAAG,CAAC,CAA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AAd,cAA0BiB,IAA1B;AACD;;AACD,0BAAWqC,KAAK,CAACM,IAAN,CAAW,GAAX,CAAX;AACD;;AAED,wBAAW3C,IAAX;AACD;;;;;;AAcH,eAAelB,IAAf","sourcesContent":["// @ts-ignore\n// tslint:disable-next-line:no-submodule-imports\nimport throttle from 'lodash/throttle';\nimport { EarthMap } from './earthmap';\nimport { Map } from './map';\n\n/*\n * Adds the map's position to its page's location hash.\n * Passed as an option to the map object.\n *\n * @returns {Hash} `this`\n */\nclass Hash {\n private map: Map | EarthMap;\n private updateHash: () => number | void;\n private hashName?: string;\n\n constructor(hashName?: string) {\n this.hashName = hashName && encodeURIComponent(hashName);\n\n // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.\n this.updateHash = throttle(this.updateHashUnthrottled, (30 * 1000) / 100);\n }\n public addTo(map: Map | EarthMap) {\n this.map = map;\n window.addEventListener('hashchange', this.onHashChange, false);\n // @ts-ignore\n this.map.on('moveend', this.updateHash);\n return this;\n }\n public remove() {\n window.removeEventListener('hashchange', this.onHashChange, false);\n // @ts-ignore\n this.map.off('moveend', this.updateHash);\n // clearTimeout(this.updateHash());\n // @ts-ignore\n delete this.map;\n return this;\n }\n\n public onHashChange = () => {\n const loc = this.getCurrentHash();\n if (loc.length >= 3 && !loc.some((v: string) => isNaN(+v))) {\n const bearing =\n this.map.dragRotate.isEnabled() && this.map.touchZoomRotate.isEnabled()\n ? +(loc[3] || 0)\n : this.map.getBearing();\n this.map.jumpTo({\n center: [+loc[2], +loc[1]],\n zoom: +loc[0],\n bearing,\n pitch: +(loc[4] || 0),\n });\n return true;\n }\n return false;\n };\n\n private getCurrentHash = () => {\n // Get the current hash from location, stripped from its number sign\n const hash = window.location.hash.replace('#', '');\n if (this.hashName) {\n // Split the parameter-styled hash into parts and find the value we need\n let keyval;\n hash\n .split('&')\n .map((part) => part.split('='))\n .forEach((part) => {\n if (part[0] === this.hashName) {\n keyval = part;\n }\n });\n return (keyval ? keyval[1] || '' : '').split('/');\n }\n return hash.split('/');\n };\n\n private getHashString(mapFeedback?: boolean) {\n const center = this.map.getCenter();\n const zoom = Math.round(this.map.getZoom() * 100) / 100;\n // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px\n const precision = Math.ceil(\n (zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10,\n );\n const m = Math.pow(10, precision);\n const lng = Math.round(center.lng * m) / m;\n const lat = Math.round(center.lat * m) / m;\n const bearing = this.map.getBearing();\n const pitch = this.map.getPitch();\n let hash = '';\n if (mapFeedback) {\n // new map feedback site has some constraints that don't allow\n // us to use the same hash format as we do for the Map hash option.\n hash += `/${lng}/${lat}/${zoom}`;\n } else {\n hash += `${zoom}/${lat}/${lng}`;\n }\n\n if (bearing || pitch) {\n hash += `/${Math.round(bearing * 10) / 10}`;\n }\n if (pitch) {\n hash += `/${Math.round(pitch)}`;\n }\n\n if (this.hashName) {\n const hashName = this.hashName;\n let found = false;\n const parts = window.location.hash\n .slice(1)\n .split('&')\n .map((part) => {\n const key = part.split('=')[0];\n if (key === hashName) {\n found = true;\n return `${key}=${hash}`;\n }\n return part;\n })\n .filter((a) => a);\n if (!found) {\n parts.push(`${hashName}=${hash}`);\n }\n return `#${parts.join('&')}`;\n }\n\n return `#${hash}`;\n }\n\n private updateHashUnthrottled = () => {\n const hash = this.getHashString();\n try {\n window.history.replaceState(window.history.state, '', hash);\n } catch (SecurityError) {\n // IE11 does not allow this if the page is within an iframe created\n // with iframe.contentWindow.document.write(...).\n // https://github.com/mapbox/mapbox-gl-js/issues/7410\n }\n };\n}\n\nexport default Hash;\n"],"file":"hash.js"}
package/es/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './map';
2
- export * from './earthmap';
package/es/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from './map';
2
- export * from './earthmap';
3
- //# sourceMappingURL=index.js.map
package/es/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAd;AACA,cAAc,YAAd","sourcesContent":["export * from './map';\nexport * from './earthmap';\n"],"file":"index.js"}
package/es/interface.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import { LngLatBoundsLike } from './geo/lng_lat_bounds';
2
- export interface IMapOptions {
3
- hash: boolean;
4
- style?: any;
5
- container?: HTMLElement | string;
6
- center: [number, number];
7
- zoom: number;
8
- bearing: number;
9
- pitch: number;
10
- interactive: boolean;
11
- scrollZoom: boolean;
12
- bounds?: LngLatBoundsLike;
13
- maxBounds?: LngLatBoundsLike;
14
- fitBoundsOptions?: any;
15
- minZoom: number;
16
- maxZoom: number;
17
- minPitch: number;
18
- maxPitch: number;
19
- boxZoom: boolean;
20
- dragRotate: boolean;
21
- dragPan: boolean;
22
- keyboard: boolean;
23
- doubleClickZoom: boolean;
24
- touchZoomRotate: boolean;
25
- touchPitch: boolean;
26
- trackResize: boolean;
27
- renderWorldCopies: boolean;
28
- bearingSnap: number;
29
- clickTolerance: number;
30
- pitchWithRotate: boolean;
31
- }
package/es/interface.js DELETED
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"interface.js"}
package/es/map.d.ts DELETED
@@ -1,67 +0,0 @@
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
- private containerDimensions;
63
- private resizeCanvas;
64
- private onWindowOnline;
65
- private onWindowResize;
66
- }
67
- export {};