@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.
Files changed (168) hide show
  1. package/package.json +4 -4
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -775
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -422
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -118
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -81
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -167
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -92
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -231
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -92
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -971
  21. package/es/handler/IHandler.d.ts +0 -34
  22. package/es/handler/IHandler.js +0 -1
  23. package/es/handler/blockable_map_event.d.ts +0 -17
  24. package/es/handler/blockable_map_event.js +0 -83
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -200
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -59
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -12
  31. package/es/handler/events/index.d.ts +0 -4
  32. package/es/handler/events/index.js +0 -4
  33. package/es/handler/events/map_mouse_event.d.ts +0 -34
  34. package/es/handler/events/map_mouse_event.js +0 -75
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -105
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -61
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -39
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -184
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -684
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -10
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -162
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -131
  51. package/es/handler/mouse/index.d.ts +0 -4
  52. package/es/handler/mouse/index.js +0 -4
  53. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  54. package/es/handler/mouse/mouse_handler.js +0 -131
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -54
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -56
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -56
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -12
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -353
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -72
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -96
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -80
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -130
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -120
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -114
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -62
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -115
  81. package/es/handler/touch/index.d.ts +0 -5
  82. package/es/handler/touch/index.js +0 -5
  83. package/es/handler/touch/touch_pan.d.ts +0 -30
  84. package/es/handler/touch/touch_pan.js +0 -128
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -110
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -88
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -67
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -138
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -156
  95. package/es/index.d.ts +0 -4
  96. package/es/index.js +0 -4
  97. package/es/interface.d.ts +0 -34
  98. package/es/interface.js +0 -1
  99. package/es/map.d.ts +0 -70
  100. package/es/map.js +0 -464
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -101
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -133
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -218
  107. package/es/utils/performance.d.ts +0 -17
  108. package/es/utils/performance.js +0 -62
  109. package/es/utils/primitives.d.ts +0 -6
  110. package/es/utils/primitives.js +0 -45
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -106
  113. package/lib/camera.js +0 -801
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -445
  116. package/lib/geo/edge_insets.js +0 -129
  117. package/lib/geo/lng_lat.js +0 -94
  118. package/lib/geo/lng_lat_bounds.js +0 -177
  119. package/lib/geo/mercator.js +0 -121
  120. package/lib/geo/point.js +0 -239
  121. package/lib/geo/simple.js +0 -123
  122. package/lib/geo/transform.js +0 -1013
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -92
  125. package/lib/handler/box_zoom.js +0 -217
  126. package/lib/handler/click_zoom.js +0 -67
  127. package/lib/handler/events/event.js +0 -23
  128. package/lib/handler/events/index.js +0 -31
  129. package/lib/handler/events/map_mouse_event.js +0 -87
  130. package/lib/handler/events/map_touch_event.js +0 -119
  131. package/lib/handler/events/map_wheel_event.js +0 -72
  132. package/lib/handler/events/render_event.js +0 -52
  133. package/lib/handler/handler_inertia.js +0 -193
  134. package/lib/handler/handler_manager.js +0 -714
  135. package/lib/handler/handler_util.js +0 -17
  136. package/lib/handler/keyboard.js +0 -172
  137. package/lib/handler/map_event.js +0 -140
  138. package/lib/handler/mouse/index.js +0 -31
  139. package/lib/handler/mouse/mouse_handler.js +0 -141
  140. package/lib/handler/mouse/mousepan_handler.js +0 -66
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -67
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -67
  143. package/lib/handler/mouse/util.js +0 -26
  144. package/lib/handler/scroll_zoom.js +0 -367
  145. package/lib/handler/shim/dblclick_zoom.js +0 -80
  146. package/lib/handler/shim/drag_pan.js +0 -105
  147. package/lib/handler/shim/drag_rotate.js +0 -88
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -139
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -131
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -124
  151. package/lib/handler/tap/tap_recognizer.js +0 -78
  152. package/lib/handler/tap/tap_zoom.js +0 -124
  153. package/lib/handler/touch/index.js +0 -39
  154. package/lib/handler/touch/touch_pan.js +0 -138
  155. package/lib/handler/touch/touch_pitch.js +0 -120
  156. package/lib/handler/touch/touch_rotate.js +0 -99
  157. package/lib/handler/touch/touch_zoom.js +0 -78
  158. package/lib/handler/touch/two_touch.js +0 -148
  159. package/lib/hash.js +0 -169
  160. package/lib/index.js +0 -57
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -489
  163. package/lib/util.js +0 -135
  164. package/lib/utils/Aabb.js +0 -143
  165. package/lib/utils/dom.js +0 -233
  166. package/lib/utils/performance.js +0 -72
  167. package/lib/utils/primitives.js +0 -57
  168. package/lib/utils/task_queue.js +0 -115
