@antv/l7-map 2.21.0 → 2.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/camera.js +595 -674
- package/es/earthmap.js +313 -276
- package/es/geo/edge_insets.js +57 -72
- package/es/geo/lng_lat.js +50 -64
- package/es/geo/lng_lat_bounds.js +101 -137
- package/es/geo/mercator.js +23 -35
- package/es/geo/point.js +150 -221
- package/es/geo/simple.js +22 -34
- package/es/geo/transform.js +839 -905
- package/es/handler/blockable_map_event.js +46 -66
- package/es/handler/box_zoom.js +125 -143
- package/es/handler/click_zoom.js +37 -51
- package/es/handler/events/event.js +11 -9
- package/es/handler/events/map_mouse_event.js +39 -54
- package/es/handler/events/map_touch_event.js +54 -73
- package/es/handler/events/map_wheel_event.js +22 -38
- package/es/handler/events/render_event.js +6 -23
- package/es/handler/handler_inertia.js +98 -113
- package/es/handler/handler_manager.js +349 -437
- package/es/handler/handler_util.js +2 -2
- package/es/handler/keyboard.js +98 -110
- package/es/handler/map_event.js +81 -117
- package/es/handler/mouse/mouse_handler.js +81 -100
- package/es/handler/mouse/mousepan_handler.js +16 -39
- package/es/handler/mouse/mousepitch_hander.js +18 -40
- package/es/handler/mouse/mouserotate_hander.js +18 -40
- package/es/handler/mouse/util.js +7 -6
- package/es/handler/scroll_zoom.js +221 -231
- package/es/handler/shim/dblclick_zoom.js +36 -47
- package/es/handler/shim/drag_pan.js +41 -50
- package/es/handler/shim/drag_rotate.js +38 -48
- package/es/handler/shim/touch_zoom_rotate.js +68 -79
- package/es/handler/tap/single_tap_recognizer.js +60 -80
- package/es/handler/tap/tap_drag_zoom.js +72 -89
- package/es/handler/tap/tap_recognizer.js +37 -45
- package/es/handler/tap/tap_zoom.js +67 -95
- package/es/handler/touch/touch_pan.js +77 -96
- package/es/handler/touch/touch_pitch.js +61 -79
- package/es/handler/touch/touch_rotate.js +47 -67
- package/es/handler/touch/touch_zoom.js +29 -46
- package/es/handler/touch/two_touch.js +79 -104
- package/es/hash.js +75 -88
- package/es/map.js +318 -284
- package/es/util.js +18 -37
- package/es/utils/Aabb.js +60 -100
- package/es/utils/dom.js +32 -55
- package/es/utils/performance.js +25 -29
- package/es/utils/primitives.js +33 -43
- package/es/utils/task_queue.js +47 -76
- package/lib/camera.d.ts +86 -0
- package/lib/camera.js +597 -672
- package/lib/earthmap.d.ts +69 -0
- package/lib/earthmap.js +314 -276
- package/lib/geo/edge_insets.d.ts +54 -0
- package/lib/geo/edge_insets.js +58 -70
- package/lib/geo/lng_lat.d.ts +18 -0
- package/lib/geo/lng_lat.js +50 -62
- package/lib/geo/lng_lat_bounds.d.ts +25 -0
- package/lib/geo/lng_lat_bounds.js +102 -136
- package/lib/geo/mercator.d.ts +30 -0
- package/lib/geo/mercator.js +26 -37
- package/lib/geo/point.d.ts +40 -0
- package/lib/geo/point.js +151 -220
- package/lib/geo/simple.d.ts +30 -0
- package/lib/geo/simple.js +25 -36
- package/lib/geo/transform.d.ts +198 -0
- package/lib/geo/transform.js +844 -907
- package/lib/handler/IHandler.d.ts +34 -0
- package/lib/handler/blockable_map_event.d.ts +17 -0
- package/lib/handler/blockable_map_event.js +48 -65
- package/lib/handler/box_zoom.d.ts +59 -0
- package/lib/handler/box_zoom.js +126 -143
- package/lib/handler/click_zoom.d.ts +16 -0
- package/lib/handler/click_zoom.js +38 -50
- package/lib/handler/events/event.d.ts +4 -0
- package/lib/handler/events/event.js +12 -9
- package/lib/handler/events/index.d.ts +4 -0
- package/lib/handler/events/index.js +3 -3
- package/lib/handler/events/map_mouse_event.d.ts +34 -0
- package/lib/handler/events/map_mouse_event.js +41 -52
- package/lib/handler/events/map_touch_event.d.ts +57 -0
- package/lib/handler/events/map_touch_event.js +56 -71
- package/lib/handler/events/map_wheel_event.d.ts +33 -0
- package/lib/handler/events/map_wheel_event.js +23 -37
- package/lib/handler/events/render_event.d.ts +5 -0
- package/lib/handler/events/render_event.js +7 -22
- package/lib/handler/handler_inertia.d.ts +23 -0
- package/lib/handler/handler_inertia.js +102 -112
- package/lib/handler/handler_manager.d.ts +61 -0
- package/lib/handler/handler_manager.js +351 -437
- package/lib/handler/handler_util.d.ts +4 -0
- package/lib/handler/handler_util.js +2 -2
- package/lib/handler/keyboard.d.ts +36 -0
- package/lib/handler/keyboard.js +98 -110
- package/lib/handler/map_event.d.ts +29 -0
- package/lib/handler/map_event.js +83 -116
- package/lib/handler/mouse/index.d.ts +4 -0
- package/lib/handler/mouse/index.js +3 -3
- package/lib/handler/mouse/mouse_handler.d.ts +22 -0
- package/lib/handler/mouse/mouse_handler.js +83 -99
- package/lib/handler/mouse/mousepan_handler.d.ts +10 -0
- package/lib/handler/mouse/mousepan_handler.js +19 -38
- package/lib/handler/mouse/mousepitch_hander.d.ts +9 -0
- package/lib/handler/mouse/mousepitch_hander.js +21 -39
- package/lib/handler/mouse/mouserotate_hander.d.ts +9 -0
- package/lib/handler/mouse/mouserotate_hander.js +21 -39
- package/lib/handler/mouse/util.d.ts +6 -0
- package/lib/handler/mouse/util.js +7 -7
- package/lib/handler/scroll_zoom.d.ts +93 -0
- package/lib/handler/scroll_zoom.js +221 -231
- package/lib/handler/shim/dblclick_zoom.d.ts +40 -0
- package/lib/handler/shim/dblclick_zoom.js +37 -46
- package/lib/handler/shim/drag_pan.d.ts +61 -0
- package/lib/handler/shim/drag_pan.js +42 -49
- package/lib/handler/shim/drag_rotate.d.ts +46 -0
- package/lib/handler/shim/drag_rotate.js +39 -47
- package/lib/handler/shim/touch_zoom_rotate.d.ts +70 -0
- package/lib/handler/shim/touch_zoom_rotate.js +69 -78
- package/lib/handler/tap/single_tap_recognizer.d.ts +20 -0
- package/lib/handler/tap/single_tap_recognizer.js +63 -79
- package/lib/handler/tap/tap_drag_zoom.d.ts +22 -0
- package/lib/handler/tap/tap_drag_zoom.js +74 -88
- package/lib/handler/tap/tap_recognizer.d.ts +17 -0
- package/lib/handler/tap/tap_recognizer.js +41 -47
- package/lib/handler/tap/tap_zoom.d.ts +22 -0
- package/lib/handler/tap/tap_zoom.js +69 -94
- package/lib/handler/touch/index.d.ts +5 -0
- package/lib/handler/touch/index.js +4 -4
- package/lib/handler/touch/touch_pan.d.ts +30 -0
- package/lib/handler/touch/touch_pan.js +79 -95
- package/lib/handler/touch/touch_pitch.d.ts +13 -0
- package/lib/handler/touch/touch_pitch.js +64 -78
- package/lib/handler/touch/touch_rotate.d.ts +12 -0
- package/lib/handler/touch/touch_rotate.js +50 -66
- package/lib/handler/touch/touch_zoom.d.ts +12 -0
- package/lib/handler/touch/touch_zoom.js +32 -45
- package/lib/handler/touch/two_touch.d.ts +23 -0
- package/lib/handler/touch/two_touch.js +81 -103
- package/lib/hash.d.ts +14 -0
- package/lib/hash.js +75 -88
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -4
- package/lib/interface.d.ts +34 -0
- package/lib/map.d.ts +70 -0
- package/lib/map.js +319 -284
- package/lib/util.d.ts +25 -0
- package/lib/util.js +20 -36
- package/lib/utils/Aabb.d.ts +12 -0
- package/lib/utils/Aabb.js +61 -99
- package/lib/utils/dom.d.ts +4 -0
- package/lib/utils/dom.js +34 -55
- package/lib/utils/performance.d.ts +17 -0
- package/lib/utils/performance.js +25 -29
- package/lib/utils/primitives.d.ts +6 -0
- package/lib/utils/primitives.js +34 -42
- package/lib/utils/task_queue.d.ts +13 -0
- package/lib/utils/task_queue.js +47 -76
- package/package.json +25 -32
|
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.Event = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _l7Utils = require("@antv/l7-utils");
|
|
11
10
|
// tslint:disable-next-line:no-submodule-imports
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const {
|
|
13
|
+
merge
|
|
14
|
+
} = _l7Utils.lodashUtil;
|
|
15
|
+
class Event {
|
|
16
|
+
constructor(type, data = {}) {
|
|
17
|
+
(0, _defineProperty2.default)(this, "type", void 0);
|
|
18
|
+
merge(this, data);
|
|
19
|
+
this.type = type;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Event = Event;
|
|
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
Object.defineProperty(exports, "MapMouseEvent", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function
|
|
9
|
+
get: function () {
|
|
10
10
|
return _map_mouse_event.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "MapTouchEvent", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function
|
|
15
|
+
get: function () {
|
|
16
16
|
return _map_touch_event.default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "MapWheelEvent", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function
|
|
21
|
+
get: function () {
|
|
22
22
|
return _map_wheel_event.default;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { EarthMap } from '../../earthmap';
|
|
2
|
+
import type LngLat from '../../geo/lng_lat';
|
|
3
|
+
import type Point from '../../geo/point';
|
|
4
|
+
import type { 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
|
+
}
|
|
@@ -5,65 +5,54 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
9
|
var _l7Utils = require("@antv/l7-utils");
|
|
14
10
|
var _dom = _interopRequireDefault(require("../../utils/dom"));
|
|
15
11
|
var _event = require("./event");
|
|
16
|
-
|
|
17
|
-
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; } } // @ts-ignore
|
|
12
|
+
// @ts-ignore
|
|
18
13
|
// tslint:disable-next-line:no-submodule-imports
|
|
19
|
-
var merge = _l7Utils.lodashUtil.merge;
|
|
20
|
-
var MapMouseEvent = exports.default = /*#__PURE__*/function (_Event) {
|
|
21
|
-
(0, _inherits2.default)(MapMouseEvent, _Event);
|
|
22
|
-
var _super = _createSuper(MapMouseEvent);
|
|
23
|
-
/**
|
|
24
|
-
* `true` if `preventDefault` has been called.
|
|
25
|
-
* @private
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The `Map` object that fired the event.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The DOM event which caused the map event.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* The geographic location on the map of the mouse cursor.
|
|
42
|
-
*/
|
|
43
14
|
|
|
15
|
+
const {
|
|
16
|
+
merge
|
|
17
|
+
} = _l7Utils.lodashUtil;
|
|
18
|
+
class MapMouseEvent extends _event.Event {
|
|
44
19
|
/**
|
|
45
20
|
* @private
|
|
46
21
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
point: point,
|
|
55
|
-
lngLat: lngLat,
|
|
56
|
-
originalEvent: originalEvent
|
|
22
|
+
constructor(type, map, originalEvent, data = {}) {
|
|
23
|
+
const point = _dom.default.mousePos(map.getCanvasContainer(), originalEvent);
|
|
24
|
+
const lngLat = map.unproject(point);
|
|
25
|
+
super(type, merge({
|
|
26
|
+
point,
|
|
27
|
+
lngLat,
|
|
28
|
+
originalEvent
|
|
57
29
|
}, data));
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
30
|
+
/**
|
|
31
|
+
* `true` if `preventDefault` has been called.
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* The `Map` object that fired the event.
|
|
36
|
+
*/
|
|
37
|
+
(0, _defineProperty2.default)(this, "target", void 0);
|
|
38
|
+
/**
|
|
39
|
+
* The DOM event which caused the map event.
|
|
40
|
+
*/
|
|
41
|
+
(0, _defineProperty2.default)(this, "originalEvent", void 0);
|
|
42
|
+
/**
|
|
43
|
+
* The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
|
|
44
|
+
*/
|
|
45
|
+
(0, _defineProperty2.default)(this, "point", void 0);
|
|
46
|
+
/**
|
|
47
|
+
* The geographic location on the map of the mouse cursor.
|
|
48
|
+
*/
|
|
49
|
+
(0, _defineProperty2.default)(this, "lngLat", void 0);
|
|
50
|
+
(0, _defineProperty2.default)(this, "defaultPrevented", void 0);
|
|
51
|
+
this.defaultPrevented = false;
|
|
52
|
+
this.target = map;
|
|
53
|
+
}
|
|
54
|
+
preventDefault() {
|
|
55
|
+
this.defaultPrevented = true;
|
|
61
56
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
value: function preventDefault() {
|
|
65
|
-
this.defaultPrevented = true;
|
|
66
|
-
}
|
|
67
|
-
}]);
|
|
68
|
-
return MapMouseEvent;
|
|
69
|
-
}(_event.Event);
|
|
57
|
+
}
|
|
58
|
+
exports.default = MapMouseEvent;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { EarthMap } from '../../earthmap';
|
|
2
|
+
import type LngLat from '../../geo/lng_lat';
|
|
3
|
+
import Point from '../../geo/point';
|
|
4
|
+
import type { 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
|
+
}
|
|
@@ -5,79 +5,67 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
9
|
var _point = _interopRequireDefault(require("../../geo/point"));
|
|
14
10
|
var _dom = _interopRequireDefault(require("../../utils/dom"));
|
|
15
11
|
var _event = require("./event");
|
|
16
|
-
|
|
17
|
-
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; } } // @ts-ignore
|
|
18
|
-
var MapTouchEvent = exports.default = /*#__PURE__*/function (_Event) {
|
|
19
|
-
(0, _inherits2.default)(MapTouchEvent, _Event);
|
|
20
|
-
var _super = _createSuper(MapTouchEvent);
|
|
21
|
-
/**
|
|
22
|
-
* The event type.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The `Map` object that fired the event.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The DOM event which caused the map event.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The geographic location on the map of the center of the touch event points.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left
|
|
39
|
-
* corner.
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The array of pixel coordinates corresponding to a
|
|
44
|
-
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* The geographical locations on the map corresponding to a
|
|
49
|
-
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
50
|
-
*/
|
|
12
|
+
// @ts-ignore
|
|
51
13
|
|
|
14
|
+
class MapTouchEvent extends _event.Event {
|
|
52
15
|
/**
|
|
53
|
-
* `true` if `preventDefault` has been called.
|
|
54
16
|
* @private
|
|
55
17
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _this;
|
|
62
|
-
(0, _classCallCheck2.default)(this, MapTouchEvent);
|
|
63
|
-
var touches = type === 'touchend' ? originalEvent.changedTouches : originalEvent.touches;
|
|
64
|
-
var points = _dom.default.touchPos(map.getCanvasContainer(), touches);
|
|
65
|
-
var lngLats = points.map(function (t) {
|
|
66
|
-
return map.unproject(t);
|
|
67
|
-
});
|
|
68
|
-
var point = points.reduce(function (prev, curr, i, arr) {
|
|
18
|
+
constructor(type, map, originalEvent) {
|
|
19
|
+
const touches = type === 'touchend' ? originalEvent.changedTouches : originalEvent.touches;
|
|
20
|
+
const points = _dom.default.touchPos(map.getCanvasContainer(), touches);
|
|
21
|
+
const lngLats = points.map(t => map.unproject(t));
|
|
22
|
+
const point = points.reduce((prev, curr, i, arr) => {
|
|
69
23
|
return prev.add(curr.div(arr.length));
|
|
70
24
|
}, new _point.default(0, 0));
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
points
|
|
74
|
-
point
|
|
75
|
-
lngLats
|
|
76
|
-
lngLat
|
|
77
|
-
originalEvent
|
|
25
|
+
const lngLat = map.unproject(point);
|
|
26
|
+
super(type, {
|
|
27
|
+
points,
|
|
28
|
+
point,
|
|
29
|
+
lngLats,
|
|
30
|
+
lngLat,
|
|
31
|
+
originalEvent
|
|
78
32
|
});
|
|
79
|
-
|
|
80
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The event type.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* The `Map` object that fired the event.
|
|
38
|
+
*/
|
|
39
|
+
(0, _defineProperty2.default)(this, "target", void 0);
|
|
40
|
+
/**
|
|
41
|
+
* The DOM event which caused the map event.
|
|
42
|
+
*/
|
|
43
|
+
(0, _defineProperty2.default)(this, "originalEvent", void 0);
|
|
44
|
+
/**
|
|
45
|
+
* The geographic location on the map of the center of the touch event points.
|
|
46
|
+
*/
|
|
47
|
+
(0, _defineProperty2.default)(this, "lngLat", void 0);
|
|
48
|
+
/**
|
|
49
|
+
* The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left
|
|
50
|
+
* corner.
|
|
51
|
+
*/
|
|
52
|
+
(0, _defineProperty2.default)(this, "point", void 0);
|
|
53
|
+
/**
|
|
54
|
+
* The array of pixel coordinates corresponding to a
|
|
55
|
+
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
56
|
+
*/
|
|
57
|
+
(0, _defineProperty2.default)(this, "points", void 0);
|
|
58
|
+
/**
|
|
59
|
+
* The geographical locations on the map corresponding to a
|
|
60
|
+
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
61
|
+
*/
|
|
62
|
+
(0, _defineProperty2.default)(this, "lngLats", void 0);
|
|
63
|
+
/**
|
|
64
|
+
* `true` if `preventDefault` has been called.
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
(0, _defineProperty2.default)(this, "defaultPrevented", void 0);
|
|
68
|
+
this.defaultPrevented = false;
|
|
81
69
|
}
|
|
82
70
|
|
|
83
71
|
/**
|
|
@@ -89,11 +77,8 @@ var MapTouchEvent = exports.default = /*#__PURE__*/function (_Event) {
|
|
|
89
77
|
* * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}
|
|
90
78
|
*
|
|
91
79
|
*/
|
|
92
|
-
(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}]);
|
|
98
|
-
return MapTouchEvent;
|
|
99
|
-
}(_event.Event);
|
|
80
|
+
preventDefault() {
|
|
81
|
+
this.defaultPrevented = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.default = MapTouchEvent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { EarthMap } from '../../earthmap';
|
|
2
|
+
import type { 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
|
+
}
|
|
@@ -5,40 +5,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
9
|
var _event = require("./event");
|
|
14
|
-
|
|
15
|
-
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; } }
|
|
16
|
-
var MapWheelEvent = exports.default = /*#__PURE__*/function (_Event) {
|
|
17
|
-
(0, _inherits2.default)(MapWheelEvent, _Event);
|
|
18
|
-
var _super = _createSuper(MapWheelEvent);
|
|
19
|
-
/**
|
|
20
|
-
* The event type.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The DOM event which caused the map event.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The `Map` object that fired the event.
|
|
29
|
-
*/
|
|
30
|
-
|
|
10
|
+
class MapWheelEvent extends _event.Event {
|
|
31
11
|
/**
|
|
32
12
|
* @private
|
|
33
13
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
_this = _super.call(this, type, {
|
|
38
|
-
originalEvent: originalEvent
|
|
14
|
+
constructor(type, map, originalEvent) {
|
|
15
|
+
super(type, {
|
|
16
|
+
originalEvent
|
|
39
17
|
});
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The event type.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The DOM event which caused the map event.
|
|
23
|
+
*/
|
|
24
|
+
(0, _defineProperty2.default)(this, "originalEvent", void 0);
|
|
25
|
+
(0, _defineProperty2.default)(this, "defaultPrevented", void 0);
|
|
26
|
+
/**
|
|
27
|
+
* The `Map` object that fired the event.
|
|
28
|
+
*/
|
|
29
|
+
(0, _defineProperty2.default)(this, "target", void 0);
|
|
30
|
+
this.defaultPrevented = false;
|
|
42
31
|
}
|
|
43
32
|
|
|
44
33
|
/**
|
|
@@ -46,11 +35,8 @@ var MapWheelEvent = exports.default = /*#__PURE__*/function (_Event) {
|
|
|
46
35
|
*
|
|
47
36
|
* Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.
|
|
48
37
|
*/
|
|
49
|
-
(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}]);
|
|
55
|
-
return MapWheelEvent;
|
|
56
|
-
}(_event.Event);
|
|
38
|
+
preventDefault() {
|
|
39
|
+
this.defaultPrevented = true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = MapWheelEvent;
|
|
@@ -5,28 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
9
|
var _event = require("./event");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function RenderFrameEvent() {
|
|
22
|
-
var _this;
|
|
23
|
-
(0, _classCallCheck2.default)(this, RenderFrameEvent);
|
|
24
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
-
args[_key] = arguments[_key];
|
|
26
|
-
}
|
|
27
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
28
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'renderFrame');
|
|
29
|
-
return _this;
|
|
10
|
+
class RenderFrameEvent extends _event.Event {
|
|
11
|
+
constructor(...args) {
|
|
12
|
+
super(...args);
|
|
13
|
+
(0, _defineProperty2.default)(this, "type", 'renderFrame');
|
|
14
|
+
(0, _defineProperty2.default)(this, "timeStamp", void 0);
|
|
30
15
|
}
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
}
|
|
17
|
+
exports.default = RenderFrameEvent;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EarthMap } from '../earthmap';
|
|
2
|
+
import type { Map } from '../map';
|
|
3
|
+
import type { 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 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
|
+
}
|