@antv/l7-map 2.5.33 → 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.
- package/lib/camera.js.map +1 -1
- package/lib/earthmap.js +7 -26
- package/lib/earthmap.js.map +1 -1
- package/lib/handler/handler_manager.js +55 -33
- package/lib/handler/handler_manager.js.map +1 -1
- package/lib/handler/scroll_zoom.js +1 -1
- package/lib/handler/scroll_zoom.js.map +1 -1
- package/lib/handler/shim/drag_pan.js +10 -2
- package/lib/handler/shim/drag_pan.js.map +1 -1
- package/lib/handler/shim/touch_zoom_rotate.js +10 -2
- package/lib/handler/shim/touch_zoom_rotate.js.map +1 -1
- package/lib/hash.js +9 -4
- package/lib/hash.js.map +1 -1
- package/lib/map.js +39 -19
- package/lib/map.js.map +1 -1
- package/lib/util.js +7 -5
- package/lib/util.js.map +1 -1
- package/lib/utils/dom.js +66 -26
- package/lib/utils/dom.js.map +1 -1
- package/lib/utils/performance.js +4 -1
- package/lib/utils/performance.js.map +1 -1
- package/package.json +3 -3
- package/LICENSE.md +0 -21
- package/es/camera.d.ts +0 -82
- package/es/camera.js +0 -729
- package/es/camera.js.map +0 -1
- package/es/earthmap.d.ts +0 -67
- package/es/earthmap.js +0 -454
- package/es/earthmap.js.map +0 -1
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -88
- package/es/geo/edge_insets.js.map +0 -1
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -77
- package/es/geo/lng_lat.js.map +0 -1
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -170
- package/es/geo/lng_lat_bounds.js.map +0 -1
- package/es/geo/mercator.d.ts +0 -28
- package/es/geo/mercator.js +0 -79
- package/es/geo/mercator.js.map +0 -1
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -237
- package/es/geo/point.js.map +0 -1
- package/es/geo/simple.d.ts +0 -28
- package/es/geo/simple.js +0 -78
- package/es/geo/simple.js.map +0 -1
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -663
- package/es/geo/transform.js.map +0 -1
- package/es/handler/IHandler.d.ts +0 -34
- package/es/handler/IHandler.js +0 -2
- package/es/handler/IHandler.js.map +0 -1
- package/es/handler/blockable_map_event.d.ts +0 -17
- package/es/handler/blockable_map_event.js +0 -84
- package/es/handler/blockable_map_event.js.map +0 -1
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -184
- package/es/handler/box_zoom.js.map +0 -1
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -64
- package/es/handler/click_zoom.js.map +0 -1
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -14
- package/es/handler/events/event.js.map +0 -1
- package/es/handler/events/index.d.ts +0 -4
- package/es/handler/events/index.js +0 -5
- package/es/handler/events/index.js.map +0 -1
- package/es/handler/events/map_mouse_event.d.ts +0 -34
- package/es/handler/events/map_mouse_event.js +0 -65
- package/es/handler/events/map_mouse_event.js.map +0 -1
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -75
- package/es/handler/events/map_touch_event.js.map +0 -1
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -52
- package/es/handler/events/map_wheel_event.js.map +0 -1
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -41
- package/es/handler/events/render_event.js.map +0 -1
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -186
- package/es/handler/handler_inertia.js.map +0 -1
- package/es/handler/handler_manager.d.ts +0 -57
- package/es/handler/handler_manager.js +0 -655
- package/es/handler/handler_manager.js.map +0 -1
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -10
- package/es/handler/handler_util.js.map +0 -1
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -157
- package/es/handler/keyboard.js.map +0 -1
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -120
- package/es/handler/map_event.js.map +0 -1
- package/es/handler/mouse/index.d.ts +0 -4
- package/es/handler/mouse/index.js +0 -5
- package/es/handler/mouse/index.js.map +0 -1
- package/es/handler/mouse/mouse_handler.d.ts +0 -22
- package/es/handler/mouse/mouse_handler.js +0 -131
- package/es/handler/mouse/mouse_handler.js.map +0 -1
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -54
- package/es/handler/mouse/mousepan_handler.js.map +0 -1
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -54
- package/es/handler/mouse/mousepitch_hander.js.map +0 -1
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -54
- package/es/handler/mouse/mouserotate_hander.js.map +0 -1
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -12
- package/es/handler/mouse/util.js.map +0 -1
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -317
- package/es/handler/scroll_zoom.js.map +0 -1
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -45
- package/es/handler/shim/dblclick_zoom.js.map +0 -1
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -53
- package/es/handler/shim/drag_pan.js.map +0 -1
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -51
- package/es/handler/shim/drag_rotate.js.map +0 -1
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -80
- package/es/handler/shim/touch_zoom_rotate.js.map +0 -1
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -127
- package/es/handler/tap/single_tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -124
- package/es/handler/tap/tap_drag_zoom.js.map +0 -1
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -72
- package/es/handler/tap/tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -124
- package/es/handler/tap/tap_zoom.js.map +0 -1
- package/es/handler/touch/index.d.ts +0 -5
- package/es/handler/touch/index.js +0 -6
- package/es/handler/touch/index.js.map +0 -1
- package/es/handler/touch/touch_pan.d.ts +0 -30
- package/es/handler/touch/touch_pan.js +0 -139
- package/es/handler/touch/touch_pan.js.map +0 -1
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -120
- package/es/handler/touch/touch_pitch.js.map +0 -1
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -88
- package/es/handler/touch/touch_rotate.js.map +0 -1
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -79
- package/es/handler/touch/touch_zoom.js.map +0 -1
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -140
- package/es/handler/touch/two_touch.js.map +0 -1
- package/es/hash.d.ts +0 -15
- package/es/hash.js +0 -143
- package/es/hash.js.map +0 -1
- package/es/index.d.ts +0 -2
- package/es/index.js +0 -3
- package/es/index.js.map +0 -1
- package/es/interface.d.ts +0 -31
- package/es/interface.js +0 -2
- package/es/interface.js.map +0 -1
- package/es/map.d.ts +0 -67
- package/es/map.js +0 -454
- package/es/map.js.map +0 -1
- package/es/util.d.ts +0 -18
- package/es/util.js +0 -74
- package/es/util.js.map +0 -1
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -134
- package/es/utils/Aabb.js.map +0 -1
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -165
- package/es/utils/dom.js.map +0 -1
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -57
- package/es/utils/performance.js.map +0 -1
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -44
- package/es/utils/primitives.js.map +0 -1
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -113
- package/es/utils/task_queue.js.map +0 -1
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import merge from 'lodash/merge';
|
|
4
|
-
export var Event = function Event(type) {
|
|
5
|
-
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6
|
-
|
|
7
|
-
_classCallCheck(this, Event);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "type", void 0);
|
|
10
|
-
|
|
11
|
-
merge(this, data);
|
|
12
|
-
this.type = type;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/events/event.ts"],"names":["merge","Event","type","data"],"mappings":";;AACA,OAAOA,KAAP,MAAkB,cAAlB;AACA,WAAaC,KAAb,GAEE,eAAYC,IAAZ,EAA0C;AAAA,MAAhBC,IAAgB,uEAAJ,EAAI;;AAAA;;AAAA;;AACxCH,EAAAA,KAAK,CAAC,IAAD,EAAOG,IAAP,CAAL;AACA,OAAKD,IAAL,GAAYA,IAAZ;AACD,CALH","sourcesContent":["// tslint:disable-next-line:no-submodule-imports\nimport merge from 'lodash/merge';\nexport class Event {\n public type: string;\n constructor(type: string, data: any = {}) {\n merge(this, data);\n this.type = type;\n }\n}\n"],"file":"event.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/events/index.ts"],"names":["MapMouseEvent","MapTouchEvent","MapWheelEvent"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,mBAA1B;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,aAAP,MAAgD,mBAAhD;AAEA,SAASF,aAAT,EAAwBC,aAAxB,EAAuCC,aAAvC","sourcesContent":["import MapMouseEvent from './map_mouse_event';\nimport MapTouchEvent from './map_touch_event';\nimport MapWheelEvent, { IMapBoxZoomEvent } from './map_wheel_event';\n\nexport { MapMouseEvent, MapTouchEvent, MapWheelEvent };\n"],"file":"index.js"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { EarthMap } from '../../earthmap';
|
|
2
|
-
import LngLat from '../../geo/lng_lat';
|
|
3
|
-
import Point from '../../geo/point';
|
|
4
|
-
import { Map } from '../../map';
|
|
5
|
-
import { Event } from './event';
|
|
6
|
-
export default class MapMouseEvent extends Event {
|
|
7
|
-
/**
|
|
8
|
-
* `true` if `preventDefault` has been called.
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
type: 'mousedown' | 'mouseup' | 'click' | 'dblclick' | 'mousemove' | 'mouseover' | 'mouseenter' | 'mouseleave' | 'mouseout' | 'contextmenu';
|
|
12
|
-
/**
|
|
13
|
-
* The `Map` object that fired the event.
|
|
14
|
-
*/
|
|
15
|
-
target: Map | EarthMap;
|
|
16
|
-
/**
|
|
17
|
-
* The DOM event which caused the map event.
|
|
18
|
-
*/
|
|
19
|
-
originalEvent: MouseEvent;
|
|
20
|
-
/**
|
|
21
|
-
* The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
|
|
22
|
-
*/
|
|
23
|
-
point: Point;
|
|
24
|
-
/**
|
|
25
|
-
* The geographic location on the map of the mouse cursor.
|
|
26
|
-
*/
|
|
27
|
-
lngLat: LngLat;
|
|
28
|
-
defaultPrevented: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
constructor(type: string, map: Map | EarthMap, originalEvent: MouseEvent, data?: any);
|
|
33
|
-
preventDefault(): void;
|
|
34
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
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
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
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); }; }
|
|
10
|
-
|
|
11
|
-
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; } }
|
|
12
|
-
|
|
13
|
-
import merge from 'lodash/merge';
|
|
14
|
-
import DOM from '../../utils/dom';
|
|
15
|
-
import { Event } from './event';
|
|
16
|
-
|
|
17
|
-
var MapMouseEvent = function (_Event) {
|
|
18
|
-
_inherits(MapMouseEvent, _Event);
|
|
19
|
-
|
|
20
|
-
var _super = _createSuper(MapMouseEvent);
|
|
21
|
-
|
|
22
|
-
function MapMouseEvent(type, map, originalEvent) {
|
|
23
|
-
var _this;
|
|
24
|
-
|
|
25
|
-
var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
26
|
-
|
|
27
|
-
_classCallCheck(this, MapMouseEvent);
|
|
28
|
-
|
|
29
|
-
var point = DOM.mousePos(map.getCanvasContainer(), originalEvent);
|
|
30
|
-
var lngLat = map.unproject(point);
|
|
31
|
-
_this = _super.call(this, type, merge({
|
|
32
|
-
point: point,
|
|
33
|
-
lngLat: lngLat,
|
|
34
|
-
originalEvent: originalEvent
|
|
35
|
-
}, data));
|
|
36
|
-
|
|
37
|
-
_defineProperty(_assertThisInitialized(_this), "type", void 0);
|
|
38
|
-
|
|
39
|
-
_defineProperty(_assertThisInitialized(_this), "target", void 0);
|
|
40
|
-
|
|
41
|
-
_defineProperty(_assertThisInitialized(_this), "originalEvent", void 0);
|
|
42
|
-
|
|
43
|
-
_defineProperty(_assertThisInitialized(_this), "point", void 0);
|
|
44
|
-
|
|
45
|
-
_defineProperty(_assertThisInitialized(_this), "lngLat", void 0);
|
|
46
|
-
|
|
47
|
-
_defineProperty(_assertThisInitialized(_this), "defaultPrevented", void 0);
|
|
48
|
-
|
|
49
|
-
_this.defaultPrevented = false;
|
|
50
|
-
_this.target = map;
|
|
51
|
-
return _this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
_createClass(MapMouseEvent, [{
|
|
55
|
-
key: "preventDefault",
|
|
56
|
-
value: function preventDefault() {
|
|
57
|
-
this.defaultPrevented = true;
|
|
58
|
-
}
|
|
59
|
-
}]);
|
|
60
|
-
|
|
61
|
-
return MapMouseEvent;
|
|
62
|
-
}(Event);
|
|
63
|
-
|
|
64
|
-
export { MapMouseEvent as default };
|
|
65
|
-
//# sourceMappingURL=map_mouse_event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/events/map_mouse_event.ts"],"names":["merge","DOM","Event","MapMouseEvent","type","map","originalEvent","data","point","mousePos","getCanvasContainer","lngLat","unproject","defaultPrevented","target"],"mappings":";;;;;;;;;;;;AAEA,OAAOA,KAAP,MAAkB,cAAlB;AAKA,OAAOC,GAAP,MAAgB,iBAAhB;AACA,SAASC,KAAT,QAAsB,SAAtB;;IACqBC,a;;;;;AA2CnB,yBACEC,IADF,EAEEC,GAFF,EAGEC,aAHF,EAKE;AAAA;;AAAA,QADAC,IACA,uEADY,EACZ;;AAAA;;AACA,QAAMC,KAAK,GAAGP,GAAG,CAACQ,QAAJ,CAAaJ,GAAG,CAACK,kBAAJ,EAAb,EAAuCJ,aAAvC,CAAd;AACA,QAAMK,MAAM,GAAGN,GAAG,CAACO,SAAJ,CAAcJ,KAAd,CAAf;AACA,8BAAMJ,IAAN,EAAYJ,KAAK,CAAC;AAAEQ,MAAAA,KAAK,EAALA,KAAF;AAASG,MAAAA,MAAM,EAANA,MAAT;AAAiBL,MAAAA,aAAa,EAAbA;AAAjB,KAAD,EAAmCC,IAAnC,CAAjB;;AAHA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAIA,UAAKM,gBAAL,GAAwB,KAAxB;AACA,UAAKC,MAAL,GAAcT,GAAd;AALA;AAMD;;;;WACD,0BAAwB;AACtB,WAAKQ,gBAAL,GAAwB,IAAxB;AACD;;;;EAzDwCX,K;;SAAtBC,a","sourcesContent":["// @ts-ignore\n// tslint:disable-next-line:no-submodule-imports\nimport merge from 'lodash/merge';\nimport { EarthMap } from '../../earthmap';\nimport LngLat from '../../geo/lng_lat';\nimport Point from '../../geo/point';\nimport { Map } from '../../map';\nimport DOM from '../../utils/dom';\nimport { Event } from './event';\nexport default class MapMouseEvent extends Event {\n /**\n * `true` if `preventDefault` has been called.\n * @private\n */\n\n public type:\n | 'mousedown'\n | 'mouseup'\n | 'click'\n | 'dblclick'\n | 'mousemove'\n | 'mouseover'\n | 'mouseenter'\n | 'mouseleave'\n | 'mouseout'\n | 'contextmenu';\n\n /**\n * The `Map` object that fired the event.\n */\n public target: Map | EarthMap;\n\n /**\n * The DOM event which caused the map event.\n */\n public originalEvent: MouseEvent;\n\n /**\n * The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.\n */\n public point: Point;\n\n /**\n * The geographic location on the map of the mouse cursor.\n */\n public lngLat: LngLat;\n\n public defaultPrevented: boolean;\n\n /**\n * @private\n */\n constructor(\n type: string,\n map: Map | EarthMap,\n originalEvent: MouseEvent,\n data: any = {},\n ) {\n const point = DOM.mousePos(map.getCanvasContainer(), originalEvent);\n const lngLat = map.unproject(point);\n super(type, merge({ point, lngLat, originalEvent }, data));\n this.defaultPrevented = false;\n this.target = map;\n }\n public preventDefault() {\n this.defaultPrevented = true;\n }\n}\n"],"file":"map_mouse_event.js"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { EarthMap } from '../../earthmap';
|
|
2
|
-
import LngLat from '../../geo/lng_lat';
|
|
3
|
-
import Point from '../../geo/point';
|
|
4
|
-
import { Map } from '../../map';
|
|
5
|
-
import { Event } from './event';
|
|
6
|
-
export default class MapTouchEvent extends Event {
|
|
7
|
-
/**
|
|
8
|
-
* The event type.
|
|
9
|
-
*/
|
|
10
|
-
type: 'touchstart' | 'touchend' | 'touchcancel';
|
|
11
|
-
/**
|
|
12
|
-
* The `Map` object that fired the event.
|
|
13
|
-
*/
|
|
14
|
-
target: Map | EarthMap;
|
|
15
|
-
/**
|
|
16
|
-
* The DOM event which caused the map event.
|
|
17
|
-
*/
|
|
18
|
-
originalEvent: TouchEvent;
|
|
19
|
-
/**
|
|
20
|
-
* The geographic location on the map of the center of the touch event points.
|
|
21
|
-
*/
|
|
22
|
-
lngLat: LngLat;
|
|
23
|
-
/**
|
|
24
|
-
* The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left
|
|
25
|
-
* corner.
|
|
26
|
-
*/
|
|
27
|
-
point: Point;
|
|
28
|
-
/**
|
|
29
|
-
* The array of pixel coordinates corresponding to a
|
|
30
|
-
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
31
|
-
*/
|
|
32
|
-
points: Point[];
|
|
33
|
-
/**
|
|
34
|
-
* The geographical locations on the map corresponding to a
|
|
35
|
-
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
36
|
-
*/
|
|
37
|
-
lngLats: LngLat[];
|
|
38
|
-
/**
|
|
39
|
-
* `true` if `preventDefault` has been called.
|
|
40
|
-
* @private
|
|
41
|
-
*/
|
|
42
|
-
defaultPrevented: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
constructor(type: string, map: Map | EarthMap, originalEvent: TouchEvent);
|
|
47
|
-
/**
|
|
48
|
-
* Prevents subsequent default processing of the event by the map.
|
|
49
|
-
*
|
|
50
|
-
* Calling this method will prevent the following default map behaviors:
|
|
51
|
-
*
|
|
52
|
-
* * On `touchstart` events, the behavior of {@link DragPanHandler}
|
|
53
|
-
* * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
private preventDefault;
|
|
57
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
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
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
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); }; }
|
|
10
|
-
|
|
11
|
-
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; } }
|
|
12
|
-
|
|
13
|
-
import Point from '../../geo/point';
|
|
14
|
-
import DOM from '../../utils/dom';
|
|
15
|
-
import { Event } from './event';
|
|
16
|
-
|
|
17
|
-
var MapTouchEvent = function (_Event) {
|
|
18
|
-
_inherits(MapTouchEvent, _Event);
|
|
19
|
-
|
|
20
|
-
var _super = _createSuper(MapTouchEvent);
|
|
21
|
-
|
|
22
|
-
function MapTouchEvent(type, map, originalEvent) {
|
|
23
|
-
var _this;
|
|
24
|
-
|
|
25
|
-
_classCallCheck(this, MapTouchEvent);
|
|
26
|
-
|
|
27
|
-
var touches = type === 'touchend' ? originalEvent.changedTouches : originalEvent.touches;
|
|
28
|
-
var points = DOM.touchPos(map.getCanvasContainer(), touches);
|
|
29
|
-
var lngLats = points.map(function (t) {
|
|
30
|
-
return map.unproject(t);
|
|
31
|
-
});
|
|
32
|
-
var point = points.reduce(function (prev, curr, i, arr) {
|
|
33
|
-
return prev.add(curr.div(arr.length));
|
|
34
|
-
}, new Point(0, 0));
|
|
35
|
-
var lngLat = map.unproject(point);
|
|
36
|
-
_this = _super.call(this, type, {
|
|
37
|
-
points: points,
|
|
38
|
-
point: point,
|
|
39
|
-
lngLats: lngLats,
|
|
40
|
-
lngLat: lngLat,
|
|
41
|
-
originalEvent: originalEvent
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "type", void 0);
|
|
45
|
-
|
|
46
|
-
_defineProperty(_assertThisInitialized(_this), "target", void 0);
|
|
47
|
-
|
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "originalEvent", void 0);
|
|
49
|
-
|
|
50
|
-
_defineProperty(_assertThisInitialized(_this), "lngLat", void 0);
|
|
51
|
-
|
|
52
|
-
_defineProperty(_assertThisInitialized(_this), "point", void 0);
|
|
53
|
-
|
|
54
|
-
_defineProperty(_assertThisInitialized(_this), "points", void 0);
|
|
55
|
-
|
|
56
|
-
_defineProperty(_assertThisInitialized(_this), "lngLats", void 0);
|
|
57
|
-
|
|
58
|
-
_defineProperty(_assertThisInitialized(_this), "defaultPrevented", void 0);
|
|
59
|
-
|
|
60
|
-
_this.defaultPrevented = false;
|
|
61
|
-
return _this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
_createClass(MapTouchEvent, [{
|
|
65
|
-
key: "preventDefault",
|
|
66
|
-
value: function preventDefault() {
|
|
67
|
-
this.defaultPrevented = true;
|
|
68
|
-
}
|
|
69
|
-
}]);
|
|
70
|
-
|
|
71
|
-
return MapTouchEvent;
|
|
72
|
-
}(Event);
|
|
73
|
-
|
|
74
|
-
export { MapTouchEvent as default };
|
|
75
|
-
//# sourceMappingURL=map_touch_event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/events/map_touch_event.ts"],"names":["Point","DOM","Event","MapTouchEvent","type","map","originalEvent","touches","changedTouches","points","touchPos","getCanvasContainer","lngLats","t","unproject","point","reduce","prev","curr","i","arr","add","div","length","lngLat","defaultPrevented"],"mappings":";;;;;;;;;;;;AAGA,OAAOA,KAAP,MAAkB,iBAAlB;AAEA,OAAOC,GAAP,MAAgB,iBAAhB;AACA,SAASC,KAAT,QAAsB,SAAtB;;IACqBC,a;;;;;AAiDnB,yBAAYC,IAAZ,EAA0BC,GAA1B,EAA+CC,aAA/C,EAA0E;AAAA;;AAAA;;AACxE,QAAMC,OAAO,GACXH,IAAI,KAAK,UAAT,GACIE,aAAa,CAACE,cADlB,GAEIF,aAAa,CAACC,OAHpB;AAIA,QAAME,MAAM,GAAGR,GAAG,CAACS,QAAJ,CAAaL,GAAG,CAACM,kBAAJ,EAAb,EAAuCJ,OAAvC,CAAf;AACA,QAAMK,OAAO,GAAGH,MAAM,CAACJ,GAAP,CAAW,UAACQ,CAAD;AAAA,aAAcR,GAAG,CAACS,SAAJ,CAAcD,CAAd,CAAd;AAAA,KAAX,CAAhB;AACA,QAAME,KAAK,GAAGN,MAAM,CAACO,MAAP,CACZ,UAACC,IAAD,EAAcC,IAAd,EAA2BC,CAA3B,EAAsCC,GAAtC,EAAuD;AACrD,aAAOH,IAAI,CAACI,GAAL,CAASH,IAAI,CAACI,GAAL,CAASF,GAAG,CAACG,MAAb,CAAT,CAAP;AACD,KAHW,EAIZ,IAAIvB,KAAJ,CAAU,CAAV,EAAa,CAAb,CAJY,CAAd;AAMA,QAAMwB,MAAM,GAAGnB,GAAG,CAACS,SAAJ,CAAcC,KAAd,CAAf;AACA,8BAAMX,IAAN,EAAY;AAAEK,MAAAA,MAAM,EAANA,MAAF;AAAUM,MAAAA,KAAK,EAALA,KAAV;AAAiBH,MAAAA,OAAO,EAAPA,OAAjB;AAA0BY,MAAAA,MAAM,EAANA,MAA1B;AAAkClB,MAAAA,aAAa,EAAbA;AAAlC,KAAZ;;AAdwE;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAexE,UAAKmB,gBAAL,GAAwB,KAAxB;AAfwE;AAgBzE;;;;WAWD,0BAAyB;AACvB,WAAKA,gBAAL,GAAwB,IAAxB;AACD;;;;EA9EwCvB,K;;SAAtBC,a","sourcesContent":["// @ts-ignore\nimport { EarthMap } from '../../earthmap';\nimport LngLat from '../../geo/lng_lat';\nimport Point from '../../geo/point';\nimport { Map } from '../../map';\nimport DOM from '../../utils/dom';\nimport { Event } from './event';\nexport default class MapTouchEvent extends Event {\n /**\n * The event type.\n */\n public type: 'touchstart' | 'touchend' | 'touchcancel';\n\n /**\n * The `Map` object that fired the event.\n */\n public target: Map | EarthMap;\n\n /**\n * The DOM event which caused the map event.\n */\n public originalEvent: TouchEvent;\n\n /**\n * The geographic location on the map of the center of the touch event points.\n */\n public lngLat: LngLat;\n\n /**\n * The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left\n * corner.\n */\n public point: Point;\n\n /**\n * The array of pixel coordinates corresponding to a\n * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.\n */\n public points: Point[];\n\n /**\n * The geographical locations on the map corresponding to a\n * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.\n */\n public lngLats: LngLat[];\n\n /**\n * `true` if `preventDefault` has been called.\n * @private\n */\n\n public defaultPrevented: boolean;\n\n /**\n * @private\n */\n constructor(type: string, map: Map | EarthMap, originalEvent: TouchEvent) {\n const touches =\n type === 'touchend'\n ? originalEvent.changedTouches\n : originalEvent.touches;\n const points = DOM.touchPos(map.getCanvasContainer(), touches);\n const lngLats = points.map((t: Point) => map.unproject(t));\n const point = points.reduce(\n (prev: Point, curr: Point, i: number, arr: Point[]) => {\n return prev.add(curr.div(arr.length));\n },\n new Point(0, 0),\n );\n const lngLat = map.unproject(point);\n super(type, { points, point, lngLats, lngLat, originalEvent });\n this.defaultPrevented = false;\n }\n\n /**\n * Prevents subsequent default processing of the event by the map.\n *\n * Calling this method will prevent the following default map behaviors:\n *\n * * On `touchstart` events, the behavior of {@link DragPanHandler}\n * * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}\n *\n */\n private preventDefault() {\n this.defaultPrevented = true;\n }\n}\n"],"file":"map_touch_event.js"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { EarthMap } from '../../earthmap';
|
|
2
|
-
import { Map } from '../../map';
|
|
3
|
-
import { Event } from './event';
|
|
4
|
-
export interface IMapBoxZoomEvent {
|
|
5
|
-
type: 'boxzoomstart' | 'boxzoomend' | 'boxzoomcancel';
|
|
6
|
-
target: Map | EarthMap;
|
|
7
|
-
originalEvent: MouseEvent;
|
|
8
|
-
}
|
|
9
|
-
export default class MapWheelEvent extends Event {
|
|
10
|
-
/**
|
|
11
|
-
* The event type.
|
|
12
|
-
*/
|
|
13
|
-
type: 'wheel';
|
|
14
|
-
/**
|
|
15
|
-
* The DOM event which caused the map event.
|
|
16
|
-
*/
|
|
17
|
-
originalEvent: WheelEvent;
|
|
18
|
-
defaultPrevented: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The `Map` object that fired the event.
|
|
21
|
-
*/
|
|
22
|
-
target: Map | EarthMap;
|
|
23
|
-
/**
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
constructor(type: string, map: Map | EarthMap, originalEvent: WheelEvent);
|
|
27
|
-
/**
|
|
28
|
-
* Prevents subsequent default processing of the event by the map.
|
|
29
|
-
*
|
|
30
|
-
* Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.
|
|
31
|
-
*/
|
|
32
|
-
private preventDefault;
|
|
33
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
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
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
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); }; }
|
|
10
|
-
|
|
11
|
-
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; } }
|
|
12
|
-
|
|
13
|
-
import { Event } from './event';
|
|
14
|
-
|
|
15
|
-
var MapWheelEvent = function (_Event) {
|
|
16
|
-
_inherits(MapWheelEvent, _Event);
|
|
17
|
-
|
|
18
|
-
var _super = _createSuper(MapWheelEvent);
|
|
19
|
-
|
|
20
|
-
function MapWheelEvent(type, map, originalEvent) {
|
|
21
|
-
var _this;
|
|
22
|
-
|
|
23
|
-
_classCallCheck(this, MapWheelEvent);
|
|
24
|
-
|
|
25
|
-
_this = _super.call(this, type, {
|
|
26
|
-
originalEvent: originalEvent
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
_defineProperty(_assertThisInitialized(_this), "type", void 0);
|
|
30
|
-
|
|
31
|
-
_defineProperty(_assertThisInitialized(_this), "originalEvent", void 0);
|
|
32
|
-
|
|
33
|
-
_defineProperty(_assertThisInitialized(_this), "defaultPrevented", void 0);
|
|
34
|
-
|
|
35
|
-
_defineProperty(_assertThisInitialized(_this), "target", void 0);
|
|
36
|
-
|
|
37
|
-
_this.defaultPrevented = false;
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
_createClass(MapWheelEvent, [{
|
|
42
|
-
key: "preventDefault",
|
|
43
|
-
value: function preventDefault() {
|
|
44
|
-
this.defaultPrevented = true;
|
|
45
|
-
}
|
|
46
|
-
}]);
|
|
47
|
-
|
|
48
|
-
return MapWheelEvent;
|
|
49
|
-
}(Event);
|
|
50
|
-
|
|
51
|
-
export { MapWheelEvent as default };
|
|
52
|
-
//# sourceMappingURL=map_wheel_event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/events/map_wheel_event.ts"],"names":["Event","MapWheelEvent","type","map","originalEvent","defaultPrevented"],"mappings":";;;;;;;;;;;;AAEA,SAASA,KAAT,QAAsB,SAAtB;;IAOqBC,a;;;;;AAqBnB,yBAAYC,IAAZ,EAA0BC,GAA1B,EAA+CC,aAA/C,EAA0E;AAAA;;AAAA;;AACxE,8BAAMF,IAAN,EAAY;AAAEE,MAAAA,aAAa,EAAbA;AAAF,KAAZ;;AADwE;;AAAA;;AAAA;;AAAA;;AAExE,UAAKC,gBAAL,GAAwB,KAAxB;AAFwE;AAGzE;;;;WAOD,0BAAyB;AACvB,WAAKA,gBAAL,GAAwB,IAAxB;AACD;;;;EAjCwCL,K;;SAAtBC,a","sourcesContent":["import { EarthMap } from '../../earthmap';\nimport { Map } from '../../map';\nimport { Event } from './event';\n\nexport interface IMapBoxZoomEvent {\n type: 'boxzoomstart' | 'boxzoomend' | 'boxzoomcancel';\n target: Map | EarthMap;\n originalEvent: MouseEvent;\n}\nexport default class MapWheelEvent extends Event {\n /**\n * The event type.\n */\n public type: 'wheel';\n\n /**\n * The DOM event which caused the map event.\n */\n public originalEvent: WheelEvent;\n\n public defaultPrevented: boolean;\n\n /**\n * The `Map` object that fired the event.\n */\n public target: Map | EarthMap;\n\n /**\n * @private\n */\n constructor(type: string, map: Map | EarthMap, originalEvent: WheelEvent) {\n super(type, { originalEvent });\n this.defaultPrevented = false;\n }\n\n /**\n * Prevents subsequent default processing of the event by the map.\n *\n * Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.\n */\n private preventDefault() {\n this.defaultPrevented = true;\n }\n}\n"],"file":"map_wheel_event.js"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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
|
-
import { Event } from './event';
|
|
13
|
-
|
|
14
|
-
var RenderFrameEvent = function (_Event) {
|
|
15
|
-
_inherits(RenderFrameEvent, _Event);
|
|
16
|
-
|
|
17
|
-
var _super = _createSuper(RenderFrameEvent);
|
|
18
|
-
|
|
19
|
-
function RenderFrameEvent() {
|
|
20
|
-
var _this;
|
|
21
|
-
|
|
22
|
-
_classCallCheck(this, RenderFrameEvent);
|
|
23
|
-
|
|
24
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
-
args[_key] = arguments[_key];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
29
|
-
|
|
30
|
-
_defineProperty(_assertThisInitialized(_this), "type", 'renderFrame');
|
|
31
|
-
|
|
32
|
-
_defineProperty(_assertThisInitialized(_this), "timeStamp", void 0);
|
|
33
|
-
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return RenderFrameEvent;
|
|
38
|
-
}(Event);
|
|
39
|
-
|
|
40
|
-
export { RenderFrameEvent as default };
|
|
41
|
-
//# sourceMappingURL=render_event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/events/render_event.ts"],"names":["Event","RenderFrameEvent"],"mappings":";;;;;;;;;;;AAAA,SAASA,KAAT,QAAsB,SAAtB;;IACqBC,gB;;;;;;;;;;;;;;;;2DACU,a;;;;;;;;EADeD,K;;SAAzBC,gB","sourcesContent":["import { Event } from './event';\nexport default class RenderFrameEvent extends Event {\n public type: 'renderFrame' = 'renderFrame';\n public timeStamp: number;\n}\n"],"file":"render_event.js"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { EarthMap } from '../earthmap';
|
|
2
|
-
import { Map } from '../map';
|
|
3
|
-
import { IDragPanOptions } from './shim/drag_pan';
|
|
4
|
-
export interface IInertiaOptions {
|
|
5
|
-
linearity: number;
|
|
6
|
-
easing: (t: number) => number;
|
|
7
|
-
deceleration: number;
|
|
8
|
-
maxSpeed: number;
|
|
9
|
-
}
|
|
10
|
-
export declare type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
|
|
11
|
-
export default class HandlerInertia {
|
|
12
|
-
private map;
|
|
13
|
-
private inertiaBuffer;
|
|
14
|
-
constructor(map: Map | EarthMap);
|
|
15
|
-
clear(): void;
|
|
16
|
-
record(settings: any): void;
|
|
17
|
-
drainInertiaBuffer(): void;
|
|
18
|
-
onMoveEnd(panInertiaOptions?: IDragPanOptions): ({
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
} & {
|
|
21
|
-
noMoveStart: boolean;
|
|
22
|
-
}) | undefined;
|
|
23
|
-
}
|
|
@@ -1,186 +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
|
-
|
|
5
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
|
-
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
-
|
|
9
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
-
|
|
11
|
-
import Point from '../geo/point';
|
|
12
|
-
import merge from 'lodash/merge';
|
|
13
|
-
import { bezier, clamp, now } from '../util';
|
|
14
|
-
var defaultInertiaOptions = {
|
|
15
|
-
linearity: 0.3,
|
|
16
|
-
easing: bezier(0, 0, 0.3, 1)
|
|
17
|
-
};
|
|
18
|
-
var defaultPanInertiaOptions = merge({
|
|
19
|
-
deceleration: 2500,
|
|
20
|
-
maxSpeed: 1400
|
|
21
|
-
}, defaultInertiaOptions);
|
|
22
|
-
var defaultZoomInertiaOptions = merge({
|
|
23
|
-
deceleration: 20,
|
|
24
|
-
maxSpeed: 1400
|
|
25
|
-
}, defaultInertiaOptions);
|
|
26
|
-
var defaultBearingInertiaOptions = merge({
|
|
27
|
-
deceleration: 1000,
|
|
28
|
-
maxSpeed: 360
|
|
29
|
-
}, defaultInertiaOptions);
|
|
30
|
-
var defaultPitchInertiaOptions = merge({
|
|
31
|
-
deceleration: 1000,
|
|
32
|
-
maxSpeed: 90
|
|
33
|
-
}, defaultInertiaOptions);
|
|
34
|
-
|
|
35
|
-
var HandlerInertia = function () {
|
|
36
|
-
function HandlerInertia(map) {
|
|
37
|
-
_classCallCheck(this, HandlerInertia);
|
|
38
|
-
|
|
39
|
-
_defineProperty(this, "map", void 0);
|
|
40
|
-
|
|
41
|
-
_defineProperty(this, "inertiaBuffer", void 0);
|
|
42
|
-
|
|
43
|
-
this.map = map;
|
|
44
|
-
this.clear();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_createClass(HandlerInertia, [{
|
|
48
|
-
key: "clear",
|
|
49
|
-
value: function clear() {
|
|
50
|
-
this.inertiaBuffer = [];
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "record",
|
|
54
|
-
value: function record(settings) {
|
|
55
|
-
this.drainInertiaBuffer();
|
|
56
|
-
this.inertiaBuffer.push({
|
|
57
|
-
time: now(),
|
|
58
|
-
settings: settings
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
key: "drainInertiaBuffer",
|
|
63
|
-
value: function drainInertiaBuffer() {
|
|
64
|
-
var inertia = this.inertiaBuffer;
|
|
65
|
-
var nowTime = now();
|
|
66
|
-
var cutoff = 160;
|
|
67
|
-
|
|
68
|
-
while (inertia.length > 0 && nowTime - inertia[0].time > cutoff) {
|
|
69
|
-
inertia.shift();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: "onMoveEnd",
|
|
74
|
-
value: function onMoveEnd(panInertiaOptions) {
|
|
75
|
-
this.drainInertiaBuffer();
|
|
76
|
-
|
|
77
|
-
if (this.inertiaBuffer.length < 2) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var deltas = {
|
|
82
|
-
zoom: 0,
|
|
83
|
-
bearing: 0,
|
|
84
|
-
pitch: 0,
|
|
85
|
-
pan: new Point(0, 0),
|
|
86
|
-
pinchAround: undefined,
|
|
87
|
-
around: undefined
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
var _iterator = _createForOfIteratorHelper(this.inertiaBuffer),
|
|
91
|
-
_step;
|
|
92
|
-
|
|
93
|
-
try {
|
|
94
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
95
|
-
var settings = _step.value.settings;
|
|
96
|
-
deltas.zoom += settings.zoomDelta || 0;
|
|
97
|
-
deltas.bearing += settings.bearingDelta || 0;
|
|
98
|
-
deltas.pitch += settings.pitchDelta || 0;
|
|
99
|
-
|
|
100
|
-
if (settings.panDelta) {
|
|
101
|
-
deltas.pan._add(settings.panDelta);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (settings.around) {
|
|
105
|
-
deltas.around = settings.around;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (settings.pinchAround) {
|
|
109
|
-
deltas.pinchAround = settings.pinchAround;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
} catch (err) {
|
|
113
|
-
_iterator.e(err);
|
|
114
|
-
} finally {
|
|
115
|
-
_iterator.f();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
var lastEntry = this.inertiaBuffer[this.inertiaBuffer.length - 1];
|
|
119
|
-
var duration = lastEntry.time - this.inertiaBuffer[0].time;
|
|
120
|
-
var easeOptions = {};
|
|
121
|
-
|
|
122
|
-
if (deltas.pan.mag()) {
|
|
123
|
-
var result = calculateEasing(deltas.pan.mag(), duration, merge({}, defaultPanInertiaOptions, panInertiaOptions || {}));
|
|
124
|
-
easeOptions.offset = deltas.pan.mult(result.amount / deltas.pan.mag());
|
|
125
|
-
easeOptions.center = this.map.transform.center;
|
|
126
|
-
extendDuration(easeOptions, result);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (deltas.zoom) {
|
|
130
|
-
var _result = calculateEasing(deltas.zoom, duration, defaultZoomInertiaOptions);
|
|
131
|
-
|
|
132
|
-
easeOptions.zoom = this.map.transform.zoom + _result.amount;
|
|
133
|
-
extendDuration(easeOptions, _result);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (deltas.bearing) {
|
|
137
|
-
var _result2 = calculateEasing(deltas.bearing, duration, defaultBearingInertiaOptions);
|
|
138
|
-
|
|
139
|
-
easeOptions.bearing = this.map.transform.bearing + clamp(_result2.amount, -179, 179);
|
|
140
|
-
extendDuration(easeOptions, _result2);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (deltas.pitch) {
|
|
144
|
-
var _result3 = calculateEasing(deltas.pitch, duration, defaultPitchInertiaOptions);
|
|
145
|
-
|
|
146
|
-
easeOptions.pitch = this.map.transform.pitch + _result3.amount;
|
|
147
|
-
extendDuration(easeOptions, _result3);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (easeOptions.zoom || easeOptions.bearing) {
|
|
151
|
-
var last = deltas.pinchAround === undefined ? deltas.around : deltas.pinchAround;
|
|
152
|
-
easeOptions.around = last ? this.map.unproject(last) : this.map.getCenter();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
this.clear();
|
|
156
|
-
return merge(easeOptions, {
|
|
157
|
-
noMoveStart: true
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}]);
|
|
161
|
-
|
|
162
|
-
return HandlerInertia;
|
|
163
|
-
}();
|
|
164
|
-
|
|
165
|
-
export { HandlerInertia as default };
|
|
166
|
-
|
|
167
|
-
function extendDuration(easeOptions, result) {
|
|
168
|
-
if (!easeOptions.duration || easeOptions.duration < result.duration) {
|
|
169
|
-
easeOptions.duration = result.duration;
|
|
170
|
-
easeOptions.easing = result.easing;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function calculateEasing(amount, inertiaDuration, inertiaOptions) {
|
|
175
|
-
var maxSpeed = inertiaOptions.maxSpeed,
|
|
176
|
-
linearity = inertiaOptions.linearity,
|
|
177
|
-
deceleration = inertiaOptions.deceleration;
|
|
178
|
-
var speed = clamp(amount * linearity / (inertiaDuration / 1000), -maxSpeed, maxSpeed);
|
|
179
|
-
var duration = Math.abs(speed) / (deceleration * linearity);
|
|
180
|
-
return {
|
|
181
|
-
easing: inertiaOptions.easing,
|
|
182
|
-
duration: duration * 1000,
|
|
183
|
-
amount: speed * (duration / 2)
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
//# sourceMappingURL=handler_inertia.js.map
|