@@ -1,138 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _point = _interopRequireDefault(require("../../geo/point"));
15
-
16
- var _handler_util = require("../handler_util");
17
-
18
- // @ts-ignore
19
- var TouchPanHandler = /*#__PURE__*/function () {
20
- function TouchPanHandler(options) {
21
- (0, _classCallCheck2.default)(this, TouchPanHandler);
22
- this.minTouches = 1;
23
- this.clickTolerance = options.clickTolerance || 1;
24
- this.reset();
25
- }
26
-
27
- (0, _createClass2.default)(TouchPanHandler, [{
28
- key: "reset",
29
- value: function reset() {
30
- this.active = false;
31
- this.touches = {};
32
- this.sum = new _point.default(0, 0);
33
- }
34
- }, {
35
- key: "touchstart",
36
- value: function touchstart(e, points, mapTouches) {
37
- return this.calculateTransform(e, points, mapTouches);
38
- }
39
- }, {
40
- key: "touchmove",
41
- value: function touchmove(e, points, mapTouches) {
42
- if (!this.active) {
43
- return;
44
- }
45
-
46
- e.preventDefault();
47
- return this.calculateTransform(e, points, mapTouches);
48
- }
49
- }, {
50
- key: "touchend",
51
- value: function touchend(e, points, mapTouches) {
52
- this.calculateTransform(e, points, mapTouches);
53
-
54
- if (this.active && mapTouches.length < this.minTouches) {
55
- this.reset();
56
- }
57
- }
58
- }, {
59
- key: "touchcancel",
60
- value: function touchcancel() {
61
- this.reset();
62
- }
63
- }, {
64
- key: "enable",
65
- value: function enable() {
66
- this.enabled = true;
67
- }
68
- }, {
69
- key: "disable",
70
- value: function disable() {
71
- this.enabled = false;
72
- this.reset();
73
- }
74
- }, {
75
- key: "isEnabled",
76
- value: function isEnabled() {
77
- return this.enabled;
78
- }
79
- }, {
80
- key: "isActive",
81
- value: function isActive() {
82
- return this.active;
83
- }
84
- }, {
85
- key: "calculateTransform",
86
- value: function calculateTransform(e, points, mapTouches) {
87
- if (mapTouches.length > 0) {
88
- this.active = true;
89
- }
90
-
91
- var touches = (0, _handler_util.indexTouches)(mapTouches, points);
92
- var touchPointSum = new _point.default(0, 0);
93
- var touchDeltaSum = new _point.default(0, 0);
94
- var touchDeltaCount = 0;
95
-
96
- for (var identifier in touches) {
97
- if (touches[identifier]) {
98
- var point = touches[identifier];
99
- var prevPoint = this.touches[identifier];
100
-
101
- if (prevPoint) {
102
- touchPointSum._add(point);
103
-
104
- touchDeltaSum._add(point.sub(prevPoint));
105
-
106
- touchDeltaCount++;
107
- touches[identifier] = point;
108
- }
109
- }
110
- }
111
-
112
- this.touches = touches;
113
-
114
- if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
115
- return;
116
- } // @ts-ignore
117
-
118
-
119
- var panDelta = touchDeltaSum.div(touchDeltaCount);
120
-
121
- this.sum._add(panDelta);
122
-
123
- if (this.sum.mag() < this.clickTolerance) {
124
- return;
125
- } // @ts-ignore
126
-
127
-
128
- var around = touchPointSum.div(touchDeltaCount);
129
- return {
130
- around: around,
131
- panDelta: panDelta
132
- };
133
- }
134
- }]);
135
- return TouchPanHandler;
136
- }();
137
-
138
- exports.default = TouchPanHandler;
@@ -1,120 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _two_touch = _interopRequireDefault(require("./two_touch"));
23
-
24
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
-
26
- 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; } }
27
-
28
- function isVertical(vector) {
29
- return Math.abs(vector.y) > Math.abs(vector.x);
30
- }
31
-
32
- var ALLOWED_SINGLE_TOUCH_TIME = 100;
33
-
34
- var TouchPitchHandler = /*#__PURE__*/function (_TwoTouchHandler) {
35
- (0, _inherits2.default)(TouchPitchHandler, _TwoTouchHandler);
36
-
37
- var _super = _createSuper(TouchPitchHandler);
38
-
39
- function TouchPitchHandler() {
40
- (0, _classCallCheck2.default)(this, TouchPitchHandler);
41
- return _super.apply(this, arguments);
42
- }
43
-
44
- (0, _createClass2.default)(TouchPitchHandler, [{
45
- key: "reset",
46
- value: function reset() {
47
- (0, _get2.default)((0, _getPrototypeOf2.default)(TouchPitchHandler.prototype), "reset", this).call(this);
48
- this.valid = undefined; // @ts-ignore
49
-
50
- delete this.firstMove; // @ts-ignore
51
-
52
- delete this.lastPoints;
53
- }
54
- }, {
55
- key: "start",
56
- value: function start(points) {
57
- this.lastPoints = points;
58
-
59
- if (isVertical(points[0].sub(points[1]))) {
60
- // fingers are more horizontal than vertical
61
- this.valid = false;
62
- }
63
- }
64
- }, {
65
- key: "move",
66
- value: function move(points, center, e) {
67
- var vectorA = points[0].sub(this.lastPoints[0]);
68
- var vectorB = points[1].sub(this.lastPoints[1]);
69
- this.valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);
70
-
71
- if (!this.valid) {
72
- return;
73
- }
74
-
75
- this.lastPoints = points;
76
- this.active = true;
77
- var yDeltaAverage = (vectorA.y + vectorB.y) / 2;
78
- var degreesPerPixelMoved = -0.5;
79
- return {
80
- pitchDelta: yDeltaAverage * degreesPerPixelMoved
81
- };
82
- }
83
- }, {
84
- key: "gestureBeginsVertically",
85
- value: function gestureBeginsVertically(vectorA, vectorB, timeStamp) {
86
- if (this.valid !== undefined) {
87
- return this.valid;
88
- }
89
-
90
- var threshold = 2;
91
- var movedA = vectorA.mag() >= threshold;
92
- var movedB = vectorB.mag() >= threshold; // neither finger has moved a meaningful amount, wait
93
-
94
- if (!movedA && !movedB) {
95
- return;
96
- } // One finger has moved and the other has not.
97
- // If enough time has passed, decide it is not a pitch.
98
-
99
-
100
- if (!movedA || !movedB) {
101
- if (this.firstMove === undefined) {
102
- this.firstMove = timeStamp;
103
- }
104
-
105
- if (timeStamp - this.firstMove < ALLOWED_SINGLE_TOUCH_TIME) {
106
- // still waiting for a movement from the second finger
107
- return undefined;
108
- } else {
109
- return false;
110
- }
111
- }
112
-
113
- var isSameDirection = vectorA.y > 0 === vectorB.y > 0;
114
- return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;
115
- }
116
- }]);
117
- return TouchPitchHandler;
118
- }(_two_touch.default);
119
-
120
- exports.default = TouchPitchHandler;
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _two_touch = _interopRequireDefault(require("./two_touch"));
23
-
24
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
-
26
- 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; } }
27
-
28
- var ROTATION_THRESHOLD = 25; // pixels along circumference of touch circle
29
-
30
- function getBearingDelta(a, b) {
31
- return a.angleWith(b) * 180 / Math.PI;
32
- }
33
-
34
- var TouchRotateHandler = /*#__PURE__*/function (_TwoTouchHandler) {
35
- (0, _inherits2.default)(TouchRotateHandler, _TwoTouchHandler);
36
-
37
- var _super = _createSuper(TouchRotateHandler);
38
-
39
- function TouchRotateHandler() {
40
- (0, _classCallCheck2.default)(this, TouchRotateHandler);
41
- return _super.apply(this, arguments);
42
- }
43
-
44
- (0, _createClass2.default)(TouchRotateHandler, [{
45
- key: "reset",
46
- value: function reset() {
47
- (0, _get2.default)((0, _getPrototypeOf2.default)(TouchRotateHandler.prototype), "reset", this).call(this); // @ts-ignore
48
-
49
- delete this.minDiameter; // @ts-ignore
50
-
51
- delete this.startVector; // @ts-ignore
52
-
53
- delete this.vector;
54
- }
55
- }, {
56
- key: "start",
57
- value: function start(points) {
58
- this.startVector = this.vector = points[0].sub(points[1]);
59
- this.minDiameter = points[0].dist(points[1]);
60
- }
61
- }, {
62
- key: "move",
63
- value: function move(points, pinchAround) {
64
- var lastVector = this.vector;
65
- this.vector = points[0].sub(points[1]);
66
-
67
- if (!this.active && this.isBelowThreshold(this.vector)) {
68
- return;
69
- }
70
-
71
- this.active = true;
72
- return {
73
- bearingDelta: getBearingDelta(this.vector, lastVector),
74
- pinchAround: pinchAround
75
- };
76
- }
77
- }, {
78
- key: "isBelowThreshold",
79
- value: function isBelowThreshold(vector) {
80
- /*
81
- * The threshold before a rotation actually happens is configured in
82
- * pixels alongth circumference of the circle formed by the two fingers.
83
- * This makes the threshold in degrees larger when the fingers are close
84
- * together and smaller when the fingers are far apart.
85
- *
86
- * Use the smallest diameter from the whole gesture to reduce sensitivity
87
- * when pinching in and out.
88
- */
89
- this.minDiameter = Math.min(this.minDiameter, vector.mag());
90
- var circumference = Math.PI * this.minDiameter;
91
- var threshold = ROTATION_THRESHOLD / circumference * 360;
92
- var bearingDeltaSinceStart = getBearingDelta(vector, this.startVector);
93
- return Math.abs(bearingDeltaSinceStart) < threshold;
94
- }
95
- }]);
96
- return TouchRotateHandler;
97
- }(_two_touch.default);
98
-
99
- exports.default = TouchRotateHandler;
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _two_touch = _interopRequireDefault(require("./two_touch"));
23
-
24
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
-
26
- 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; } }
27
-
28
- var ZOOM_THRESHOLD = 0.1;
29
-
30
- function getZoomDelta(distance, lastDistance) {
31
- return Math.log(distance / lastDistance) / Math.LN2;
32
- }
33
-
34
- var TouchZoomHandler = /*#__PURE__*/function (_TwoTouchHandler) {
35
- (0, _inherits2.default)(TouchZoomHandler, _TwoTouchHandler);
36
-
37
- var _super = _createSuper(TouchZoomHandler);
38
-
39
- function TouchZoomHandler() {
40
- (0, _classCallCheck2.default)(this, TouchZoomHandler);
41
- return _super.apply(this, arguments);
42
- }
43
-
44
- (0, _createClass2.default)(TouchZoomHandler, [{
45
- key: "reset",
46
- value: function reset() {
47
- (0, _get2.default)((0, _getPrototypeOf2.default)(TouchZoomHandler.prototype), "reset", this).call(this); // @ts-ignore
48
-
49
- delete this.distance; // @ts-ignore
50
-
51
- delete this.startDistance;
52
- }
53
- }, {
54
- key: "start",
55
- value: function start(points) {
56
- this.startDistance = this.distance = points[0].dist(points[1]);
57
- }
58
- }, {
59
- key: "move",
60
- value: function move(points, pinchAround) {
61
- var lastDistance = this.distance;
62
- this.distance = points[0].dist(points[1]);
63
-
64
- if (!this.active && Math.abs(getZoomDelta(this.distance, this.startDistance)) < ZOOM_THRESHOLD) {
65
- return;
66
- }
67
-
68
- this.active = true;
69
- return {
70
- zoomDelta: getZoomDelta(this.distance, lastDistance),
71
- pinchAround: pinchAround
72
- };
73
- }
74
- }]);
75
- return TouchZoomHandler;
76
- }(_two_touch.default);
77
-
78
- exports.default = TouchZoomHandler;
@@ -1,148 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _dom = _interopRequireDefault(require("../../utils/dom"));
17
-
18
- // @ts-ignore
19
- var TwoTouchHandler = /*#__PURE__*/function () {
20
- function TwoTouchHandler() {
21
- (0, _classCallCheck2.default)(this, TwoTouchHandler);
22
- this.reset();
23
- }
24
-
25
- (0, _createClass2.default)(TwoTouchHandler, [{
26
- key: "reset",
27
- value: function reset() {
28
- this.active = false; // @ts-ignore
29
-
30
- delete this.firstTwoTouches;
31
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
-
33
- }, {
34
- key: "start",
35
- value: function start(points) {
36
- return;
37
- } // eslint-disable-line
38
-
39
- }, {
40
- key: "move",
41
- value: function move( // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
- points, // eslint-disable-next-line @typescript-eslint/no-unused-vars
43
- pinchAround, // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
- e) {
45
- return;
46
- } // eslint-disable-line
47
-
48
- }, {
49
- key: "touchstart",
50
- value: function touchstart(e, points, mapTouches) {
51
- // console.log(e.target, e.targetTouches.length ? e.targetTouches[0].target : null);
52
- // log('touchstart', points, e.target.innerHTML, e.targetTouches.length ? e.targetTouches[0].target.innerHTML: undefined);
53
- if (this.firstTwoTouches || mapTouches.length < 2) {
54
- return;
55
- }
56
-
57
- this.firstTwoTouches = [mapTouches[0].identifier, mapTouches[1].identifier]; // implemented by child classes
58
-
59
- this.start([points[0], points[1]]);
60
- }
61
- }, {
62
- key: "touchmove",
63
- value: function touchmove(e, points, mapTouches) {
64
- if (!this.firstTwoTouches) {
65
- return;
66
- }
67
-
68
- e.preventDefault();
69
-
70
- var _this$firstTwoTouches = (0, _slicedToArray2.default)(this.firstTwoTouches, 2),
71
- idA = _this$firstTwoTouches[0],
72
- idB = _this$firstTwoTouches[1];
73
-
74
- var a = getTouchById(mapTouches, points, idA);
75
- var b = getTouchById(mapTouches, points, idB);
76
-
77
- if (!a || !b) {
78
- return;
79
- }
80
-
81
- var pinchAround = this.aroundCenter ? null : a.add(b).div(2); // implemented by child classes
82
-
83
- return this.move([a, b], pinchAround, e);
84
- }
85
- }, {
86
- key: "touchend",
87
- value: function touchend(e, points, mapTouches) {
88
- if (!this.firstTwoTouches) {
89
- return;
90
- }
91
-
92
- var _this$firstTwoTouches2 = (0, _slicedToArray2.default)(this.firstTwoTouches, 2),
93
- idA = _this$firstTwoTouches2[0],
94
- idB = _this$firstTwoTouches2[1];
95
-
96
- var a = getTouchById(mapTouches, points, idA);
97
- var b = getTouchById(mapTouches, points, idB);
98
-
99
- if (a && b) {
100
- return;
101
- }
102
-
103
- if (this.active) {
104
- _dom.default.suppressClick();
105
- }
106
-
107
- this.reset();
108
- }
109
- }, {
110
- key: "touchcancel",
111
- value: function touchcancel() {
112
- this.reset();
113
- }
114
- }, {
115
- key: "enable",
116
- value: function enable(options) {
117
- this.enabled = true;
118
- this.aroundCenter = !!options && options.around === 'center';
119
- }
120
- }, {
121
- key: "disable",
122
- value: function disable() {
123
- this.enabled = false;
124
- this.reset();
125
- }
126
- }, {
127
- key: "isEnabled",
128
- value: function isEnabled() {
129
- return this.enabled;
130
- }
131
- }, {
132
- key: "isActive",
133
- value: function isActive() {
134
- return this.active;
135
- }
136
- }]);
137
- return TwoTouchHandler;
138
- }();
139
-
140
- exports.default = TwoTouchHandler;
141
-
142
- function getTouchById(mapTouches, points, identifier) {
143
- for (var i = 0; i < mapTouches.length; i++) {
144
- if (mapTouches[i].identifier === identifier) {
145
- return points[i];
146
- }
147
- }
148
- }