@antv/l7-map 2.17.12 → 2.18.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/package.json +4 -4
- package/es/camera.d.ts +0 -85
- package/es/camera.js +0 -775
- package/es/css/l7.css +0 -98
- package/es/earthmap.d.ts +0 -66
- package/es/earthmap.js +0 -422
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -118
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -81
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -167
- package/es/geo/mercator.d.ts +0 -29
- package/es/geo/mercator.js +0 -92
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -231
- package/es/geo/simple.d.ts +0 -29
- package/es/geo/simple.js +0 -92
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -971
- package/es/handler/IHandler.d.ts +0 -34
- package/es/handler/IHandler.js +0 -1
- package/es/handler/blockable_map_event.d.ts +0 -17
- package/es/handler/blockable_map_event.js +0 -83
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -200
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -59
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -12
- package/es/handler/events/index.d.ts +0 -4
- package/es/handler/events/index.js +0 -4
- package/es/handler/events/map_mouse_event.d.ts +0 -34
- package/es/handler/events/map_mouse_event.js +0 -75
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -105
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -61
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -39
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -184
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -684
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -10
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -162
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -131
- package/es/handler/mouse/index.d.ts +0 -4
- package/es/handler/mouse/index.js +0 -4
- package/es/handler/mouse/mouse_handler.d.ts +0 -22
- package/es/handler/mouse/mouse_handler.js +0 -131
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -54
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -56
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -56
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -12
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -353
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -72
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -96
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -80
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -130
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -120
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -114
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -62
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -115
- package/es/handler/touch/index.d.ts +0 -5
- package/es/handler/touch/index.js +0 -5
- package/es/handler/touch/touch_pan.d.ts +0 -30
- package/es/handler/touch/touch_pan.js +0 -128
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -110
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -88
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -67
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -138
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -156
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -4
- package/es/interface.d.ts +0 -34
- package/es/interface.js +0 -1
- package/es/map.d.ts +0 -70
- package/es/map.js +0 -464
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -101
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -133
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -218
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -62
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -45
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -106
- package/lib/camera.js +0 -801
- package/lib/css/l7.css +0 -98
- package/lib/earthmap.js +0 -445
- package/lib/geo/edge_insets.js +0 -129
- package/lib/geo/lng_lat.js +0 -94
- package/lib/geo/lng_lat_bounds.js +0 -177
- package/lib/geo/mercator.js +0 -121
- package/lib/geo/point.js +0 -239
- package/lib/geo/simple.js +0 -123
- package/lib/geo/transform.js +0 -1013
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.js +0 -92
- package/lib/handler/box_zoom.js +0 -217
- package/lib/handler/click_zoom.js +0 -67
- package/lib/handler/events/event.js +0 -23
- package/lib/handler/events/index.js +0 -31
- package/lib/handler/events/map_mouse_event.js +0 -87
- package/lib/handler/events/map_touch_event.js +0 -119
- package/lib/handler/events/map_wheel_event.js +0 -72
- package/lib/handler/events/render_event.js +0 -52
- package/lib/handler/handler_inertia.js +0 -193
- package/lib/handler/handler_manager.js +0 -714
- package/lib/handler/handler_util.js +0 -17
- package/lib/handler/keyboard.js +0 -172
- package/lib/handler/map_event.js +0 -140
- package/lib/handler/mouse/index.js +0 -31
- package/lib/handler/mouse/mouse_handler.js +0 -141
- package/lib/handler/mouse/mousepan_handler.js +0 -66
- package/lib/handler/mouse/mousepitch_hander.js +0 -67
- package/lib/handler/mouse/mouserotate_hander.js +0 -67
- package/lib/handler/mouse/util.js +0 -26
- package/lib/handler/scroll_zoom.js +0 -367
- package/lib/handler/shim/dblclick_zoom.js +0 -80
- package/lib/handler/shim/drag_pan.js +0 -105
- package/lib/handler/shim/drag_rotate.js +0 -88
- package/lib/handler/shim/touch_zoom_rotate.js +0 -139
- package/lib/handler/tap/single_tap_recognizer.js +0 -131
- package/lib/handler/tap/tap_drag_zoom.js +0 -124
- package/lib/handler/tap/tap_recognizer.js +0 -78
- package/lib/handler/tap/tap_zoom.js +0 -124
- package/lib/handler/touch/index.js +0 -39
- package/lib/handler/touch/touch_pan.js +0 -138
- package/lib/handler/touch/touch_pitch.js +0 -120
- package/lib/handler/touch/touch_rotate.js +0 -99
- package/lib/handler/touch/touch_zoom.js +0 -78
- package/lib/handler/touch/two_touch.js +0 -148
- package/lib/hash.js +0 -169
- package/lib/index.js +0 -57
- package/lib/interface.js +0 -5
- package/lib/map.js +0 -489
- package/lib/util.js +0 -135
- package/lib/utils/Aabb.js +0 -143
- package/lib/utils/dom.js +0 -233
- package/lib/utils/performance.js +0 -72
- package/lib/utils/primitives.js +0 -57
- package/lib/utils/task_queue.js +0 -115
package/es/handler/IHandler.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { EarthMap } from '../earthmap';
|
|
2
|
-
import Point from '../geo/point';
|
|
3
|
-
import { Map } from '../map';
|
|
4
|
-
export interface IHandlerResult {
|
|
5
|
-
panDelta?: Point;
|
|
6
|
-
zoomDelta?: number;
|
|
7
|
-
bearingDelta?: number;
|
|
8
|
-
pitchDelta?: number;
|
|
9
|
-
around?: Point | null;
|
|
10
|
-
pinchAround?: Point | null;
|
|
11
|
-
cameraAnimation?: (map: Map | EarthMap) => any;
|
|
12
|
-
originalEvent?: any;
|
|
13
|
-
needsRenderFrame?: boolean;
|
|
14
|
-
noInertia?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface IHandler {
|
|
17
|
-
touchstart?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => IHandlerResult | void;
|
|
18
|
-
touchmove?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => IHandlerResult | void;
|
|
19
|
-
touchend?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => IHandlerResult | void;
|
|
20
|
-
touchcancel?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => IHandlerResult | void;
|
|
21
|
-
mousedown?: (e: MouseEvent, point: Point) => IHandlerResult | void;
|
|
22
|
-
mousemove?: (e: MouseEvent, point: Point) => IHandlerResult | void;
|
|
23
|
-
mouseup?: (e: MouseEvent, point: Point) => IHandlerResult | void;
|
|
24
|
-
dblclick?: (e: MouseEvent, point: Point) => IHandlerResult | void;
|
|
25
|
-
wheel?: (e: WheelEvent, point: Point) => IHandlerResult | void;
|
|
26
|
-
keydown?: (e: KeyboardEvent) => IHandlerResult | void;
|
|
27
|
-
keyup?: (e: KeyboardEvent) => IHandlerResult | void;
|
|
28
|
-
renderFrame?: () => IHandlerResult | void;
|
|
29
|
-
enable(options?: any): void;
|
|
30
|
-
disable(): void;
|
|
31
|
-
isEnabled(): boolean;
|
|
32
|
-
isActive(): boolean;
|
|
33
|
-
reset(): void;
|
|
34
|
-
}
|
package/es/handler/IHandler.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EarthMap } from '../earthmap';
|
|
2
|
-
import { Map } from '../map';
|
|
3
|
-
export default class BlockableMapEventHandler {
|
|
4
|
-
private map;
|
|
5
|
-
private delayContextMenu;
|
|
6
|
-
private contextMenuEvent;
|
|
7
|
-
constructor(map: Map | EarthMap);
|
|
8
|
-
reset(): void;
|
|
9
|
-
mousemove(e: MouseEvent): void;
|
|
10
|
-
mousedown(): void;
|
|
11
|
-
mouseup(): void;
|
|
12
|
-
contextmenu(e: MouseEvent): void;
|
|
13
|
-
isEnabled(): boolean;
|
|
14
|
-
isActive(): boolean;
|
|
15
|
-
enable(): boolean;
|
|
16
|
-
disable(): boolean;
|
|
17
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import { MapMouseEvent } from "./events";
|
|
5
|
-
|
|
6
|
-
var BlockableMapEventHandler = /*#__PURE__*/function () {
|
|
7
|
-
function BlockableMapEventHandler(map) {
|
|
8
|
-
_classCallCheck(this, BlockableMapEventHandler);
|
|
9
|
-
|
|
10
|
-
this.map = map;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
_createClass(BlockableMapEventHandler, [{
|
|
14
|
-
key: "reset",
|
|
15
|
-
value: function reset() {
|
|
16
|
-
this.delayContextMenu = false; // @ts-ignore
|
|
17
|
-
|
|
18
|
-
delete this.contextMenuEvent;
|
|
19
|
-
}
|
|
20
|
-
}, {
|
|
21
|
-
key: "mousemove",
|
|
22
|
-
value: function mousemove(e) {
|
|
23
|
-
// mousemove map events should not be fired when interaction handlers (pan, rotate, etc) are active
|
|
24
|
-
this.map.emit(e.type, new MapMouseEvent(e.type, this.map, e));
|
|
25
|
-
}
|
|
26
|
-
}, {
|
|
27
|
-
key: "mousedown",
|
|
28
|
-
value: function mousedown() {
|
|
29
|
-
this.delayContextMenu = true;
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "mouseup",
|
|
33
|
-
value: function mouseup() {
|
|
34
|
-
this.delayContextMenu = false;
|
|
35
|
-
|
|
36
|
-
if (this.contextMenuEvent) {
|
|
37
|
-
this.map.emit('contextmenu', new MapMouseEvent('contextmenu', this.map, this.contextMenuEvent)); // @ts-ignore
|
|
38
|
-
|
|
39
|
-
delete this.contextMenuEvent;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "contextmenu",
|
|
44
|
-
value: function contextmenu(e) {
|
|
45
|
-
if (this.delayContextMenu) {
|
|
46
|
-
// Mac: contextmenu fired on mousedown; we save it until mouseup for consistency's sake
|
|
47
|
-
this.contextMenuEvent = e;
|
|
48
|
-
} else {
|
|
49
|
-
// Windows: contextmenu fired on mouseup, so fire event now
|
|
50
|
-
this.map.emit(e.type, new MapMouseEvent(e.type, this.map, e));
|
|
51
|
-
} // prevent browser context menu when necessary
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (this.map.listeners('contextmenu')) {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "isEnabled",
|
|
60
|
-
value: function isEnabled() {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "isActive",
|
|
65
|
-
value: function isActive() {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "enable",
|
|
70
|
-
value: function enable() {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "disable",
|
|
75
|
-
value: function disable() {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
}]);
|
|
79
|
-
|
|
80
|
-
return BlockableMapEventHandler;
|
|
81
|
-
}();
|
|
82
|
-
|
|
83
|
-
export { BlockableMapEventHandler as default };
|
package/es/handler/box_zoom.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { EarthMap } from '../earthmap';
|
|
2
|
-
import Point from '../geo/point';
|
|
3
|
-
import { Map } from '../map';
|
|
4
|
-
/**
|
|
5
|
-
* The `BoxZoomHandler` allows the user to zoom the map to fit within a bounding box.
|
|
6
|
-
* The bounding box is defined by clicking and holding `shift` while dragging the cursor.
|
|
7
|
-
*/
|
|
8
|
-
declare class BoxZoomHandler {
|
|
9
|
-
private map;
|
|
10
|
-
private el;
|
|
11
|
-
private container;
|
|
12
|
-
private enabled;
|
|
13
|
-
private active;
|
|
14
|
-
private startPos;
|
|
15
|
-
private lastPos;
|
|
16
|
-
private box;
|
|
17
|
-
private clickTolerance;
|
|
18
|
-
/**
|
|
19
|
-
* @private
|
|
20
|
-
*/
|
|
21
|
-
constructor(map: Map | EarthMap, options: {
|
|
22
|
-
clickTolerance: number;
|
|
23
|
-
});
|
|
24
|
-
/**
|
|
25
|
-
* Returns a Boolean indicating whether the "box zoom" interaction is enabled.
|
|
26
|
-
*
|
|
27
|
-
* @returns {boolean} `true` if the "box zoom" interaction is enabled.
|
|
28
|
-
*/
|
|
29
|
-
isEnabled(): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Returns a Boolean indicating whether the "box zoom" interaction is active, i.e. currently being used.
|
|
32
|
-
*
|
|
33
|
-
* @returns {boolean} `true` if the "box zoom" interaction is active.
|
|
34
|
-
*/
|
|
35
|
-
isActive(): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Enables the "box zoom" interaction.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* map.boxZoom.enable();
|
|
41
|
-
*/
|
|
42
|
-
enable(): void;
|
|
43
|
-
/**
|
|
44
|
-
* Disables the "box zoom" interaction.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* map.boxZoom.disable();
|
|
48
|
-
*/
|
|
49
|
-
disable(): void;
|
|
50
|
-
mousedown(e: MouseEvent, point: Point): void;
|
|
51
|
-
mousemoveWindow(e: MouseEvent, point: Point): void;
|
|
52
|
-
mouseupWindow(e: MouseEvent, point: Point): {
|
|
53
|
-
cameraAnimation: (map: Map) => boolean | Map;
|
|
54
|
-
} | undefined;
|
|
55
|
-
keydown(e: KeyboardEvent): void;
|
|
56
|
-
reset(): void;
|
|
57
|
-
fireEvent(type: string, e: any): boolean;
|
|
58
|
-
}
|
|
59
|
-
export default BoxZoomHandler;
|
package/es/handler/box_zoom.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import DOM from "../utils/dom";
|
|
5
|
-
import { Event } from "./events/event";
|
|
6
|
-
/**
|
|
7
|
-
* The `BoxZoomHandler` allows the user to zoom the map to fit within a bounding box.
|
|
8
|
-
* The bounding box is defined by clicking and holding `shift` while dragging the cursor.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
var BoxZoomHandler = /*#__PURE__*/function () {
|
|
12
|
-
/**
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
function BoxZoomHandler(map, options) {
|
|
16
|
-
_classCallCheck(this, BoxZoomHandler);
|
|
17
|
-
|
|
18
|
-
this.map = map;
|
|
19
|
-
this.el = map.getCanvasContainer();
|
|
20
|
-
this.container = map.getContainer();
|
|
21
|
-
this.clickTolerance = options.clickTolerance || 1;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Returns a Boolean indicating whether the "box zoom" interaction is enabled.
|
|
25
|
-
*
|
|
26
|
-
* @returns {boolean} `true` if the "box zoom" interaction is enabled.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_createClass(BoxZoomHandler, [{
|
|
31
|
-
key: "isEnabled",
|
|
32
|
-
value: function isEnabled() {
|
|
33
|
-
return !!this.enabled;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Returns a Boolean indicating whether the "box zoom" interaction is active, i.e. currently being used.
|
|
37
|
-
*
|
|
38
|
-
* @returns {boolean} `true` if the "box zoom" interaction is active.
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
}, {
|
|
42
|
-
key: "isActive",
|
|
43
|
-
value: function isActive() {
|
|
44
|
-
return !!this.active;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Enables the "box zoom" interaction.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* map.boxZoom.enable();
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
}, {
|
|
54
|
-
key: "enable",
|
|
55
|
-
value: function enable() {
|
|
56
|
-
if (this.isEnabled()) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this.enabled = true;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Disables the "box zoom" interaction.
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* map.boxZoom.disable();
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
}, {
|
|
70
|
-
key: "disable",
|
|
71
|
-
value: function disable() {
|
|
72
|
-
if (!this.isEnabled()) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
this.enabled = false;
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "mousedown",
|
|
80
|
-
value: function mousedown(e, point) {
|
|
81
|
-
if (!this.isEnabled()) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (!(e.shiftKey && e.button === 0)) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
DOM.disableDrag();
|
|
90
|
-
this.startPos = this.lastPos = point;
|
|
91
|
-
this.active = true;
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
key: "mousemoveWindow",
|
|
95
|
-
value: function mousemoveWindow(e, point) {
|
|
96
|
-
if (!this.active) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var pos = point;
|
|
101
|
-
|
|
102
|
-
if (this.lastPos.equals(pos) || !this.box && pos.dist(this.startPos) < this.clickTolerance) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
var p0 = this.startPos;
|
|
107
|
-
this.lastPos = pos;
|
|
108
|
-
|
|
109
|
-
if (!this.box) {
|
|
110
|
-
this.box = DOM.create('div', 'l7-boxzoom', this.container);
|
|
111
|
-
this.container.classList.add('l7-crosshair');
|
|
112
|
-
this.fireEvent('boxzoomstart', e);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
var minX = Math.min(p0.x, pos.x);
|
|
116
|
-
var maxX = Math.max(p0.x, pos.x);
|
|
117
|
-
var minY = Math.min(p0.y, pos.y);
|
|
118
|
-
var maxY = Math.max(p0.y, pos.y);
|
|
119
|
-
DOM.setTransform(this.box, "translate(".concat(minX, "px,").concat(minY, "px)"));
|
|
120
|
-
|
|
121
|
-
if (this.box) {
|
|
122
|
-
this.box.style.width = "".concat(maxX - minX, "px");
|
|
123
|
-
this.box.style.height = "".concat(maxY - minY, "px");
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}, {
|
|
127
|
-
key: "mouseupWindow",
|
|
128
|
-
value: function mouseupWindow(e, point) {
|
|
129
|
-
var _this = this;
|
|
130
|
-
|
|
131
|
-
if (!this.active) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (e.button !== 0) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
var p0 = this.startPos;
|
|
140
|
-
var p1 = point;
|
|
141
|
-
this.reset();
|
|
142
|
-
DOM.suppressClick();
|
|
143
|
-
|
|
144
|
-
if (p0.x === p1.x && p0.y === p1.y) {
|
|
145
|
-
this.fireEvent('boxzoomcancel', e);
|
|
146
|
-
} else {
|
|
147
|
-
this.map.emit('boxzoomend', new Event('boxzoomend', {
|
|
148
|
-
originalEvent: e
|
|
149
|
-
}));
|
|
150
|
-
return {
|
|
151
|
-
cameraAnimation: function cameraAnimation(map) {
|
|
152
|
-
return map.fitScreenCoordinates(p0, p1, _this.map.getBearing(), {
|
|
153
|
-
linear: true
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}, {
|
|
160
|
-
key: "keydown",
|
|
161
|
-
value: function keydown(e) {
|
|
162
|
-
if (!this.active) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (e.keyCode === 27) {
|
|
167
|
-
this.reset();
|
|
168
|
-
this.fireEvent('boxzoomcancel', e);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}, {
|
|
172
|
-
key: "reset",
|
|
173
|
-
value: function reset() {
|
|
174
|
-
this.active = false;
|
|
175
|
-
this.container.classList.remove('l7-crosshair');
|
|
176
|
-
|
|
177
|
-
if (this.box) {
|
|
178
|
-
DOM.remove(this.box);
|
|
179
|
-
this.box = null;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
DOM.enableDrag(); // @ts-ignore
|
|
183
|
-
|
|
184
|
-
delete this.startPos; // @ts-ignore
|
|
185
|
-
|
|
186
|
-
delete this.lastPos;
|
|
187
|
-
}
|
|
188
|
-
}, {
|
|
189
|
-
key: "fireEvent",
|
|
190
|
-
value: function fireEvent(type, e) {
|
|
191
|
-
return this.map.emit(type, new Event(type, {
|
|
192
|
-
originalEvent: e
|
|
193
|
-
}));
|
|
194
|
-
}
|
|
195
|
-
}]);
|
|
196
|
-
|
|
197
|
-
return BoxZoomHandler;
|
|
198
|
-
}();
|
|
199
|
-
|
|
200
|
-
export default BoxZoomHandler;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { EarthMap } from '../earthmap';
|
|
2
|
-
import Point from '../geo/point';
|
|
3
|
-
import { Map } from '../map';
|
|
4
|
-
export default class ClickZoomHandler {
|
|
5
|
-
private enabled;
|
|
6
|
-
private active;
|
|
7
|
-
constructor();
|
|
8
|
-
reset(): void;
|
|
9
|
-
dblclick(e: MouseEvent, point: Point): {
|
|
10
|
-
cameraAnimation: (map: Map | EarthMap) => void;
|
|
11
|
-
};
|
|
12
|
-
enable(): void;
|
|
13
|
-
disable(): void;
|
|
14
|
-
isEnabled(): boolean;
|
|
15
|
-
isActive(): boolean;
|
|
16
|
-
}
|
package/es/handler/click_zoom.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
var ClickZoomHandler = /*#__PURE__*/function () {
|
|
6
|
-
function ClickZoomHandler() {
|
|
7
|
-
_classCallCheck(this, ClickZoomHandler);
|
|
8
|
-
|
|
9
|
-
this.reset();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
_createClass(ClickZoomHandler, [{
|
|
13
|
-
key: "reset",
|
|
14
|
-
value: function reset() {
|
|
15
|
-
this.active = false;
|
|
16
|
-
}
|
|
17
|
-
}, {
|
|
18
|
-
key: "dblclick",
|
|
19
|
-
value: function dblclick(e, point) {
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
return {
|
|
22
|
-
cameraAnimation: function cameraAnimation(map) {
|
|
23
|
-
map.easeTo({
|
|
24
|
-
duration: 300,
|
|
25
|
-
zoom: map.getZoom() + (e.shiftKey ? -1 : 1),
|
|
26
|
-
around: map.unproject(point)
|
|
27
|
-
}, {
|
|
28
|
-
originalEvent: e
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}, {
|
|
34
|
-
key: "enable",
|
|
35
|
-
value: function enable() {
|
|
36
|
-
this.enabled = true;
|
|
37
|
-
}
|
|
38
|
-
}, {
|
|
39
|
-
key: "disable",
|
|
40
|
-
value: function disable() {
|
|
41
|
-
this.enabled = false;
|
|
42
|
-
this.reset();
|
|
43
|
-
}
|
|
44
|
-
}, {
|
|
45
|
-
key: "isEnabled",
|
|
46
|
-
value: function isEnabled() {
|
|
47
|
-
return this.enabled;
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "isActive",
|
|
51
|
-
value: function isActive() {
|
|
52
|
-
return this.active;
|
|
53
|
-
}
|
|
54
|
-
}]);
|
|
55
|
-
|
|
56
|
-
return ClickZoomHandler;
|
|
57
|
-
}();
|
|
58
|
-
|
|
59
|
-
export { ClickZoomHandler as default };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
// tslint:disable-next-line:no-submodule-imports
|
|
4
|
-
import merge from 'lodash/merge';
|
|
5
|
-
export var Event = /*#__PURE__*/_createClass(function Event(type) {
|
|
6
|
-
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7
|
-
|
|
8
|
-
_classCallCheck(this, Event);
|
|
9
|
-
|
|
10
|
-
merge(this, data);
|
|
11
|
-
this.type = type;
|
|
12
|
-
});
|
|
@@ -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,75 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
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); }; }
|
|
8
|
-
|
|
9
|
-
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; } }
|
|
10
|
-
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
// tslint:disable-next-line:no-submodule-imports
|
|
13
|
-
import merge from 'lodash/merge';
|
|
14
|
-
import DOM from "../../utils/dom";
|
|
15
|
-
import { Event } from "./event";
|
|
16
|
-
|
|
17
|
-
var MapMouseEvent = /*#__PURE__*/function (_Event) {
|
|
18
|
-
_inherits(MapMouseEvent, _Event);
|
|
19
|
-
|
|
20
|
-
var _super = _createSuper(MapMouseEvent);
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* `true` if `preventDefault` has been called.
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The `Map` object that fired the event.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The DOM event which caused the map event.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The geographic location on the map of the mouse cursor.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
function MapMouseEvent(type, map, originalEvent) {
|
|
47
|
-
var _this;
|
|
48
|
-
|
|
49
|
-
var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
50
|
-
|
|
51
|
-
_classCallCheck(this, MapMouseEvent);
|
|
52
|
-
|
|
53
|
-
var point = DOM.mousePos(map.getCanvasContainer(), originalEvent);
|
|
54
|
-
var lngLat = map.unproject(point);
|
|
55
|
-
_this = _super.call(this, type, merge({
|
|
56
|
-
point: point,
|
|
57
|
-
lngLat: lngLat,
|
|
58
|
-
originalEvent: originalEvent
|
|
59
|
-
}, data));
|
|
60
|
-
_this.defaultPrevented = false;
|
|
61
|
-
_this.target = map;
|
|
62
|
-
return _this;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
_createClass(MapMouseEvent, [{
|
|
66
|
-
key: "preventDefault",
|
|
67
|
-
value: function preventDefault() {
|
|
68
|
-
this.defaultPrevented = true;
|
|
69
|
-
}
|
|
70
|
-
}]);
|
|
71
|
-
|
|
72
|
-
return MapMouseEvent;
|
|
73
|
-
}(Event);
|
|
74
|
-
|
|
75
|
-
export { MapMouseEvent as default };
|
|
@@ -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
|
-
}
|