@antv/l7-map 2.5.41 → 2.5.46
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.map +1 -1
- package/es/earthmap.d.ts +0 -1
- package/es/earthmap.js +0 -26
- package/es/earthmap.js.map +1 -1
- package/es/handler/IHandler.js +1 -1
- package/es/handler/handler_manager.js +53 -33
- package/es/handler/handler_manager.js.map +1 -1
- package/es/handler/shim/drag_pan.js +9 -2
- package/es/handler/shim/drag_pan.js.map +1 -1
- package/es/handler/shim/touch_zoom_rotate.js +9 -2
- package/es/handler/shim/touch_zoom_rotate.js.map +1 -1
- package/es/hash.d.ts +1 -2
- package/es/hash.js +5 -4
- package/es/hash.js.map +1 -1
- package/es/interface.d.ts +1 -0
- package/es/interface.js +1 -1
- package/es/map.d.ts +4 -1
- package/es/map.js +33 -20
- package/es/map.js.map +1 -1
- package/es/util.d.ts +3 -3
- package/es/util.js +6 -5
- package/es/util.js.map +1 -1
- package/es/utils/dom.js +60 -26
- package/es/utils/dom.js.map +1 -1
- package/es/utils/performance.js +2 -1
- package/es/utils/performance.js.map +1 -1
- package/lib/camera.js.map +1 -1
- package/lib/earthmap.js +0 -26
- package/lib/earthmap.js.map +1 -1
- package/lib/geo/lng_lat.js +1 -1
- package/lib/geo/mercator.js +11 -7
- package/lib/geo/mercator.js.map +1 -1
- package/lib/geo/simple.js +11 -7
- package/lib/geo/simple.js.map +1 -1
- package/lib/geo/transform.js +6 -2
- package/lib/geo/transform.js.map +1 -1
- package/lib/handler/handler_manager.js +55 -33
- package/lib/handler/handler_manager.js.map +1 -1
- package/lib/handler/mouse/index.js +4 -4
- package/lib/handler/mouse/util.js +1 -1
- package/lib/handler/shim/drag_pan.js +10 -2
- package/lib/handler/shim/drag_pan.js.map +1 -1
- package/lib/handler/shim/touch_zoom_rotate.js +10 -2
- package/lib/handler/shim/touch_zoom_rotate.js.map +1 -1
- package/lib/handler/tap/single_tap_recognizer.js +1 -1
- package/lib/handler/tap/tap_recognizer.js +6 -2
- package/lib/handler/tap/tap_recognizer.js.map +1 -1
- package/lib/hash.js +9 -4
- package/lib/hash.js.map +1 -1
- package/lib/map.js +32 -19
- package/lib/map.js.map +1 -1
- package/lib/util.js +14 -9
- package/lib/util.js.map +1 -1
- package/lib/utils/dom.js +66 -26
- package/lib/utils/dom.js.map +1 -1
- package/lib/utils/performance.js +4 -1
- package/lib/utils/performance.js.map +1 -1
- package/package.json +3 -3
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.RIGHT_BUTTON = exports.LEFT_BUTTON = exports.BUTTONS_FLAGS = void 0;
|
|
8
9
|
exports.buttonStillPressed = buttonStillPressed;
|
|
9
|
-
exports.BUTTONS_FLAGS = exports.RIGHT_BUTTON = exports.LEFT_BUTTON = void 0;
|
|
10
10
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
|
|
@@ -13,6 +13,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
|
|
16
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
17
|
+
|
|
16
18
|
var DragPanHandler = function () {
|
|
17
19
|
function DragPanHandler(el, mousePan, touchPan) {
|
|
18
20
|
(0, _classCallCheck2.default)(this, DragPanHandler);
|
|
@@ -31,14 +33,20 @@ var DragPanHandler = function () {
|
|
|
31
33
|
this.inertiaOptions = options || {};
|
|
32
34
|
this.mousePan.enable();
|
|
33
35
|
this.touchPan.enable();
|
|
34
|
-
|
|
36
|
+
|
|
37
|
+
if (!_l7Utils.isMini) {
|
|
38
|
+
this.el.classList.add('l7-touch-drag-pan');
|
|
39
|
+
}
|
|
35
40
|
}
|
|
36
41
|
}, {
|
|
37
42
|
key: "disable",
|
|
38
43
|
value: function disable() {
|
|
39
44
|
this.mousePan.disable();
|
|
40
45
|
this.touchPan.disable();
|
|
41
|
-
|
|
46
|
+
|
|
47
|
+
if (!_l7Utils.isMini) {
|
|
48
|
+
this.el.classList.remove('l7-touch-drag-pan');
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
}, {
|
|
44
52
|
key: "isEnabled",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/shim/drag_pan.ts"],"names":["DragPanHandler","el","mousePan","touchPan","options","inertiaOptions","enable","classList","add","disable","remove","isEnabled","isActive"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/handler/shim/drag_pan.ts"],"names":["DragPanHandler","el","mousePan","touchPan","options","inertiaOptions","enable","isMini","classList","add","disable","remove","isEnabled","isActive"],"mappings":";;;;;;;;;;;;;;;AAAA;;IAeqBA,c;AAQnB,0BACEC,EADF,EAEEC,QAFF,EAGEC,QAHF,EAIE;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAKF,EAAL,GAAUA,EAAV;AACA,SAAKC,QAAL,GAAgBA,QAAhB;AACA,SAAKC,QAAL,GAAgBA,QAAhB;AACD;;;;WAqBD,gBAAcC,OAAd,EAAyC;AACvC,WAAKC,cAAL,GAAsBD,OAAO,IAAI,EAAjC;AACA,WAAKF,QAAL,CAAcI,MAAd;AACA,WAAKH,QAAL,CAAcG,MAAd;;AACA,UAAI,CAACC,eAAL,EAAa;AACX,aAAKN,EAAL,CAAQO,SAAR,CAAkBC,GAAlB,CAAsB,mBAAtB;AACD;AACF;;;WAQD,mBAAiB;AACf,WAAKP,QAAL,CAAcQ,OAAd;AACA,WAAKP,QAAL,CAAcO,OAAd;;AACA,UAAI,CAACH,eAAL,EAAa;AACX,aAAKN,EAAL,CAAQO,SAAR,CAAkBG,MAAlB,CAAyB,mBAAzB;AACD;AACF;;;WAOD,qBAAmB;AACjB,aAAO,KAAKT,QAAL,CAAcU,SAAd,MAA6B,KAAKT,QAAL,CAAcS,SAAd,EAApC;AACD;;;WAOD,oBAAkB;AAChB,aAAO,KAAKV,QAAL,CAAcW,QAAd,MAA4B,KAAKV,QAAL,CAAcU,QAAd,EAAnC;AACD","sourcesContent":["import { isMini } from '@antv/l7-utils';\nimport { MousePanHandler } from '../mouse/';\nimport { TouchPanHandler } from '../touch/';\n\nexport interface IDragPanOptions {\n linearity?: number;\n easing?: (t: number) => number;\n deceleration?: number;\n maxSpeed?: number;\n}\n\n/**\n * The `DragPanHandler` allows the user to pan the map by clicking and dragging\n * the cursor.\n */\nexport default class DragPanHandler {\n public inertiaOptions: IDragPanOptions;\n private el: HTMLElement;\n private mousePan: MousePanHandler;\n private touchPan: TouchPanHandler;\n /**\n * @private\n */\n constructor(\n el: HTMLElement,\n mousePan: MousePanHandler,\n touchPan: TouchPanHandler,\n ) {\n this.el = el;\n this.mousePan = mousePan;\n this.touchPan = touchPan;\n }\n\n /**\n * Enables the \"drag to pan\" interaction.\n *\n * @param {Object} [options] Options object\n * @param {number} [options.linearity=0] factor used to scale the drag velocity\n * @param {Function} [options.easing=bezier(0, 0, 0.3, 1)] easing function applled to `map.panTo` when applying the drag.\n * @param {number} [options.maxSpeed=1400] the maximum value of the drag velocity.\n * @param {number} [options.deceleration=2500] the rate at which the speed reduces after the pan ends.\n *\n * @example\n * map.dragPan.enable();\n * @example\n * map.dragPan.enable({\n * linearity: 0.3,\n * easing: bezier(0, 0, 0.3, 1),\n * maxSpeed: 1400,\n * deceleration: 2500,\n * });\n */\n public enable(options?: IDragPanOptions) {\n this.inertiaOptions = options || {};\n this.mousePan.enable();\n this.touchPan.enable();\n if (!isMini) {\n this.el.classList.add('l7-touch-drag-pan');\n }\n }\n\n /**\n * Disables the \"drag to pan\" interaction.\n *\n * @example\n * map.dragPan.disable();\n */\n public disable() {\n this.mousePan.disable();\n this.touchPan.disable();\n if (!isMini) {\n this.el.classList.remove('l7-touch-drag-pan');\n }\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to pan\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"drag to pan\" interaction is enabled.\n */\n public isEnabled() {\n return this.mousePan.isEnabled() && this.touchPan.isEnabled();\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to pan\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"drag to pan\" interaction is active.\n */\n public isActive() {\n return this.mousePan.isActive() || this.touchPan.isActive();\n }\n}\n"],"file":"drag_pan.js"}
|
|
@@ -13,6 +13,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
|
|
16
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
17
|
+
|
|
16
18
|
var TouchZoomRotateHandler = function () {
|
|
17
19
|
function TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom) {
|
|
18
20
|
(0, _classCallCheck2.default)(this, TouchZoomRotateHandler);
|
|
@@ -40,7 +42,10 @@ var TouchZoomRotateHandler = function () {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
this.tapDragZoom.enable();
|
|
43
|
-
|
|
45
|
+
|
|
46
|
+
if (!_l7Utils.isMini) {
|
|
47
|
+
this.el.classList.add('l7-touch-zoom-rotate');
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
}, {
|
|
46
51
|
key: "disable",
|
|
@@ -48,7 +53,10 @@ var TouchZoomRotateHandler = function () {
|
|
|
48
53
|
this.touchZoom.disable();
|
|
49
54
|
this.touchRotate.disable();
|
|
50
55
|
this.tapDragZoom.disable();
|
|
51
|
-
|
|
56
|
+
|
|
57
|
+
if (!_l7Utils.isMini) {
|
|
58
|
+
this.el.classList.remove('l7-touch-zoom-rotate');
|
|
59
|
+
}
|
|
52
60
|
}
|
|
53
61
|
}, {
|
|
54
62
|
key: "isEnabled",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/shim/touch_zoom_rotate.ts"],"names":["TouchZoomRotateHandler","el","touchZoom","touchRotate","tapDragZoom","rotationDisabled","enabled","options","enable","classList","add","disable","remove","isEnabled","isActive"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/handler/shim/touch_zoom_rotate.ts"],"names":["TouchZoomRotateHandler","el","touchZoom","touchRotate","tapDragZoom","rotationDisabled","enabled","options","enable","isMini","classList","add","disable","remove","isEnabled","isActive"],"mappings":";;;;;;;;;;;;;;;AAAA;;IAWqBA,sB;AAWnB,kCACEC,EADF,EAEEC,SAFF,EAGEC,WAHF,EAIEC,WAJF,EAKE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAKH,EAAL,GAAUA,EAAV;AACA,SAAKC,SAAL,GAAiBA,SAAjB;AACA,SAAKC,WAAL,GAAmBA,WAAnB;AACA,SAAKC,WAAL,GAAmBA,WAAnB;AACA,SAAKC,gBAAL,GAAwB,KAAxB;AACA,SAAKC,OAAL,GAAe,IAAf;AACD;;;;WAaD,gBAAcC,OAAd,EAA8C;AAC5C,WAAKL,SAAL,CAAeM,MAAf,CAAsBD,OAAtB;;AACA,UAAI,CAAC,KAAKF,gBAAV,EAA4B;AAC1B,aAAKF,WAAL,CAAiBK,MAAjB,CAAwBD,OAAxB;AACD;;AACD,WAAKH,WAAL,CAAiBI,MAAjB;;AACA,UAAI,CAACC,eAAL,EAAa;AACX,aAAKR,EAAL,CAAQS,SAAR,CAAkBC,GAAlB,CAAsB,sBAAtB;AACD;AACF;;;WAQD,mBAAiB;AACf,WAAKT,SAAL,CAAeU,OAAf;AACA,WAAKT,WAAL,CAAiBS,OAAjB;AACA,WAAKR,WAAL,CAAiBQ,OAAjB;;AACA,UAAI,CAACH,eAAL,EAAa;AACX,aAAKR,EAAL,CAAQS,SAAR,CAAkBG,MAAlB,CAAyB,sBAAzB;AACD;AACF;;;WAOD,qBAAmB;AACjB,aACE,KAAKX,SAAL,CAAeY,SAAf,OACC,KAAKT,gBAAL,IAAyB,KAAKF,WAAL,CAAiBW,SAAjB,EAD1B,KAEA,KAAKV,WAAL,CAAiBU,SAAjB,EAHF;AAKD;;;WAOD,oBAAkB;AAChB,aACE,KAAKZ,SAAL,CAAea,QAAf,MACA,KAAKZ,WAAL,CAAiBY,QAAjB,EADA,IAEA,KAAKX,WAAL,CAAiBW,QAAjB,EAHF;AAKD;;;WASD,2BAAyB;AACvB,WAAKV,gBAAL,GAAwB,IAAxB;AACA,WAAKF,WAAL,CAAiBS,OAAjB;AACD;;;WASD,0BAAwB;AACtB,WAAKP,gBAAL,GAAwB,KAAxB;;AACA,UAAI,KAAKH,SAAL,CAAeY,SAAf,EAAJ,EAAgC;AAC9B,aAAKX,WAAL,CAAiBK,MAAjB;AACD;AACF","sourcesContent":["import { isMini } from '@antv/l7-utils';\nimport TapDragZoomHandler from '../tap/tap_drag_zoom';\nimport { TouchRotateHandler, TouchZoomHandler } from '../touch';\n\n/**\n * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by\n * pinching on a touchscreen.\n *\n * They can zoom with one finger by double tapping and dragging. On the second tap,\n * hold the finger down and drag up or down to zoom in or out.\n */\nexport default class TouchZoomRotateHandler {\n private el: HTMLElement;\n private touchZoom: TouchZoomHandler;\n private touchRotate: TouchRotateHandler;\n private tapDragZoom: TapDragZoomHandler;\n private rotationDisabled: boolean;\n private enabled: boolean;\n\n /**\n * @private\n */\n constructor(\n el: HTMLElement,\n touchZoom: TouchZoomHandler,\n touchRotate: TouchRotateHandler,\n tapDragZoom: TapDragZoomHandler,\n ) {\n this.el = el;\n this.touchZoom = touchZoom;\n this.touchRotate = touchRotate;\n this.tapDragZoom = tapDragZoom;\n this.rotationDisabled = false;\n this.enabled = true;\n }\n\n /**\n * Enables the \"pinch to rotate and zoom\" interaction.\n *\n * @param {Object} [options] Options object.\n * @param {string} [options.around] If \"center\" is passed, map will zoom around the center\n *\n * @example\n * map.touchZoomRotate.enable();\n * @example\n * map.touchZoomRotate.enable({ around: 'center' });\n */\n public enable(options: { around?: 'center' }) {\n this.touchZoom.enable(options);\n if (!this.rotationDisabled) {\n this.touchRotate.enable(options);\n }\n this.tapDragZoom.enable();\n if (!isMini) {\n this.el.classList.add('l7-touch-zoom-rotate');\n }\n }\n\n /**\n * Disables the \"pinch to rotate and zoom\" interaction.\n *\n * @example\n * map.touchZoomRotate.disable();\n */\n public disable() {\n this.touchZoom.disable();\n this.touchRotate.disable();\n this.tapDragZoom.disable();\n if (!isMini) {\n this.el.classList.remove('l7-touch-zoom-rotate');\n }\n }\n\n /**\n * Returns a Boolean indicating whether the \"pinch to rotate and zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"pinch to rotate and zoom\" interaction is enabled.\n */\n public isEnabled() {\n return (\n this.touchZoom.isEnabled() &&\n (this.rotationDisabled || this.touchRotate.isEnabled()) &&\n this.tapDragZoom.isEnabled()\n );\n }\n\n /**\n * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.\n *\n * @returns {boolean} //eslint-disable-line\n */\n public isActive() {\n return (\n this.touchZoom.isActive() ||\n this.touchRotate.isActive() ||\n this.tapDragZoom.isActive()\n );\n }\n\n /**\n * Disables the \"pinch to rotate\" interaction, leaving the \"pinch to zoom\"\n * interaction enabled.\n *\n * @example\n * map.touchZoomRotate.disableRotation();\n */\n public disableRotation() {\n this.rotationDisabled = true;\n this.touchRotate.disable();\n }\n\n /**\n * Enables the \"pinch to rotate\" interaction.\n *\n * @example\n * map.touchZoomRotate.enable();\n * map.touchZoomRotate.enableRotation();\n */\n public enableRotation() {\n this.rotationDisabled = false;\n if (this.touchZoom.isEnabled()) {\n this.touchRotate.enable();\n }\n }\n}\n"],"file":"touch_zoom_rotate.js"}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.
|
|
8
|
+
exports.default = exports.MAX_TOUCH_TIME = exports.MAX_TAP_INTERVAL = exports.MAX_DIST = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -17,6 +17,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
17
17
|
|
|
18
18
|
var _single_tap_recognizer = _interopRequireWildcard(require("./single_tap_recognizer"));
|
|
19
19
|
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
20
24
|
var TapRecognizer = function () {
|
|
21
25
|
function TapRecognizer(options) {
|
|
22
26
|
(0, _classCallCheck2.default)(this, TapRecognizer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/handler/tap/tap_recognizer.ts"],"names":["TapRecognizer","options","singleTap","SingleTapRecognizer","numTaps","reset","lastTime","Infinity","lastTap","count","e","points","mapTouches","touchstart","touchmove","tap","touchend","soonEnough","timeStamp","MAX_TAP_INTERVAL","closeEnough","dist","MAX_DIST"],"mappings":";;;;;;;;;;;;;;;;;AAEA
|
|
1
|
+
{"version":3,"sources":["../../../src/handler/tap/tap_recognizer.ts"],"names":["TapRecognizer","options","singleTap","SingleTapRecognizer","numTaps","reset","lastTime","Infinity","lastTap","count","e","points","mapTouches","touchstart","touchmove","tap","touchend","soonEnough","timeStamp","MAX_TAP_INTERVAL","closeEnough","dist","MAX_DIST"],"mappings":";;;;;;;;;;;;;;;;;AAEA;;;;;;IAKqBA,a;AAOnB,yBAAYC,OAAZ,EAA8D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAC5D,SAAKC,SAAL,GAAiB,IAAIC,8BAAJ,CAAwBF,OAAxB,CAAjB;AACA,SAAKG,OAAL,GAAeH,OAAO,CAACG,OAAvB;AACA,SAAKC,KAAL;AACD;;;;WAED,iBAAe;AACb,WAAKC,QAAL,GAAgBC,QAAhB;AACA,aAAO,KAAKC,OAAZ;AACA,WAAKC,KAAL,GAAa,CAAb;AACA,WAAKP,SAAL,CAAeG,KAAf;AACD;;;WAED,oBAAkBK,CAAlB,EAAiCC,MAAjC,EAAkDC,UAAlD,EAAuE;AACrE,WAAKV,SAAL,CAAeW,UAAf,CAA0BH,CAA1B,EAA6BC,MAA7B,EAAqCC,UAArC;AACD;;;WAED,mBAAiBF,CAAjB,EAAgCC,MAAhC,EAAiDC,UAAjD,EAAsE;AACpE,WAAKV,SAAL,CAAeY,SAAf,CAAyBJ,CAAzB,EAA4BC,MAA5B,EAAoCC,UAApC;AACD;;;WAED,kBAAgBF,CAAhB,EAA+BC,MAA/B,EAAgDC,UAAhD,EAAqE;AACnE,UAAMG,GAAG,GAAG,KAAKb,SAAL,CAAec,QAAf,CAAwBN,CAAxB,EAA2BC,MAA3B,EAAmCC,UAAnC,CAAZ;;AACA,UAAIG,GAAJ,EAAS;AACP,YAAME,UAAU,GAAGP,CAAC,CAACQ,SAAF,GAAc,KAAKZ,QAAnB,GAA8Ba,uCAAjD;;AACA,YAAMC,WAAW,GAAG,CAAC,KAAKZ,OAAN,IAAiB,KAAKA,OAAL,CAAaa,IAAb,CAAkBN,GAAlB,IAAyBO,+BAA9D;;AAEA,YAAI,CAACL,UAAD,IAAe,CAACG,WAApB,EAAiC;AAC/B,eAAKf,KAAL;AACD;;AAED,aAAKI,KAAL;AACA,aAAKH,QAAL,GAAgBI,CAAC,CAACQ,SAAlB;AACA,aAAKV,OAAL,GAAeO,GAAf;;AAEA,YAAI,KAAKN,KAAL,KAAe,KAAKL,OAAxB,EAAiC;AAC/B,eAAKC,KAAL;AACA,iBAAOU,GAAP;AACD;AACF;AACF","sourcesContent":["// @ts-ignore\nimport Point from '../../geo/point';\nimport SingleTapRecognizer, {\n MAX_DIST,\n MAX_TAP_INTERVAL,\n} from './single_tap_recognizer';\n\nexport default class TapRecognizer {\n public singleTap: SingleTapRecognizer;\n public numTaps: number;\n public lastTime: number;\n public lastTap: Point;\n public count: number;\n\n constructor(options: { numTaps: number; numTouches: number }) {\n this.singleTap = new SingleTapRecognizer(options);\n this.numTaps = options.numTaps;\n this.reset();\n }\n\n public reset() {\n this.lastTime = Infinity;\n delete this.lastTap;\n this.count = 0;\n this.singleTap.reset();\n }\n\n public touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]) {\n this.singleTap.touchstart(e, points, mapTouches);\n }\n\n public touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]) {\n this.singleTap.touchmove(e, points, mapTouches);\n }\n\n public touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]) {\n const tap = this.singleTap.touchend(e, points, mapTouches);\n if (tap) {\n const soonEnough = e.timeStamp - this.lastTime < MAX_TAP_INTERVAL;\n const closeEnough = !this.lastTap || this.lastTap.dist(tap) < MAX_DIST;\n\n if (!soonEnough || !closeEnough) {\n this.reset();\n }\n\n this.count++;\n this.lastTime = e.timeStamp;\n this.lastTap = tap;\n\n if (this.count === this.numTaps) {\n this.reset();\n return tap;\n }\n }\n }\n}\n"],"file":"tap_recognizer.js"}
|
package/lib/hash.js
CHANGED
|
@@ -13,7 +13,9 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _throttle2 = _interopRequireDefault(require("lodash/throttle"));
|
|
17
|
+
|
|
18
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
17
19
|
|
|
18
20
|
var Hash = function () {
|
|
19
21
|
function Hash(hashName) {
|
|
@@ -68,21 +70,24 @@ var Hash = function () {
|
|
|
68
70
|
} catch (SecurityError) {}
|
|
69
71
|
});
|
|
70
72
|
this.hashName = hashName && encodeURIComponent(hashName);
|
|
71
|
-
this.updateHash = (0,
|
|
73
|
+
this.updateHash = (0, _throttle2.default)(this.updateHashUnthrottled, 30 * 1000 / 100);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
(0, _createClass2.default)(Hash, [{
|
|
75
77
|
key: "addTo",
|
|
76
78
|
value: function addTo(map) {
|
|
77
79
|
this.map = map;
|
|
78
|
-
|
|
80
|
+
|
|
81
|
+
_l7Utils.$window.addEventListener('hashchange', this.onHashChange, false);
|
|
82
|
+
|
|
79
83
|
this.map.on('moveend', this.updateHash);
|
|
80
84
|
return this;
|
|
81
85
|
}
|
|
82
86
|
}, {
|
|
83
87
|
key: "remove",
|
|
84
88
|
value: function remove() {
|
|
85
|
-
window.removeEventListener('hashchange', this.onHashChange, false);
|
|
89
|
+
_l7Utils.$window.removeEventListener('hashchange', this.onHashChange, false);
|
|
90
|
+
|
|
86
91
|
this.map.off('moveend', this.updateHash);
|
|
87
92
|
delete this.map;
|
|
88
93
|
return this;
|
package/lib/hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hash.ts"],"names":["Hash","hashName","loc","getCurrentHash","length","some","v","isNaN","bearing","map","dragRotate","isEnabled","touchZoomRotate","getBearing","jumpTo","center","zoom","pitch","hash","window","location","replace","keyval","split","part","forEach","getHashString","history","replaceState","state","SecurityError","encodeURIComponent","updateHash","updateHashUnthrottled","addEventListener","onHashChange","on","removeEventListener","off","mapFeedback","getCenter","Math","round","getZoom","precision","ceil","LN2","log","LN10","m","pow","lng","lat","getPitch","found","parts","slice","key","filter","a","push","join"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/hash.ts"],"names":["Hash","hashName","loc","getCurrentHash","length","some","v","isNaN","bearing","map","dragRotate","isEnabled","touchZoomRotate","getBearing","jumpTo","center","zoom","pitch","hash","window","location","replace","keyval","split","part","forEach","getHashString","history","replaceState","state","SecurityError","encodeURIComponent","updateHash","updateHashUnthrottled","$window","addEventListener","onHashChange","on","removeEventListener","off","mapFeedback","getCenter","Math","round","getZoom","precision","ceil","LN2","log","LN10","m","pow","lng","lat","getPitch","found","parts","slice","key","filter","a","push","join"],"mappings":";;;;;;;;;;;;;;;;;AAEA;;IAUMA,I;AAKJ,gBAAYC,QAAZ,EAA+B;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,wDAsBT,YAAM;AAC1B,UAAMC,GAAG,GAAG,KAAI,CAACC,cAAL,EAAZ;;AACA,UAAID,GAA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AP,CAAgBF,IAAhB,CACXuC,KADW,CACL,CADK,EAEXlC,KAFW,CAEL,GAFK,EAGXd,GAHW,CAGP,UAACe,IAAD,EAAU;AACb,cAAMkC,GAAG,GAAGlC,IAAI,CAACD,KAAL,CAAW,GAAX,EAAgB,CAAhB,CAAZ;;AACA,cAAImC,GAAG,KAAKzD,QAAZ,EAAsB;AACpBsD,YAAAA,KAAK,GAAG,IAAR;AACA,6BAAUG,GAAV,cAAiBxC,IAAjB;AACD;;AACD,iBAAOM,IAAP;AACD,SAVW,EAWXmC,MAXW,CAWJ,UAACC,CAAD;AAAA,iBAAOA,CAAP;AAAA,SAXI,CAAd;;AAYA,YAAI,CAACL,KAAL,EAAY;AACVC,UAAAA,KAAK,CAACK,IAAN,WAAc5D,QAAd,cAA0BiB,IAA1B;AACD;;AACD,0BAAWsC,KAAK,CAACM,IAAN,CAAW,GAAX,CAAX;AACD;;AAED,wBAAW5C,IAAX;AACD;;;;;eAcYlB,I","sourcesContent":["// @ts-ignore\n// tslint:disable-next-line:no-submodule-imports\nimport { $window } from '@antv/l7-utils';\nimport { throttle } from 'lodash';\nimport { Map } from './map';\n\n/*\n * Adds the map's position to its page's location hash.\n * Passed as an option to the map object.\n *\n * @returns {Hash} `this`\n */\nclass Hash {\n private map: Map;\n private updateHash: () => number | void;\n private hashName?: string;\n\n constructor(hashName?: string) {\n this.hashName = hashName && encodeURIComponent(hashName);\n\n // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.\n this.updateHash = throttle(this.updateHashUnthrottled, (30 * 1000) / 100);\n }\n public addTo(map: Map) {\n this.map = map;\n $window.addEventListener('hashchange', this.onHashChange, false);\n this.map.on('moveend', this.updateHash);\n return this;\n }\n public remove() {\n $window.removeEventListener('hashchange', this.onHashChange, false);\n this.map.off('moveend', this.updateHash);\n // clearTimeout(this.updateHash());\n\n // @ts-ignore\n delete this.map;\n return this;\n }\n\n public onHashChange = () => {\n const loc = this.getCurrentHash();\n if (loc.length >= 3 && !loc.some((v: string) => isNaN(+v))) {\n const bearing =\n this.map.dragRotate.isEnabled() && this.map.touchZoomRotate.isEnabled()\n ? +(loc[3] || 0)\n : this.map.getBearing();\n this.map.jumpTo({\n center: [+loc[2], +loc[1]],\n zoom: +loc[0],\n bearing,\n pitch: +(loc[4] || 0),\n });\n return true;\n }\n return false;\n };\n\n private getCurrentHash = () => {\n // Get the current hash from location, stripped from its number sign\n const hash = window.location.hash.replace('#', '');\n if (this.hashName) {\n // Split the parameter-styled hash into parts and find the value we need\n let keyval;\n hash\n .split('&')\n .map((part) => part.split('='))\n .forEach((part) => {\n if (part[0] === this.hashName) {\n keyval = part;\n }\n });\n return (keyval ? keyval[1] || '' : '').split('/');\n }\n return hash.split('/');\n };\n\n private getHashString(mapFeedback?: boolean) {\n const center = this.map.getCenter();\n const zoom = Math.round(this.map.getZoom() * 100) / 100;\n // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px\n const precision = Math.ceil(\n (zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10,\n );\n const m = Math.pow(10, precision);\n const lng = Math.round(center.lng * m) / m;\n const lat = Math.round(center.lat * m) / m;\n const bearing = this.map.getBearing();\n const pitch = this.map.getPitch();\n let hash = '';\n if (mapFeedback) {\n // new map feedback site has some constraints that don't allow\n // us to use the same hash format as we do for the Map hash option.\n hash += `/${lng}/${lat}/${zoom}`;\n } else {\n hash += `${zoom}/${lat}/${lng}`;\n }\n\n if (bearing || pitch) {\n hash += `/${Math.round(bearing * 10) / 10}`;\n }\n if (pitch) {\n hash += `/${Math.round(pitch)}`;\n }\n\n if (this.hashName) {\n const hashName = this.hashName;\n let found = false;\n const parts = window.location.hash\n .slice(1)\n .split('&')\n .map((part) => {\n const key = part.split('=')[0];\n if (key === hashName) {\n found = true;\n return `${key}=${hash}`;\n }\n return part;\n })\n .filter((a) => a);\n if (!found) {\n parts.push(`${hashName}=${hash}`);\n }\n return `#${parts.join('&')}`;\n }\n\n return `#${hash}`;\n }\n\n private updateHashUnthrottled = () => {\n const hash = this.getHashString();\n try {\n window.history.replaceState(window.history.state, '', hash);\n } catch (SecurityError) {\n // IE11 does not allow this if the page is within an iframe created\n // with iframe.contentWindow.document.write(...).\n // https://github.com/mapbox/mapbox-gl-js/issues/7410\n }\n };\n}\n\nexport default Hash;\n"],"file":"hash.js"}
|
package/lib/map.js
CHANGED
|
@@ -155,7 +155,11 @@ var Map = function (_Camera) {
|
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
if (_l7Utils.isMini) {
|
|
159
|
+
_this.initMiniContainer();
|
|
160
|
+
} else {
|
|
161
|
+
_this.initContainer();
|
|
162
|
+
}
|
|
159
163
|
|
|
160
164
|
_this.resize();
|
|
161
165
|
|
|
@@ -167,10 +171,12 @@ var Map = function (_Camera) {
|
|
|
167
171
|
window.addEventListener('orientationchange', _this.onWindowResize, false);
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
|
|
174
|
+
if (!_l7Utils.isMini) {
|
|
175
|
+
var hashName = typeof options.hash === 'string' && options.hash || undefined;
|
|
171
176
|
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
if (options.hash) {
|
|
178
|
+
_this.hash = new _hash.default(hashName).addTo((0, _assertThisInitialized2.default)(_this));
|
|
179
|
+
}
|
|
174
180
|
}
|
|
175
181
|
|
|
176
182
|
if (!_this.hash || !_this.hash.onHashChange()) {
|
|
@@ -200,18 +206,23 @@ var Map = function (_Camera) {
|
|
|
200
206
|
var width = dimensions[0];
|
|
201
207
|
var height = dimensions[1];
|
|
202
208
|
this.transform.resize(width, height);
|
|
209
|
+
|
|
210
|
+
if (!_l7Utils.isMini) {
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
|
|
203
214
|
var fireMoving = !this.moving;
|
|
204
215
|
|
|
205
216
|
if (fireMoving) {
|
|
206
217
|
this.stop();
|
|
207
|
-
this.emit('movestart', new Event('movestart', eventData));
|
|
208
|
-
this.emit('move', new Event('move', eventData));
|
|
218
|
+
this.emit('movestart', new _l7Utils.$window.Event('movestart', eventData));
|
|
219
|
+
this.emit('move', new _l7Utils.$window.Event('move', eventData));
|
|
209
220
|
}
|
|
210
221
|
|
|
211
|
-
this.emit('resize', new Event('resize', eventData));
|
|
222
|
+
this.emit('resize', new _l7Utils.$window.Event('resize', eventData));
|
|
212
223
|
|
|
213
224
|
if (fireMoving) {
|
|
214
|
-
this.emit('moveend', new Event('moveend', eventData));
|
|
225
|
+
this.emit('moveend', new _l7Utils.$window.Event('moveend', eventData));
|
|
215
226
|
}
|
|
216
227
|
|
|
217
228
|
return this;
|
|
@@ -442,6 +453,12 @@ var Map = function (_Camera) {
|
|
|
442
453
|
canvasContainer.classList.add('l7-interactive');
|
|
443
454
|
}
|
|
444
455
|
}
|
|
456
|
+
}, {
|
|
457
|
+
key: "initMiniContainer",
|
|
458
|
+
value: function initMiniContainer() {
|
|
459
|
+
this.container = this.options.canvas;
|
|
460
|
+
this.canvasContainer = this.container;
|
|
461
|
+
}
|
|
445
462
|
}, {
|
|
446
463
|
key: "containerDimensions",
|
|
447
464
|
value: function containerDimensions() {
|
|
@@ -449,21 +466,17 @@ var Map = function (_Camera) {
|
|
|
449
466
|
var height = 0;
|
|
450
467
|
|
|
451
468
|
if (this.container) {
|
|
452
|
-
|
|
453
|
-
|
|
469
|
+
if (_l7Utils.isMini) {
|
|
470
|
+
width = this.container.width;
|
|
471
|
+
height = this.container.height;
|
|
472
|
+
} else {
|
|
473
|
+
width = this.container.clientWidth;
|
|
474
|
+
height = this.container.clientHeight;
|
|
475
|
+
}
|
|
454
476
|
}
|
|
455
477
|
|
|
456
478
|
return [width, height];
|
|
457
479
|
}
|
|
458
|
-
}, {
|
|
459
|
-
key: "resizeCanvas",
|
|
460
|
-
value: function resizeCanvas(width, height) {
|
|
461
|
-
var pixelRatio = _l7Utils.DOM.DPR || 1;
|
|
462
|
-
this.canvas.width = pixelRatio * width;
|
|
463
|
-
this.canvas.height = pixelRatio * height;
|
|
464
|
-
this.canvas.style.width = "".concat(width, "px");
|
|
465
|
-
this.canvas.style.height = "".concat(height, "px");
|
|
466
|
-
}
|
|
467
480
|
}]);
|
|
468
481
|
return Map;
|
|
469
482
|
}(_camera.default);
|
package/lib/map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/map.ts"],"names":["defaultMinZoom","defaultMaxZoom","defaultMinPitch","defaultMaxPitch","DefaultOptions","hash","zoom","center","pitch","bearing","interactive","minZoom","maxZoom","minPitch","maxPitch","scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch","bearingSnap","clickTolerance","pitchWithRotate","trackResize","renderWorldCopies","Map","options","TaskQueue","update","event","resize","originalEvent","initContainer","handlers","HandlerManager","window","addEventListener","onWindowOnline","onWindowResize","hashName","undefined","Hash","addTo","onHashChange","jumpTo","bounds","fitBounds","fitBoundsOptions","duration","eventData","dimensions","containerDimensions","width","height","transform","fireMoving","moving","stop","emit","Event","container","canvas","canvasContainer","lngLat","locationPoint","LngLat","convert","point","pointLocation","Point","getBounds","getMaxBounds","setMaxBounds","LngLatBounds","style","getZoom","setZoom","Error","getPitch","setPitch","frame","cancel","renderTaskQueue","clear","cb","add","id","remove","paintStartTimeStamp","PerformanceUtils","time","run","document","getElementById","HTMLElement","classList","DOM","create","clientWidth","clientHeight","pixelRatio","DPR","Camera"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AASA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,cAAc,GAAG,CAAC,CAAxB;AACA,IAAMC,cAAc,GAAG,EAAvB;AAGA,IAAMC,eAAe,GAAG,CAAxB;AACA,IAAMC,eAAe,GAAG,EAAxB;AAEA,IAAMC,cAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE,KAD4B;AAElCC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L,CAAYR,MAAZ,GAAqB+C,UAAU,GAAG/C,MAAlC;AAGA,WAAKQ,MAAL,CAAYa,KAAZ,CAAkBtB,KAAlB,aAA6BA,KAA7B;AACA,WAAKS,MAAL,CAAYa,KAAZ,CAAkBrB,MAAlB,aAA8BA,MAA9B;AACD;;;EAxTsBiD,e","sourcesContent":["import { DOM } from '@antv/l7-utils';\nimport { merge } from 'lodash';\nimport Camera from './camera';\nimport './css/l7.css';\nimport LngLat, { LngLatLike } from './geo/lng_lat';\nimport LngLatBounds, { LngLatBoundsLike } from './geo/lng_lat_bounds';\n// @ts-ignore\nimport Point, { PointLike } from './geo/point';\nimport BoxZoomHandler from './handler/box_zoom';\nimport HandlerManager from './handler/handler_manager';\nimport KeyboardHandler from './handler/keyboard';\n\nimport ScrollZoomHandler from './handler/scroll_zoom';\nimport DoubleClickZoomHandler from './handler/shim/dblclick_zoom';\nimport DragPanHandler from './handler/shim/drag_pan';\nimport DragRotateHandler from './handler/shim/drag_rotate';\nimport TouchZoomRotateHandler from './handler/shim/touch_zoom_rotate';\nimport { TouchPitchHandler } from './handler/touch';\nimport Hash from './hash';\nimport { IMapOptions } from './interface';\nimport { renderframe } from './util';\nimport { PerformanceUtils } from './utils/performance';\nimport TaskQueue, { TaskID } from './utils/task_queue';\ntype CallBack = (_: number) => void;\nconst defaultMinZoom = -2;\nconst defaultMaxZoom = 22;\n\n// the default values, but also the valid range\nconst defaultMinPitch = 0;\nconst defaultMaxPitch = 60;\n\nconst DefaultOptions: IMapOptions = {\n hash: false,\n zoom: -1,\n center: [112, 32],\n pitch: 0,\n bearing: 0,\n interactive: true,\n minZoom: defaultMinZoom,\n maxZoom: defaultMaxZoom,\n minPitch: defaultMinPitch,\n maxPitch: defaultMaxPitch,\n scrollZoom: true,\n boxZoom: true,\n dragRotate: true,\n dragPan: true,\n keyboard: true,\n doubleClickZoom: true,\n touchZoomRotate: true,\n touchPitch: true,\n bearingSnap: 7,\n clickTolerance: 3,\n pitchWithRotate: true,\n trackResize: true,\n renderWorldCopies: true,\n};\nexport class Map extends Camera {\n public doubleClickZoom: DoubleClickZoomHandler;\n public dragRotate: DragRotateHandler;\n public dragPan: DragPanHandler;\n public touchZoomRotate: TouchZoomRotateHandler;\n public scrollZoom: ScrollZoomHandler;\n public keyboard: KeyboardHandler;\n public touchPitch: TouchPitchHandler;\n public boxZoom: BoxZoomHandler;\n public handlers: HandlerManager;\n\n private container: HTMLElement;\n private canvas: HTMLCanvasElement;\n private canvasContainer: HTMLElement;\n private renderTaskQueue: TaskQueue = new TaskQueue();\n private frame: { cancel: () => void } | null;\n private trackResize: boolean = true;\n private hash: Hash | undefined;\n constructor(options: Partial<IMapOptions>) {\n super(merge({}, DefaultOptions, options));\n this.initContainer();\n this.resize();\n this.handlers = new HandlerManager(this, this.options);\n // this.on('move', () => this.update());\n // this.on('moveend', () => this.update());\n // this.on('zoom', () => {\n // console.log('zoom');\n // });\n\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this.onWindowOnline, false);\n window.addEventListener('resize', this.onWindowResize, false);\n window.addEventListener('orientationchange', this.onWindowResize, false);\n }\n\n const hashName =\n (typeof options.hash === 'string' && options.hash) || undefined;\n if (options.hash) {\n this.hash = new Hash(hashName).addTo(this) as Hash;\n }\n\n // don't set position from options if set through hash\n if (!this.hash || !this.hash.onHashChange()) {\n this.jumpTo({\n center: options.center,\n zoom: options.zoom,\n bearing: options.bearing,\n pitch: options.pitch,\n });\n\n if (options.bounds) {\n this.resize();\n this.fitBounds(\n options.bounds,\n merge({}, options.fitBoundsOptions, { duration: 0 }),\n );\n }\n }\n }\n\n public resize(eventData?: any) {\n const dimensions = this.containerDimensions();\n const width = dimensions[0];\n const height = dimensions[1];\n\n // this.resizeCanvas(width, height);\n this.transform.resize(width, height);\n const fireMoving = !this.moving;\n if (fireMoving) {\n this.stop();\n this.emit('movestart', new Event('movestart', eventData));\n this.emit('move', new Event('move', eventData));\n }\n\n this.emit('resize', new Event('resize', eventData));\n\n if (fireMoving) {\n this.emit('moveend', new Event('moveend', eventData));\n }\n\n return this;\n }\n\n public getContainer() {\n return this.container;\n }\n\n public getCanvas() {\n return this.canvas;\n }\n\n public getCanvasContainer() {\n return this.canvasContainer;\n }\n\n public project(lngLat: LngLatLike) {\n return this.transform.locationPoint(LngLat.convert(lngLat));\n }\n\n public unproject(point: PointLike) {\n return this.transform.pointLocation(Point.convert(point));\n }\n\n public getBounds(): LngLatBounds {\n return this.transform.getBounds();\n }\n\n public getMaxBounds(): LngLatBounds | null {\n return this.transform.getMaxBounds();\n }\n\n public setMaxBounds(bounds: LngLatBoundsLike) {\n this.transform.setMaxBounds(LngLatBounds.convert(bounds));\n }\n\n public setStyle(style: any) {\n return;\n }\n public setMinZoom(minZoom?: number) {\n minZoom =\n minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;\n if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {\n this.transform.minZoom = minZoom;\n if (this.getZoom() < minZoom) {\n this.setZoom(minZoom);\n }\n\n return this;\n } else {\n throw new Error(\n `minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`,\n );\n }\n }\n\n public getMinZoom() {\n return this.transform.minZoom;\n }\n\n public setMaxZoom(maxZoom?: number) {\n maxZoom =\n maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;\n\n if (maxZoom >= this.transform.minZoom) {\n this.transform.maxZoom = maxZoom;\n if (this.getZoom() > maxZoom) {\n this.setZoom(maxZoom);\n }\n\n return this;\n } else {\n throw new Error('maxZoom must be greater than the current minZoom');\n }\n }\n public getMaxZoom() {\n return this.transform.maxZoom;\n }\n\n public setMinPitch(minPitch?: number) {\n minPitch =\n minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;\n\n if (minPitch < defaultMinPitch) {\n throw new Error(\n `minPitch must be greater than or equal to ${defaultMinPitch}`,\n );\n }\n\n if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {\n this.transform.minPitch = minPitch;\n if (this.getPitch() < minPitch) {\n this.setPitch(minPitch);\n }\n\n return this;\n } else {\n throw new Error(\n `minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`,\n );\n }\n }\n\n public getMinPitch() {\n return this.transform.minPitch;\n }\n\n public setMaxPitch(maxPitch?: number) {\n maxPitch =\n maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;\n\n if (maxPitch > defaultMaxPitch) {\n throw new Error(\n `maxPitch must be less than or equal to ${defaultMaxPitch}`,\n );\n }\n\n if (maxPitch >= this.transform.minPitch) {\n this.transform.maxPitch = maxPitch;\n if (this.getPitch() > maxPitch) {\n this.setPitch(maxPitch);\n }\n\n return this;\n } else {\n throw new Error('maxPitch must be greater than the current minPitch');\n }\n }\n\n public getMaxPitch() {\n return this.transform.maxPitch;\n }\n\n public getRenderWorldCopies() {\n return this.transform.renderWorldCopies;\n }\n\n public setRenderWorldCopies(renderWorldCopies?: boolean) {\n this.transform.renderWorldCopies = !!renderWorldCopies;\n }\n\n public remove() {\n if (this.frame) {\n this.frame.cancel();\n this.frame = null;\n }\n this.renderTaskQueue.clear();\n }\n\n public requestRenderFrame(cb: CallBack): TaskID {\n this.update();\n return this.renderTaskQueue.add(cb);\n }\n\n public cancelRenderFrame(id: TaskID) {\n return this.renderTaskQueue.remove(id);\n }\n\n public triggerRepaint() {\n if (!this.frame) {\n this.frame = renderframe((paintStartTimeStamp: number) => {\n PerformanceUtils.frame(paintStartTimeStamp);\n this.frame = null;\n this.update(paintStartTimeStamp);\n });\n }\n }\n\n public update(time?: number) {\n if (!this.frame) {\n this.frame = renderframe((paintStartTimeStamp: number) => {\n PerformanceUtils.frame(paintStartTimeStamp);\n this.frame = null;\n this.renderTaskQueue.run(time);\n });\n }\n }\n\n private initContainer() {\n if (typeof this.options.container === 'string') {\n this.container = window.document.getElementById(\n this.options.container,\n ) as HTMLElement;\n if (!this.container) {\n throw new Error(`Container '${this.options.container}' not found.`);\n }\n } else if (this.options.container instanceof HTMLElement) {\n this.container = this.options.container;\n } else {\n throw new Error(\n \"Invalid type: 'container' must be a String or HTMLElement.\",\n );\n }\n\n const container = this.container;\n container.classList.add('l7-map');\n\n const canvasContainer = (this.canvasContainer = DOM.create(\n 'div',\n 'l7-canvas-container',\n container,\n ));\n if (this.options.interactive) {\n canvasContainer.classList.add('l7-interactive');\n }\n\n // this.canvas = DOM.create(\n // 'canvas',\n // 'l7-canvas',\n // canvasContainer,\n // ) as HTMLCanvasElement;\n // this.canvas.setAttribute('tabindex', '-');\n // this.canvas.setAttribute('aria-label', 'Map');\n }\n\n private containerDimensions(): [number, number] {\n let width = 0;\n let height = 0;\n if (this.container) {\n width = this.container.clientWidth || 400;\n height = this.container.clientHeight || 300;\n }\n return [width, height];\n }\n\n private resizeCanvas(width: number, height: number) {\n const pixelRatio = DOM.DPR || 1;\n this.canvas.width = pixelRatio * width;\n this.canvas.height = pixelRatio * height;\n\n // Maintain the same canvas size, potentially downscaling it for HiDPI displays\n this.canvas.style.width = `${width}px`;\n this.canvas.style.height = `${height}px`;\n }\n\n private onWindowOnline = () => {\n this.update();\n };\n\n private onWindowResize = (event: Event) => {\n if (this.trackResize) {\n this.resize({ originalEvent: event }).update();\n }\n };\n}\n"],"file":"map.js"}
|
|
1
|
+
{"version":3,"sources":["../src/map.ts"],"names":["defaultMinZoom","defaultMaxZoom","defaultMinPitch","defaultMaxPitch","DefaultOptions","hash","zoom","center","pitch","bearing","interactive","minZoom","maxZoom","minPitch","maxPitch","scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch","bearingSnap","clickTolerance","pitchWithRotate","trackResize","renderWorldCopies","Map","options","TaskQueue","update","event","resize","originalEvent","isMini","initMiniContainer","initContainer","handlers","HandlerManager","window","addEventListener","onWindowOnline","onWindowResize","hashName","undefined","Hash","addTo","onHashChange","jumpTo","bounds","fitBounds","fitBoundsOptions","duration","eventData","dimensions","containerDimensions","width","height","transform","fireMoving","moving","stop","emit","$window","Event","container","canvas","canvasContainer","lngLat","locationPoint","LngLat","convert","point","pointLocation","Point","getBounds","getMaxBounds","setMaxBounds","LngLatBounds","style","getZoom","setZoom","Error","getPitch","setPitch","frame","cancel","renderTaskQueue","clear","cb","add","id","remove","paintStartTimeStamp","PerformanceUtils","time","run","document","getElementById","HTMLElement","classList","DOM","create","clientWidth","clientHeight","Camera"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AASA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,cAAc,GAAG,CAAC,CAAxB;AACA,IAAMC,cAAc,GAAG,EAAvB;AAGA,IAAMC,eAAe,GAAG,CAAxB;AACA,IAAMC,eAAe,GAAG,EAAxB;AAEA,IAAMC,cAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE,KAD4B;AAElCC,EAAAA,IAAI,EAAE,CAAC,CAF2B;AAGlCC,EAAAA,MAAM,EAAE,CAAC,GAAD,EAAM,EAAN,CAH0B;AAIlCC,EAAAA,KAAK,EAAE,CAJ2B;AAKlCC,EAAAA,OAAO,EAAE,CALyB;AAMlCC,EAAAA,WAAW,EAAE,IANqB;AAOlCC,EAAAA,OAAO,EAAEX,cAPyB;AAQlCY,EAAAA,OAAO,EAAEX,cARyB;AASlCY,EAAAA,QAAQ,EAAEX,eATwB;AAUlCY,EAAAA,QAAQ,EAAEX,eAVwB;AAWlCY,EAAAA,UAAU,EAAE,IAXsB;AAYlCC,EAAAA,OAAO,EAAE,IAZyB;AAalCC,EAAAA,UAAU,EAAE,IAbsB;AAclCC,EAAAA,OAAO,EAAE,IAdyB;AAelCC,EAAAA,QAAQ,EAAE,IAfwB;AAgBlCC,EAAAA,eAAe,EAAE,IAhBiB;AAiBlCC,EAAAA,eAAe,EAAE,IAjBiB;AAkBlCC,EAAAA,UAAU,EAAE,IAlBsB;AAmBlCC,EAAAA,WAAW,EAAE,CAnBqB;AAoBlCC,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,SAAV,CAAoBV,GAApB,CAAwB,QAAxB;;AAEA,UAAMvB,eAAe,GAAI,KAAKA,eAAL,GAAuBkC,aAAIC,MAAJ,CAC9C,KAD8C,EAE9C,qBAF8C,EAG9CrC,SAH8C,CAAhD;;AAKA,UAAI,KAAKrC,OAAL,CAAanB,WAAjB,EAA8B;AAC5B0D,QAAAA,eAAe,CAACiC,SAAhB,CAA0BV,GAA1B,CAA8B,gBAA9B;AACD;AACF;;;WAKD,6BAA4B;AAC1B,WAAKzB,SAAL,GAAiB,KAAKrC,OAAL,CAAasC,MAA9B;AACA,WAAKC,eAAL,GAAuB,KAAKF,SAA5B;AACD;;;WAED,+BAAgD;AAC9C,UAAIT,KAAK,GAAG,CAAZ;AACA,UAAIC,MAAM,GAAG,CAAb;;AACA,UAAI,KAAKQ,SAAT,EAAoB;AAClB,YAAI/B,eAAJ,EAAY;AACVsB,UAAAA,KAAK,GAAI,KAAKS,SAAN,CAAsCT,KAA9C;AACAC,UAAAA,MAAM,GAAI,KAAKQ,SAAN,CAAsCR,MAA/C;AACD,SAHD,MAGO;AACLD,UAAAA,KAAK,GAAG,KAAKS,SAAL,CAAesC,WAAvB;AACA9C,UAAAA,MAAM,GAAG,KAAKQ,SAAL,CAAeuC,YAAxB;AACD;AACF;;AACD,aAAO,CAAChD,KAAD,EAAQC,MAAR,CAAP;AACD;;;EAvTsBgD,e","sourcesContent":["import { $window, DOM, isMini } from '@antv/l7-utils';\nimport { merge } from 'lodash';\nimport Camera from './camera';\nimport './css/l7.css';\nimport LngLat, { LngLatLike } from './geo/lng_lat';\nimport LngLatBounds, { LngLatBoundsLike } from './geo/lng_lat_bounds';\n// @ts-ignore\nimport Point, { PointLike } from './geo/point';\nimport BoxZoomHandler from './handler/box_zoom';\nimport HandlerManager from './handler/handler_manager';\nimport KeyboardHandler from './handler/keyboard';\n\nimport ScrollZoomHandler from './handler/scroll_zoom';\nimport DoubleClickZoomHandler from './handler/shim/dblclick_zoom';\nimport DragPanHandler from './handler/shim/drag_pan';\nimport DragRotateHandler from './handler/shim/drag_rotate';\nimport TouchZoomRotateHandler from './handler/shim/touch_zoom_rotate';\nimport { TouchPitchHandler } from './handler/touch';\nimport Hash from './hash';\nimport { IMapOptions } from './interface';\nimport { renderframe } from './util';\nimport { PerformanceUtils } from './utils/performance';\nimport TaskQueue, { TaskID } from './utils/task_queue';\ntype CallBack = (_: number) => void;\nconst defaultMinZoom = -2;\nconst defaultMaxZoom = 22;\n\n// the default values, but also the valid range\nconst defaultMinPitch = 0;\nconst defaultMaxPitch = 60;\n\nconst DefaultOptions: IMapOptions = {\n hash: false,\n zoom: -1,\n center: [112, 32],\n pitch: 0,\n bearing: 0,\n interactive: true,\n minZoom: defaultMinZoom,\n maxZoom: defaultMaxZoom,\n minPitch: defaultMinPitch,\n maxPitch: defaultMaxPitch,\n scrollZoom: true,\n boxZoom: true,\n dragRotate: true,\n dragPan: true,\n keyboard: true,\n doubleClickZoom: true,\n touchZoomRotate: true,\n touchPitch: true,\n bearingSnap: 7,\n clickTolerance: 3,\n pitchWithRotate: true,\n trackResize: true,\n renderWorldCopies: true,\n};\nexport class Map extends Camera {\n public doubleClickZoom: DoubleClickZoomHandler;\n public dragRotate: DragRotateHandler;\n public dragPan: DragPanHandler;\n public touchZoomRotate: TouchZoomRotateHandler;\n public scrollZoom: ScrollZoomHandler;\n public keyboard: KeyboardHandler;\n public touchPitch: TouchPitchHandler;\n public boxZoom: BoxZoomHandler;\n public handlers: HandlerManager;\n\n private container: HTMLElement;\n private canvas: HTMLCanvasElement;\n private canvasContainer: HTMLElement;\n private renderTaskQueue: TaskQueue = new TaskQueue();\n private frame: { cancel: () => void } | null;\n private trackResize: boolean = true;\n private hash: Hash | undefined;\n constructor(options: Partial<IMapOptions>) {\n super(merge({}, DefaultOptions, options));\n if (isMini) {\n this.initMiniContainer();\n } else {\n this.initContainer();\n }\n\n this.resize();\n this.handlers = new HandlerManager(this, this.options);\n\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this.onWindowOnline, false);\n window.addEventListener('resize', this.onWindowResize, false);\n window.addEventListener('orientationchange', this.onWindowResize, false);\n }\n\n if (!isMini) {\n const hashName =\n (typeof options.hash === 'string' && options.hash) || undefined;\n if (options.hash) {\n this.hash = new Hash(hashName).addTo(this) as Hash;\n }\n }\n\n // don't set position from options if set through hash\n if (!this.hash || !this.hash.onHashChange()) {\n this.jumpTo({\n center: options.center,\n zoom: options.zoom,\n bearing: options.bearing,\n pitch: options.pitch,\n });\n\n if (options.bounds) {\n this.resize();\n this.fitBounds(\n options.bounds,\n merge({}, options.fitBoundsOptions, { duration: 0 }),\n );\n }\n }\n }\n\n public resize(eventData?: any) {\n const dimensions = this.containerDimensions();\n const width = dimensions[0];\n const height = dimensions[1];\n\n this.transform.resize(width, height);\n if (!isMini) {\n return this;\n }\n const fireMoving = !this.moving;\n if (fireMoving) {\n this.stop();\n this.emit('movestart', new $window.Event('movestart', eventData));\n this.emit('move', new $window.Event('move', eventData));\n }\n\n this.emit('resize', new $window.Event('resize', eventData));\n\n if (fireMoving) {\n this.emit('moveend', new $window.Event('moveend', eventData));\n }\n\n return this;\n }\n\n public getContainer() {\n return this.container;\n }\n\n public getCanvas() {\n return this.canvas;\n }\n\n public getCanvasContainer() {\n return this.canvasContainer;\n }\n\n public project(lngLat: LngLatLike) {\n return this.transform.locationPoint(LngLat.convert(lngLat));\n }\n\n public unproject(point: PointLike) {\n return this.transform.pointLocation(Point.convert(point));\n }\n\n public getBounds(): LngLatBounds {\n return this.transform.getBounds();\n }\n\n public getMaxBounds(): LngLatBounds | null {\n return this.transform.getMaxBounds();\n }\n\n public setMaxBounds(bounds: LngLatBoundsLike) {\n this.transform.setMaxBounds(LngLatBounds.convert(bounds));\n }\n\n public setStyle(style: any) {\n return;\n }\n public setMinZoom(minZoom?: number) {\n minZoom =\n minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;\n if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {\n this.transform.minZoom = minZoom;\n if (this.getZoom() < minZoom) {\n this.setZoom(minZoom);\n }\n\n return this;\n } else {\n throw new Error(\n `minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`,\n );\n }\n }\n\n public getMinZoom() {\n return this.transform.minZoom;\n }\n\n public setMaxZoom(maxZoom?: number) {\n maxZoom =\n maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;\n\n if (maxZoom >= this.transform.minZoom) {\n this.transform.maxZoom = maxZoom;\n if (this.getZoom() > maxZoom) {\n this.setZoom(maxZoom);\n }\n\n return this;\n } else {\n throw new Error('maxZoom must be greater than the current minZoom');\n }\n }\n public getMaxZoom() {\n return this.transform.maxZoom;\n }\n\n public setMinPitch(minPitch?: number) {\n minPitch =\n minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;\n\n if (minPitch < defaultMinPitch) {\n throw new Error(\n `minPitch must be greater than or equal to ${defaultMinPitch}`,\n );\n }\n\n if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {\n this.transform.minPitch = minPitch;\n if (this.getPitch() < minPitch) {\n this.setPitch(minPitch);\n }\n\n return this;\n } else {\n throw new Error(\n `minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`,\n );\n }\n }\n\n public getMinPitch() {\n return this.transform.minPitch;\n }\n\n public setMaxPitch(maxPitch?: number) {\n maxPitch =\n maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;\n\n if (maxPitch > defaultMaxPitch) {\n throw new Error(\n `maxPitch must be less than or equal to ${defaultMaxPitch}`,\n );\n }\n\n if (maxPitch >= this.transform.minPitch) {\n this.transform.maxPitch = maxPitch;\n if (this.getPitch() > maxPitch) {\n this.setPitch(maxPitch);\n }\n\n return this;\n } else {\n throw new Error('maxPitch must be greater than the current minPitch');\n }\n }\n\n public getMaxPitch() {\n return this.transform.maxPitch;\n }\n\n public getRenderWorldCopies() {\n return this.transform.renderWorldCopies;\n }\n\n public setRenderWorldCopies(renderWorldCopies?: boolean) {\n this.transform.renderWorldCopies = !!renderWorldCopies;\n }\n\n public remove() {\n if (this.frame) {\n this.frame.cancel();\n this.frame = null;\n }\n this.renderTaskQueue.clear();\n }\n\n public requestRenderFrame(cb: CallBack): TaskID {\n this.update();\n return this.renderTaskQueue.add(cb);\n }\n\n public cancelRenderFrame(id: TaskID) {\n return this.renderTaskQueue.remove(id);\n }\n\n public triggerRepaint() {\n if (!this.frame) {\n this.frame = renderframe((paintStartTimeStamp: number) => {\n PerformanceUtils.frame(paintStartTimeStamp);\n this.frame = null;\n this.update(paintStartTimeStamp);\n });\n }\n }\n\n public update(time?: number) {\n if (!this.frame) {\n this.frame = renderframe((paintStartTimeStamp: number) => {\n PerformanceUtils.frame(paintStartTimeStamp);\n this.frame = null;\n this.renderTaskQueue.run(time);\n });\n }\n }\n\n private initContainer() {\n if (typeof this.options.container === 'string') {\n this.container = window.document.getElementById(\n this.options.container,\n ) as HTMLElement;\n if (!this.container) {\n throw new Error(`Container '${this.options.container}' not found.`);\n }\n } else if (this.options.container instanceof HTMLElement) {\n this.container = this.options.container;\n } else {\n throw new Error(\n \"Invalid type: 'container' must be a String or HTMLElement.\",\n );\n }\n\n const container = this.container;\n container.classList.add('l7-map');\n\n const canvasContainer = (this.canvasContainer = DOM.create(\n 'div',\n 'l7-canvas-container',\n container,\n ));\n if (this.options.interactive) {\n canvasContainer.classList.add('l7-interactive');\n }\n }\n\n /**\n * 小程序环境构建容器\n */\n private initMiniContainer() {\n this.container = this.options.canvas as HTMLCanvasElement;\n this.canvasContainer = this.container;\n }\n\n private containerDimensions(): [number, number] {\n let width = 0;\n let height = 0;\n if (this.container) {\n if (isMini) {\n width = (this.container as HTMLCanvasElement).width;\n height = (this.container as HTMLCanvasElement).height;\n } else {\n width = this.container.clientWidth;\n height = this.container.clientHeight;\n }\n }\n return [width, height];\n }\n\n private onWindowOnline = () => {\n this.update();\n };\n\n private onWindowResize = (event: Event) => {\n if (this.trackResize) {\n this.resize({ originalEvent: event }).update();\n }\n };\n}\n"],"file":"map.js"}
|
package/lib/util.js
CHANGED
|
@@ -5,14 +5,19 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.bezier = bezier;
|
|
9
|
+
exports.cancel = void 0;
|
|
9
10
|
exports.clamp = clamp;
|
|
11
|
+
exports.ease = void 0;
|
|
10
12
|
exports.interpolate = interpolate;
|
|
11
|
-
exports.
|
|
12
|
-
exports.prefersReducedMotion = prefersReducedMotion;
|
|
13
|
+
exports.now = void 0;
|
|
13
14
|
exports.pick = pick;
|
|
15
|
+
exports.prefersReducedMotion = prefersReducedMotion;
|
|
16
|
+
exports.raf = void 0;
|
|
14
17
|
exports.renderframe = renderframe;
|
|
15
|
-
exports.
|
|
18
|
+
exports.wrap = wrap;
|
|
19
|
+
|
|
20
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
16
21
|
|
|
17
22
|
var _unitbezier = _interopRequireDefault(require("@mapbox/unitbezier"));
|
|
18
23
|
|
|
@@ -49,12 +54,12 @@ var ease = bezier(0.25, 0.1, 0.25, 1);
|
|
|
49
54
|
exports.ease = ease;
|
|
50
55
|
|
|
51
56
|
function prefersReducedMotion() {
|
|
52
|
-
if (!window.matchMedia) {
|
|
57
|
+
if (_l7Utils.isMini || !_l7Utils.$window.matchMedia) {
|
|
53
58
|
return false;
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
if (reducedMotionQuery == null) {
|
|
57
|
-
reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
62
|
+
reducedMotionQuery = _l7Utils.$window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
return reducedMotionQuery.matches;
|
|
@@ -83,12 +88,12 @@ function pick(src, properties) {
|
|
|
83
88
|
return result;
|
|
84
89
|
}
|
|
85
90
|
|
|
86
|
-
var now = window.performance && window.performance.now ? window.performance.now.bind(window.performance) : Date.now.bind(Date);
|
|
91
|
+
var now = _l7Utils.isMini ? Date.now.bind(Date) : _l7Utils.$window.performance && _l7Utils.$window.performance.now ? _l7Utils.$window.performance.now.bind(_l7Utils.$window.performance) : Date.now.bind(Date);
|
|
87
92
|
exports.now = now;
|
|
88
|
-
var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
|
|
93
|
+
var raf = _l7Utils.$window.requestAnimationFrame || _l7Utils.$window.mozRequestAnimationFrame || _l7Utils.$window.webkitRequestAnimationFrame || _l7Utils.$window.msRequestAnimationFrame;
|
|
89
94
|
exports.raf = raf;
|
|
90
95
|
|
|
91
|
-
var _cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame;
|
|
96
|
+
var _cancel = _l7Utils.$window.cancelAnimationFrame || _l7Utils.$window.mozCancelAnimationFrame || _l7Utils.$window.webkitCancelAnimationFrame || _l7Utils.$window.msCancelAnimationFrame;
|
|
92
97
|
|
|
93
98
|
exports.cancel = _cancel;
|
|
94
99
|
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util.ts"],"names":["reducedMotionQuery","wrap","n","min","max","d","w","clamp","Math","interpolate","a","b","t","bezier","p1x","p1y","p2x","p2y","bez","UnitBezier","solve","ease","prefersReducedMotion","window","matchMedia","matches","pick","src","properties","result","name","now","
|
|
1
|
+
{"version":3,"sources":["../src/util.ts"],"names":["reducedMotionQuery","wrap","n","min","max","d","w","clamp","Math","interpolate","a","b","t","bezier","p1x","p1y","p2x","p2y","bez","UnitBezier","solve","ease","prefersReducedMotion","isMini","$window","matchMedia","matches","pick","src","properties","result","name","now","Date","bind","performance","raf","requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","cancel","cancelAnimationFrame","mozCancelAnimationFrame","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port UnitBezier from '@mapbox/unitbezier';\nlet reducedMotionQuery: MediaQueryList;\nexport interface ICancelable {\n cancel: () => void;\n}\nexport function wrap(n: number, min: number, max: number): number {\n const d = max - min;\n const w = ((((n - min) % d) + d) % d) + min;\n return w === min ? max : w;\n}\n\nexport function clamp(n: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, n));\n}\n\nexport function interpolate(a: number, b: number, t: number) {\n return a * (1 - t) + b * t;\n}\nexport function bezier(\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number,\n): (t: number) => number {\n const bez = new UnitBezier(p1x, p1y, p2x, p2y);\n return (t: number) => {\n return bez.solve(t);\n };\n}\n\nexport const ease = bezier(0.25, 0.1, 0.25, 1);\n\nexport function prefersReducedMotion(): boolean {\n // @ts-ignore\n if (isMini || !$window.matchMedia) {\n return false;\n }\n // Lazily initialize media query\n if (reducedMotionQuery == null) {\n // @ts-ignore\n reducedMotionQuery = $window.matchMedia('(prefers-reduced-motion: reduce)');\n }\n return reducedMotionQuery.matches;\n}\n\nexport function pick(\n src: { [key: string]: any },\n properties: string[],\n): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n for (const name of properties) {\n if (name in src) {\n result[name] = src[name];\n }\n }\n return result;\n}\n\nexport const now = isMini\n ? Date.now.bind(Date)\n : $window.performance && $window.performance.now\n ? $window.performance.now.bind($window.performance)\n : Date.now.bind(Date);\n\nexport const raf =\n $window.requestAnimationFrame ||\n // @ts-ignore\n $window.mozRequestAnimationFrame ||\n // @ts-ignore\n $window.webkitRequestAnimationFrame ||\n // @ts-ignore\n $window.msRequestAnimationFrame;\n\nexport const cancel =\n $window.cancelAnimationFrame ||\n // @ts-ignore\n $window.mozCancelAnimationFrame ||\n // @ts-ignore\n $window.webkitCancelAnimationFrame ||\n // @ts-ignore\n $window.msCancelAnimationFrame;\n\nexport function renderframe(\n fn: (paintStartTimestamp: number) => void,\n): ICancelable {\n const frame = raf(fn);\n return { cancel: () => cancel(frame) };\n}\n"],"file":"util.js"}
|