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