@antv/l7-map 2.17.10 → 2.17.12
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 +148 -90
- package/es/earthmap.js +65 -13
- package/es/geo/edge_insets.js +14 -4
- package/es/geo/lng_lat.js +13 -5
- package/es/geo/lng_lat_bounds.js +17 -4
- package/es/geo/mercator.js +10 -2
- package/es/geo/point.js +7 -0
- package/es/geo/simple.js +11 -6
- package/es/geo/transform.js +132 -127
- package/es/handler/blockable_map_event.js +12 -7
- package/es/handler/box_zoom.js +30 -10
- package/es/handler/click_zoom.js +5 -0
- package/es/handler/events/event.js +2 -0
- package/es/handler/events/map_mouse_event.js +12 -0
- package/es/handler/events/map_touch_event.js +12 -2
- package/es/handler/events/map_wheel_event.js +12 -1
- package/es/handler/events/render_event.js +13 -0
- package/es/handler/handler_inertia.js +34 -6
- package/es/handler/handler_manager.js +147 -55
- package/es/handler/handler_util.js +2 -1
- package/es/handler/keyboard.js +20 -1
- package/es/handler/map_event.js +9 -3
- package/es/handler/mouse/mouse_handler.js +24 -11
- package/es/handler/mouse/mousepan_handler.js +11 -1
- package/es/handler/mouse/mousepitch_hander.js +11 -1
- package/es/handler/mouse/mouserotate_hander.js +11 -1
- package/es/handler/mouse/util.js +3 -2
- package/es/handler/scroll_zoom.js +71 -43
- package/es/handler/shim/dblclick_zoom.js +9 -4
- package/es/handler/shim/drag_pan.js +11 -4
- package/es/handler/shim/drag_rotate.js +10 -4
- package/es/handler/shim/touch_zoom_rotate.js +16 -6
- package/es/handler/tap/single_tap_recognizer.js +31 -8
- package/es/handler/tap/tap_drag_zoom.js +15 -7
- package/es/handler/tap/tap_recognizer.js +11 -3
- package/es/handler/tap/tap_zoom.js +7 -1
- package/es/handler/touch/touch_pan.js +22 -4
- package/es/handler/touch/touch_pitch.js +27 -10
- package/es/handler/touch/touch_rotate.js +19 -8
- package/es/handler/touch/touch_zoom.js +18 -5
- package/es/handler/touch/two_touch.js +32 -19
- package/es/hash.js +31 -9
- package/es/map.js +78 -16
- package/es/util.js +26 -18
- package/es/utils/Aabb.js +31 -10
- package/es/utils/dom.js +58 -24
- package/es/utils/performance.js +7 -8
- package/es/utils/primitives.js +11 -13
- package/es/utils/task_queue.js +23 -6
- package/lib/camera.js +169 -91
- package/lib/earthmap.js +80 -12
- package/lib/geo/edge_insets.js +18 -3
- package/lib/geo/lng_lat.js +18 -5
- package/lib/geo/lng_lat_bounds.js +20 -4
- package/lib/geo/mercator.js +22 -1
- package/lib/geo/point.js +8 -0
- package/lib/geo/simple.js +24 -5
- package/lib/geo/transform.js +164 -127
- package/lib/handler/blockable_map_event.js +14 -6
- package/lib/handler/box_zoom.js +39 -8
- package/lib/handler/click_zoom.js +6 -0
- package/lib/handler/events/event.js +5 -0
- package/lib/handler/events/index.js +4 -0
- package/lib/handler/events/map_mouse_event.js +20 -2
- package/lib/handler/events/map_touch_event.js +21 -2
- package/lib/handler/events/map_wheel_event.js +16 -1
- package/lib/handler/events/render_event.js +19 -0
- package/lib/handler/handler_inertia.js +37 -5
- package/lib/handler/handler_manager.js +171 -56
- package/lib/handler/handler_util.js +3 -1
- package/lib/handler/keyboard.js +22 -1
- package/lib/handler/map_event.js +11 -2
- package/lib/handler/mouse/index.js +4 -0
- package/lib/handler/mouse/mouse_handler.js +27 -10
- package/lib/handler/mouse/mousepan_handler.js +18 -1
- package/lib/handler/mouse/mousepitch_hander.js +17 -1
- package/lib/handler/mouse/mouserotate_hander.js +17 -1
- package/lib/handler/mouse/util.js +6 -2
- package/lib/handler/scroll_zoom.js +77 -43
- package/lib/handler/shim/dblclick_zoom.js +10 -4
- package/lib/handler/shim/drag_pan.js +13 -4
- package/lib/handler/shim/drag_rotate.js +11 -4
- package/lib/handler/shim/touch_zoom_rotate.js +18 -6
- package/lib/handler/tap/single_tap_recognizer.js +33 -8
- package/lib/handler/tap/tap_drag_zoom.js +18 -6
- package/lib/handler/tap/tap_recognizer.js +17 -2
- package/lib/handler/tap/tap_zoom.js +9 -0
- package/lib/handler/touch/index.js +5 -0
- package/lib/handler/touch/touch_pan.js +25 -4
- package/lib/handler/touch/touch_pitch.js +32 -10
- package/lib/handler/touch/touch_rotate.js +25 -8
- package/lib/handler/touch/touch_zoom.js +24 -5
- package/lib/handler/touch/two_touch.js +35 -18
- package/lib/hash.js +35 -8
- package/lib/index.js +8 -0
- package/lib/map.js +95 -15
- package/lib/util.js +38 -16
- package/lib/utils/Aabb.js +34 -10
- package/lib/utils/dom.js +64 -22
- package/lib/utils/performance.js +9 -8
- package/lib/utils/primitives.js +16 -13
- package/lib/utils/task_queue.js +24 -6
- package/package.json +3 -3
package/es/handler/keyboard.js
CHANGED
|
@@ -5,7 +5,6 @@ var defaultOptions = {
|
|
|
5
5
|
bearingStep: 15,
|
|
6
6
|
pitchStep: 10
|
|
7
7
|
};
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* The `KeyboardHandler` allows the user to zoom, rotate, and pan the map using
|
|
11
10
|
* the following keyboard shortcuts:
|
|
@@ -20,17 +19,20 @@ var defaultOptions = {
|
|
|
20
19
|
* - `Shift+⇡`: Increase the pitch by 10 degrees.
|
|
21
20
|
* - `Shift+⇣`: Decrease the pitch by 10 degrees.
|
|
22
21
|
*/
|
|
22
|
+
|
|
23
23
|
var KeyboardHandler = /*#__PURE__*/function () {
|
|
24
24
|
/**
|
|
25
25
|
* @private
|
|
26
26
|
*/
|
|
27
27
|
function KeyboardHandler() {
|
|
28
28
|
_classCallCheck(this, KeyboardHandler);
|
|
29
|
+
|
|
29
30
|
var stepOptions = defaultOptions;
|
|
30
31
|
this.panStep = stepOptions.panStep;
|
|
31
32
|
this.bearingStep = stepOptions.bearingStep;
|
|
32
33
|
this.pitchStep = stepOptions.pitchStep;
|
|
33
34
|
}
|
|
35
|
+
|
|
34
36
|
_createClass(KeyboardHandler, [{
|
|
35
37
|
key: "reset",
|
|
36
38
|
value: function reset() {
|
|
@@ -40,14 +42,17 @@ var KeyboardHandler = /*#__PURE__*/function () {
|
|
|
40
42
|
key: "keydown",
|
|
41
43
|
value: function keydown(e) {
|
|
42
44
|
var _this = this;
|
|
45
|
+
|
|
43
46
|
if (e.altKey || e.ctrlKey || e.metaKey) {
|
|
44
47
|
return;
|
|
45
48
|
}
|
|
49
|
+
|
|
46
50
|
var zoomDir = 0;
|
|
47
51
|
var bearingDir = 0;
|
|
48
52
|
var pitchDir = 0;
|
|
49
53
|
var xDir = 0;
|
|
50
54
|
var yDir = 0;
|
|
55
|
+
|
|
51
56
|
switch (e.keyCode) {
|
|
52
57
|
case 61:
|
|
53
58
|
case 107:
|
|
@@ -55,11 +60,13 @@ var KeyboardHandler = /*#__PURE__*/function () {
|
|
|
55
60
|
case 187:
|
|
56
61
|
zoomDir = 1;
|
|
57
62
|
break;
|
|
63
|
+
|
|
58
64
|
case 189:
|
|
59
65
|
case 109:
|
|
60
66
|
case 173:
|
|
61
67
|
zoomDir = -1;
|
|
62
68
|
break;
|
|
69
|
+
|
|
63
70
|
case 37:
|
|
64
71
|
if (e.shiftKey) {
|
|
65
72
|
bearingDir = -1;
|
|
@@ -67,7 +74,9 @@ var KeyboardHandler = /*#__PURE__*/function () {
|
|
|
67
74
|
e.preventDefault();
|
|
68
75
|
xDir = -1;
|
|
69
76
|
}
|
|
77
|
+
|
|
70
78
|
break;
|
|
79
|
+
|
|
71
80
|
case 39:
|
|
72
81
|
if (e.shiftKey) {
|
|
73
82
|
bearingDir = 1;
|
|
@@ -75,7 +84,9 @@ var KeyboardHandler = /*#__PURE__*/function () {
|
|
|
75
84
|
e.preventDefault();
|
|
76
85
|
xDir = 1;
|
|
77
86
|
}
|
|
87
|
+
|
|
78
88
|
break;
|
|
89
|
+
|
|
79
90
|
case 38:
|
|
80
91
|
if (e.shiftKey) {
|
|
81
92
|
pitchDir = 1;
|
|
@@ -83,7 +94,9 @@ var KeyboardHandler = /*#__PURE__*/function () {
|
|
|
83
94
|
e.preventDefault();
|
|
84
95
|
yDir = -1;
|
|
85
96
|
}
|
|
97
|
+
|
|
86
98
|
break;
|
|
99
|
+
|
|
87
100
|
case 40:
|
|
88
101
|
if (e.shiftKey) {
|
|
89
102
|
pitchDir = -1;
|
|
@@ -91,10 +104,13 @@ var KeyboardHandler = /*#__PURE__*/function () {
|
|
|
91
104
|
e.preventDefault();
|
|
92
105
|
yDir = 1;
|
|
93
106
|
}
|
|
107
|
+
|
|
94
108
|
break;
|
|
109
|
+
|
|
95
110
|
default:
|
|
96
111
|
return;
|
|
97
112
|
}
|
|
113
|
+
|
|
98
114
|
return {
|
|
99
115
|
cameraAnimation: function cameraAnimation(map) {
|
|
100
116
|
var zoom = map.getZoom();
|
|
@@ -135,9 +151,12 @@ var KeyboardHandler = /*#__PURE__*/function () {
|
|
|
135
151
|
return this.active;
|
|
136
152
|
}
|
|
137
153
|
}]);
|
|
154
|
+
|
|
138
155
|
return KeyboardHandler;
|
|
139
156
|
}();
|
|
157
|
+
|
|
140
158
|
function easeOut(t) {
|
|
141
159
|
return t * (2 - t);
|
|
142
160
|
}
|
|
161
|
+
|
|
143
162
|
export default KeyboardHandler;
|
package/es/handler/map_event.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
3
|
// @ts-ignore
|
|
4
|
-
|
|
5
4
|
import { MapMouseEvent, MapTouchEvent, MapWheelEvent } from "./events";
|
|
5
|
+
|
|
6
6
|
var MapEventHandler = /*#__PURE__*/function () {
|
|
7
7
|
function MapEventHandler(map, options) {
|
|
8
8
|
_classCallCheck(this, MapEventHandler);
|
|
9
|
+
|
|
9
10
|
this.map = map;
|
|
10
11
|
this.clickTolerance = options.clickTolerance;
|
|
11
12
|
}
|
|
13
|
+
|
|
12
14
|
_createClass(MapEventHandler, [{
|
|
13
15
|
key: "reset",
|
|
14
16
|
value: function reset() {
|
|
@@ -25,12 +27,12 @@ var MapEventHandler = /*#__PURE__*/function () {
|
|
|
25
27
|
}, {
|
|
26
28
|
key: "mousedown",
|
|
27
29
|
value: function mousedown(e, point) {
|
|
28
|
-
this.mousedownPos = point;
|
|
29
|
-
// If mapEvent.preventDefault() is called by the user, prevent handlers such as:
|
|
30
|
+
this.mousedownPos = point; // If mapEvent.preventDefault() is called by the user, prevent handlers such as:
|
|
30
31
|
// - MousePan
|
|
31
32
|
// - MouseRotate
|
|
32
33
|
// - MousePitch
|
|
33
34
|
// - DblclickHandler
|
|
35
|
+
|
|
34
36
|
return this.firePreventable(new MapMouseEvent(e.type, this.map, e));
|
|
35
37
|
}
|
|
36
38
|
}, {
|
|
@@ -44,6 +46,7 @@ var MapEventHandler = /*#__PURE__*/function () {
|
|
|
44
46
|
if (this.mousedownPos && this.mousedownPos.dist(point) >= this.clickTolerance) {
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
49
|
+
|
|
47
50
|
this.map.emit(e.type, new MapMouseEvent(e.type, this.map, e));
|
|
48
51
|
}
|
|
49
52
|
}, {
|
|
@@ -94,6 +97,7 @@ var MapEventHandler = /*#__PURE__*/function () {
|
|
|
94
97
|
key: "firePreventable",
|
|
95
98
|
value: function firePreventable(mapEvent) {
|
|
96
99
|
this.map.emit(mapEvent.type, mapEvent);
|
|
100
|
+
|
|
97
101
|
if (mapEvent.defaultPrevented) {
|
|
98
102
|
// returning an object marks the handler as active and resets other handlers
|
|
99
103
|
return {};
|
|
@@ -120,6 +124,8 @@ var MapEventHandler = /*#__PURE__*/function () {
|
|
|
120
124
|
return false;
|
|
121
125
|
}
|
|
122
126
|
}]);
|
|
127
|
+
|
|
123
128
|
return MapEventHandler;
|
|
124
129
|
}();
|
|
130
|
+
|
|
125
131
|
export { MapEventHandler as default };
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
3
|
// @ts-ignore
|
|
4
|
-
|
|
5
4
|
import DOM from "../../utils/dom";
|
|
6
5
|
import { buttonStillPressed } from "./util";
|
|
6
|
+
|
|
7
7
|
var MouseHandler = /*#__PURE__*/function () {
|
|
8
8
|
function MouseHandler(options) {
|
|
9
9
|
_classCallCheck(this, MouseHandler);
|
|
10
|
+
|
|
10
11
|
this.reset();
|
|
11
12
|
this.clickTolerance = options.clickTolerance || 1;
|
|
12
13
|
}
|
|
14
|
+
|
|
13
15
|
_createClass(MouseHandler, [{
|
|
14
16
|
key: "reset",
|
|
15
17
|
value: function reset() {
|
|
16
18
|
this.active = false;
|
|
17
|
-
this.moved = false;
|
|
18
|
-
|
|
19
|
-
delete this.lastPoint;
|
|
20
|
-
|
|
19
|
+
this.moved = false; // @ts-ignore
|
|
20
|
+
|
|
21
|
+
delete this.lastPoint; // @ts-ignore
|
|
22
|
+
|
|
21
23
|
delete this.eventButton;
|
|
22
24
|
}
|
|
23
25
|
}, {
|
|
@@ -26,10 +28,13 @@ var MouseHandler = /*#__PURE__*/function () {
|
|
|
26
28
|
if (this.lastPoint) {
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
31
|
+
|
|
29
32
|
var eventButton = DOM.mouseButton(e);
|
|
33
|
+
|
|
30
34
|
if (!this.correctButton(e, eventButton)) {
|
|
31
35
|
return;
|
|
32
36
|
}
|
|
37
|
+
|
|
33
38
|
this.lastPoint = point;
|
|
34
39
|
this.eventButton = eventButton;
|
|
35
40
|
}
|
|
@@ -37,10 +42,13 @@ var MouseHandler = /*#__PURE__*/function () {
|
|
|
37
42
|
key: "mousemoveWindow",
|
|
38
43
|
value: function mousemoveWindow(e, point) {
|
|
39
44
|
var lastPoint = this.lastPoint;
|
|
45
|
+
|
|
40
46
|
if (!lastPoint) {
|
|
41
47
|
return;
|
|
42
48
|
}
|
|
49
|
+
|
|
43
50
|
e.preventDefault();
|
|
51
|
+
|
|
44
52
|
if (buttonStillPressed(e, this.eventButton)) {
|
|
45
53
|
// Some browsers don't fire a `mouseup` when the mouseup occurs outside
|
|
46
54
|
// the window or iframe:
|
|
@@ -51,13 +59,14 @@ var MouseHandler = /*#__PURE__*/function () {
|
|
|
51
59
|
this.reset();
|
|
52
60
|
return;
|
|
53
61
|
}
|
|
62
|
+
|
|
54
63
|
if (!this.moved && point.dist(lastPoint) < this.clickTolerance) {
|
|
55
64
|
return;
|
|
56
65
|
}
|
|
66
|
+
|
|
57
67
|
this.moved = true;
|
|
58
|
-
this.lastPoint = point;
|
|
68
|
+
this.lastPoint = point; // implemented by child class
|
|
59
69
|
|
|
60
|
-
// implemented by child class
|
|
61
70
|
return this.move(lastPoint, point);
|
|
62
71
|
}
|
|
63
72
|
}, {
|
|
@@ -66,13 +75,17 @@ var MouseHandler = /*#__PURE__*/function () {
|
|
|
66
75
|
if (!this.lastPoint) {
|
|
67
76
|
return;
|
|
68
77
|
}
|
|
78
|
+
|
|
69
79
|
var eventButton = DOM.mouseButton(e);
|
|
80
|
+
|
|
70
81
|
if (eventButton !== this.eventButton) {
|
|
71
82
|
return;
|
|
72
83
|
}
|
|
84
|
+
|
|
73
85
|
if (this.moved) {
|
|
74
86
|
DOM.suppressClick();
|
|
75
87
|
}
|
|
88
|
+
|
|
76
89
|
this.reset();
|
|
77
90
|
}
|
|
78
91
|
}, {
|
|
@@ -95,17 +108,15 @@ var MouseHandler = /*#__PURE__*/function () {
|
|
|
95
108
|
key: "isActive",
|
|
96
109
|
value: function isActive() {
|
|
97
110
|
return this.active;
|
|
98
|
-
}
|
|
111
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
99
112
|
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
101
113
|
}, {
|
|
102
114
|
key: "correctButton",
|
|
103
115
|
value: function correctButton(e, button) {
|
|
104
116
|
// eslint-disable-line
|
|
105
117
|
return false; // implemented by child
|
|
106
|
-
}
|
|
118
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
107
119
|
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
120
|
}, {
|
|
110
121
|
key: "move",
|
|
111
122
|
value: function move(lastPoint, point) {
|
|
@@ -113,6 +124,8 @@ var MouseHandler = /*#__PURE__*/function () {
|
|
|
113
124
|
return; // implemented by child
|
|
114
125
|
}
|
|
115
126
|
}]);
|
|
127
|
+
|
|
116
128
|
return MouseHandler;
|
|
117
129
|
}();
|
|
130
|
+
|
|
118
131
|
export { MouseHandler as default };
|
|
@@ -4,23 +4,31 @@ import _get from "@babel/runtime/helpers/esm/get";
|
|
|
4
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
+
|
|
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
|
+
|
|
8
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; } }
|
|
9
|
-
// @ts-ignore
|
|
10
11
|
|
|
12
|
+
// @ts-ignore
|
|
11
13
|
import MouseHandler from "./mouse_handler";
|
|
12
14
|
import { LEFT_BUTTON } from "./util";
|
|
15
|
+
|
|
13
16
|
var MousePanHandler = /*#__PURE__*/function (_MouseHandler) {
|
|
14
17
|
_inherits(MousePanHandler, _MouseHandler);
|
|
18
|
+
|
|
15
19
|
var _super = _createSuper(MousePanHandler);
|
|
20
|
+
|
|
16
21
|
function MousePanHandler() {
|
|
17
22
|
_classCallCheck(this, MousePanHandler);
|
|
23
|
+
|
|
18
24
|
return _super.apply(this, arguments);
|
|
19
25
|
}
|
|
26
|
+
|
|
20
27
|
_createClass(MousePanHandler, [{
|
|
21
28
|
key: "mousedown",
|
|
22
29
|
value: function mousedown(e, point) {
|
|
23
30
|
_get(_getPrototypeOf(MousePanHandler.prototype), "mousedown", this).call(this, e, point);
|
|
31
|
+
|
|
24
32
|
if (this.lastPoint) {
|
|
25
33
|
this.active = true;
|
|
26
34
|
}
|
|
@@ -39,6 +47,8 @@ var MousePanHandler = /*#__PURE__*/function (_MouseHandler) {
|
|
|
39
47
|
return button === LEFT_BUTTON && !e.ctrlKey;
|
|
40
48
|
}
|
|
41
49
|
}]);
|
|
50
|
+
|
|
42
51
|
return MousePanHandler;
|
|
43
52
|
}(MouseHandler);
|
|
53
|
+
|
|
44
54
|
export { MousePanHandler as default };
|
|
@@ -3,19 +3,26 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
+
|
|
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
|
+
|
|
7
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; } }
|
|
8
|
-
// @ts-ignore
|
|
9
10
|
|
|
11
|
+
// @ts-ignore
|
|
10
12
|
import MouseHandler from "./mouse_handler";
|
|
11
13
|
import { LEFT_BUTTON, RIGHT_BUTTON } from "./util";
|
|
14
|
+
|
|
12
15
|
var MousePitchHandler = /*#__PURE__*/function (_MouseHandler) {
|
|
13
16
|
_inherits(MousePitchHandler, _MouseHandler);
|
|
17
|
+
|
|
14
18
|
var _super = _createSuper(MousePitchHandler);
|
|
19
|
+
|
|
15
20
|
function MousePitchHandler() {
|
|
16
21
|
_classCallCheck(this, MousePitchHandler);
|
|
22
|
+
|
|
17
23
|
return _super.apply(this, arguments);
|
|
18
24
|
}
|
|
25
|
+
|
|
19
26
|
_createClass(MousePitchHandler, [{
|
|
20
27
|
key: "correctButton",
|
|
21
28
|
value: function correctButton(e, button) {
|
|
@@ -26,6 +33,7 @@ var MousePitchHandler = /*#__PURE__*/function (_MouseHandler) {
|
|
|
26
33
|
value: function move(lastPoint, point) {
|
|
27
34
|
var degreesPerPixelMoved = -0.5;
|
|
28
35
|
var pitchDelta = (point.y - lastPoint.y) * degreesPerPixelMoved;
|
|
36
|
+
|
|
29
37
|
if (pitchDelta) {
|
|
30
38
|
this.active = true;
|
|
31
39
|
return {
|
|
@@ -41,6 +49,8 @@ var MousePitchHandler = /*#__PURE__*/function (_MouseHandler) {
|
|
|
41
49
|
e.preventDefault();
|
|
42
50
|
}
|
|
43
51
|
}]);
|
|
52
|
+
|
|
44
53
|
return MousePitchHandler;
|
|
45
54
|
}(MouseHandler);
|
|
55
|
+
|
|
46
56
|
export { MousePitchHandler as default };
|
|
@@ -3,19 +3,26 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
+
|
|
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
|
+
|
|
7
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; } }
|
|
8
|
-
// @ts-ignore
|
|
9
10
|
|
|
11
|
+
// @ts-ignore
|
|
10
12
|
import MouseHandler from "./mouse_handler";
|
|
11
13
|
import { LEFT_BUTTON, RIGHT_BUTTON } from "./util";
|
|
14
|
+
|
|
12
15
|
var MouseRotateHandler = /*#__PURE__*/function (_MouseHandler) {
|
|
13
16
|
_inherits(MouseRotateHandler, _MouseHandler);
|
|
17
|
+
|
|
14
18
|
var _super = _createSuper(MouseRotateHandler);
|
|
19
|
+
|
|
15
20
|
function MouseRotateHandler() {
|
|
16
21
|
_classCallCheck(this, MouseRotateHandler);
|
|
22
|
+
|
|
17
23
|
return _super.apply(this, arguments);
|
|
18
24
|
}
|
|
25
|
+
|
|
19
26
|
_createClass(MouseRotateHandler, [{
|
|
20
27
|
key: "contextmenu",
|
|
21
28
|
value: function contextmenu(e) {
|
|
@@ -33,6 +40,7 @@ var MouseRotateHandler = /*#__PURE__*/function (_MouseHandler) {
|
|
|
33
40
|
value: function move(lastPoint, point) {
|
|
34
41
|
var degreesPerPixelMoved = 0.8;
|
|
35
42
|
var bearingDelta = (point.x - lastPoint.x) * degreesPerPixelMoved;
|
|
43
|
+
|
|
36
44
|
if (bearingDelta) {
|
|
37
45
|
this.active = true;
|
|
38
46
|
return {
|
|
@@ -41,6 +49,8 @@ var MouseRotateHandler = /*#__PURE__*/function (_MouseHandler) {
|
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
51
|
}]);
|
|
52
|
+
|
|
44
53
|
return MouseRotateHandler;
|
|
45
54
|
}(MouseHandler);
|
|
55
|
+
|
|
46
56
|
export { MouseRotateHandler as default };
|
package/es/handler/mouse/util.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
|
|
2
3
|
var _BUTTONS_FLAGS;
|
|
4
|
+
|
|
3
5
|
export var LEFT_BUTTON = 0;
|
|
4
|
-
export var RIGHT_BUTTON = 2;
|
|
6
|
+
export var RIGHT_BUTTON = 2; // the values for each button in MouseEvent.buttons
|
|
5
7
|
|
|
6
|
-
// the values for each button in MouseEvent.buttons
|
|
7
8
|
export var BUTTONS_FLAGS = (_BUTTONS_FLAGS = {}, _defineProperty(_BUTTONS_FLAGS, LEFT_BUTTON, 1), _defineProperty(_BUTTONS_FLAGS, RIGHT_BUTTON, 2), _BUTTONS_FLAGS);
|
|
8
9
|
export function buttonStillPressed(e, button) {
|
|
9
10
|
var flag = BUTTONS_FLAGS[button];
|