@antv/l7-map 2.5.37-mini → 2.5.37-mini10

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/lib/utils/dom.js CHANGED
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _l7Utils = require("@antv/l7-utils");
11
-
12
10
  var _point = _interopRequireDefault(require("../geo/point"));
13
11
 
14
12
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -22,7 +20,7 @@ var _default = DOM;
22
20
  exports.default = _default;
23
21
 
24
22
  DOM.create = function (tagName, className, container) {
25
- var el = _l7Utils.$window.document.createElement(tagName);
23
+ var el = window.document.createElement(tagName);
26
24
 
27
25
  if (className !== undefined) {
28
26
  el.className = className;
@@ -36,12 +34,11 @@ DOM.create = function (tagName, className, container) {
36
34
  };
37
35
 
38
36
  DOM.createNS = function (namespaceURI, tagName) {
39
- var el = _l7Utils.$window.document.createElementNS(namespaceURI, tagName);
40
-
37
+ var el = window.document.createElementNS(namespaceURI, tagName);
41
38
  return el;
42
39
  };
43
40
 
44
- var docStyle = _l7Utils.$window.document && _l7Utils.$window.document.documentElement.style;
41
+ var docStyle = window.document && window.document.documentElement.style;
45
42
 
46
43
  function testProp(props) {
47
44
  if (!docStyle) {
@@ -98,10 +95,8 @@ try {
98
95
  passiveSupported = true;
99
96
  }
100
97
  });
101
-
102
- _l7Utils.$window.addEventListener('test', options, options);
103
-
104
- _l7Utils.$window.removeEventListener('test', options, options);
98
+ window.addEventListener('test', options, options);
99
+ window.removeEventListener('test', options, options);
105
100
  } catch (err) {
106
101
  passiveSupported = false;
107
102
  }
@@ -129,79 +124,44 @@ DOM.removeEventListener = function (target, type, callback) {
129
124
  var suppressClick = function suppressClick(e) {
130
125
  e.preventDefault();
131
126
  e.stopPropagation();
132
-
133
- _l7Utils.$window.removeEventListener('click', suppressClick, true);
127
+ window.removeEventListener('click', suppressClick, true);
134
128
  };
135
129
 
136
130
  DOM.suppressClick = function () {
137
- if (_l7Utils.isMini) {
138
- return;
139
- }
140
-
141
- _l7Utils.$window.addEventListener('click', suppressClick, true);
142
-
143
- setTimeout(function () {
144
- _l7Utils.$window.removeEventListener('click', suppressClick, true);
131
+ window.addEventListener('click', suppressClick, true);
132
+ window.setTimeout(function () {
133
+ window.removeEventListener('click', suppressClick, true);
145
134
  }, 0);
146
135
  };
147
136
 
148
137
  DOM.mousePos = function (el, e) {
149
- if (!_l7Utils.isMini) {
150
- var rect = el.getBoundingClientRect();
151
- return new _point.default(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop);
152
- } else {
153
- return new _point.default(e.clientX - el.left - 0, e.clientY - el.top - 0);
154
- }
138
+ var rect = el.getBoundingClientRect();
139
+ return new _point.default(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop);
155
140
  };
156
141
 
157
142
  DOM.touchPos = function (el, touches) {
158
- if (!_l7Utils.isMini) {
159
- var rect = el.getBoundingClientRect();
160
- var points = [];
143
+ var rect = el.getBoundingClientRect();
144
+ var points = [];
161
145
 
162
- var _iterator2 = _createForOfIteratorHelper(touches),
163
- _step2;
164
-
165
- try {
166
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
167
- var touche = _step2.value;
168
- points.push(new _point.default(touche.clientX - rect.left - el.clientLeft, touche.clientY - rect.top - el.clientTop));
169
- }
170
- } catch (err) {
171
- _iterator2.e(err);
172
- } finally {
173
- _iterator2.f();
174
- }
146
+ var _iterator2 = _createForOfIteratorHelper(touches),
147
+ _step2;
175
148
 
176
- return points;
177
- } else {
178
- var _points = [];
179
-
180
- var _iterator3 = _createForOfIteratorHelper(touches),
181
- _step3;
182
-
183
- try {
184
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
185
- var _touche = _step3.value;
186
-
187
- _points.push(new _point.default(_touche.clientX - el.left, _touche.clientY - el.top));
188
- }
189
- } catch (err) {
190
- _iterator3.e(err);
191
- } finally {
192
- _iterator3.f();
149
+ try {
150
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
151
+ var touche = _step2.value;
152
+ points.push(new _point.default(touche.clientX - rect.left - el.clientLeft, touche.clientY - rect.top - el.clientTop));
193
153
  }
194
-
195
- return _points;
154
+ } catch (err) {
155
+ _iterator2.e(err);
156
+ } finally {
157
+ _iterator2.f();
196
158
  }
159
+
160
+ return points;
197
161
  };
198
162
 
199
163
  DOM.mouseButton = function (e) {
200
- if (!_l7Utils.isMini) {
201
- return e.button;
202
- }
203
-
204
- if (typeof _l7Utils.$window.InstallTrigger !== 'undefined' && e.button === 2 && e.ctrlKey && _l7Utils.$window.navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
164
+ if (typeof window.InstallTrigger !== 'undefined' && e.button === 2 && e.ctrlKey && window.navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
205
165
  return 0;
206
166
  }
207
167
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/dom.ts"],"names":["DOM","create","tagName","className","container","el","$window","document","createElement","undefined","appendChild","createNS","namespaceURI","createElementNS","docStyle","documentElement","style","testProp","props","i","selectProp","userSelect","disableDrag","enableDrag","transformProp","setTransform","value","passiveSupported","options","Object","defineProperty","get","addEventListener","removeEventListener","err","target","type","callback","capture","suppressClick","e","preventDefault","stopPropagation","isMini","setTimeout","mousePos","rect","getBoundingClientRect","Point","clientX","left","clientLeft","clientY","top","clientTop","touchPos","touches","points","touche","push","mouseButton","button","InstallTrigger","ctrlKey","navigator","platform","toUpperCase","indexOf","remove","node","parentNode","removeChild"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;;;AAEA,IAAMA,GAEL,GAAG,EAFJ;eAGeA,G;;;AAEfA,GAAG,CAACC,MAAJ,GAAa,UAACC,OAAD,EAAkBC,SAAlB,EAAsCC,SAAtC,EAAkE;AAC7E,MAAMC,EAAE,GAAGC,iBAAQC,QAAR,CAAiBC,aAAjB,CAA+BN,OAA/B,CAAX;;AACA,MAAIC,SAAS,KAAKM,SAAlB,EAA6B;AAC3BJ,IAAAA,EAAE,CAACF,SAAH,GAAeA,SAAf;AACD;;AACD,MAAIC,SAAJ,EAAe;AACbA,IAAAA,SAAS,CAACM,WAAV,CAAsBL,EAAtB;AACD;;AACD,SAAOA,EAAP;AACD,CATD;;AAWAL,GAAG,CAACW,QAAJ,GAAe,UAACC,YAAD,EAAuBV,OAAvB,EAA2C;AACxD,MAAMG,EAAE,GAAGC,iBAAQC,QAAR,CAAiBM,eAAjB,CACTD,YADS,EAETV,OAFS,CAAX;;AAIA,SAAOG,EAAP;AACD,CAND;;AAQA,IAAMS,QAAQ,GAAGR,iBAAQC,QAAR,IAAoBD,iBAAQC,QAAR,CAAiBQ,eAAjB,CAAiCC,KAAtE;;AAEA,SAASC,QAAT,CAAkBC,KAAlB,EAA8B;AAC5B,MAAI,CAACJ,QAAL,EAAe;AACb,WAAOI,KAAK,CAAC,CAAD,CAAZ;AACD;;AAH2B,6CAIZA,KAJY;AAAA;;AAAA;AAI5B,wDAAuB;AAAA,UAAZC,CAAY;;AACrB,UAAIA,CAAC,IAAIL,QAAT,EAAmB;AACjB,eAAOK,CAAP;AACD;AACF;AAR2B;AAAA;AAAA;AAAA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IAAP,CACE,IAAIX,cAAJ,CAEEU,OAAM,CAACT,OAAP,GAAiB5C,EAAE,CAAC6C,IAFtB,EAIEQ,OAAM,CAACN,OAAP,GAAiB/C,EAAE,CAACgD,GAJtB,CADF;AAQD;AAXI;AAAA;AAAA;AAAA;AAAA;;AAYL,WAAOI,OAAP;AACD;AACF,CA5BD;;AA8BAzD,GAAG,CAAC4D,WAAJ,GAAkB,UAACpB,CAAD,EAAmB;AACnC,MAAI,CAACG,eAAL,EAAa;AACX,WAAOH,CAAC,CAACqB,MAAT;AACD;;AACD,MAEE,OAAOvD,iBAAQwD,cAAf,KAAkC,WAAlC,IACAtB,CAAC,CAACqB,MAAF,KAAa,CADb,IAEArB,CAAC,CAACuB,OAFF,IAGAzD,iBAAQ0D,SAAR,CAAkBC,QAAlB,CAA2BC,WAA3B,GAAyCC,OAAzC,CAAiD,KAAjD,KAA2D,CAL7D,EAME;AAIA,WAAO,CAAP;AACD;;AACD,SAAO3B,CAAC,CAACqB,MAAT;AACD,CAjBD;;AAmBA7D,GAAG,CAACoE,MAAJ,GAAa,UAACC,IAAD,EAAuB;AAClC,MAAIA,IAAI,CAACC,UAAT,EAAqB;AACnBD,IAAAA,IAAI,CAACC,UAAL,CAAgBC,WAAhB,CAA4BF,IAA5B;AACD;AACF,CAJD","sourcesContent":["import { $window, isMini } from '@antv/l7-utils';\n// @ts-ignore\nimport Point from '../geo/point';\n\nconst DOM: {\n [key: string]: (...arg: any[]) => any;\n} = {};\nexport default DOM;\n\nDOM.create = (tagName: string, className?: string, container?: HTMLElement) => {\n const el = $window.document.createElement(tagName) as HTMLElement;\n if (className !== undefined) {\n el.className = className;\n }\n if (container) {\n container.appendChild(el);\n }\n return el;\n};\n\nDOM.createNS = (namespaceURI: string, tagName: string) => {\n const el = $window.document.createElementNS(\n namespaceURI,\n tagName,\n ) as HTMLElement;\n return el;\n};\n\nconst docStyle = $window.document && $window.document.documentElement.style;\n\nfunction testProp(props: any) {\n if (!docStyle) {\n return props[0];\n }\n for (const i of props) {\n if (i in docStyle) {\n return i;\n }\n }\n return props[0];\n}\n\nconst selectProp = testProp([\n 'userSelect',\n 'MozUserSelect',\n 'WebkitUserSelect',\n 'msUserSelect',\n]);\nlet userSelect: any;\n\nDOM.disableDrag = () => {\n if (docStyle && selectProp) {\n userSelect = docStyle[selectProp];\n docStyle[selectProp] = 'none';\n }\n};\n\nDOM.enableDrag = () => {\n if (docStyle && selectProp) {\n docStyle[selectProp] = userSelect;\n }\n};\n\nconst transformProp = testProp(['transform', 'WebkitTransform']);\n\nDOM.setTransform = (el: HTMLElement, value: string) => {\n // https://github.com/facebook/flow/issues/7754\n // $FlowFixMe\n el.style[transformProp] = value;\n};\n\n// Feature detection for {passive: false} support in add/removeEventListener.\nlet passiveSupported = false;\n\ntry {\n // https://github.com/facebook/flow/issues/285\n // $FlowFixMe\n const options = Object.defineProperty({}, 'passive', {\n get() {\n // eslint-disable-line\n passiveSupported = true;\n },\n });\n // @ts-ignore\n $window.addEventListener('test', options, options);\n // @ts-ignore\n $window.removeEventListener('test', options, options);\n} catch (err) {\n passiveSupported = false;\n}\n\nDOM.addEventListener = (\n target: any,\n type: any,\n callback: any,\n options: { passive?: boolean; capture?: boolean } = {},\n) => {\n if ('passive' in options && passiveSupported) {\n target.addEventListener(type, callback, options);\n } else {\n target.addEventListener(type, callback, options.capture);\n }\n};\n\nDOM.removeEventListener = (\n target: any,\n type: any,\n callback: any,\n options: { passive?: boolean; capture?: boolean } = {},\n) => {\n if ('passive' in options && passiveSupported) {\n target.removeEventListener(type, callback, options);\n } else {\n target.removeEventListener(type, callback, options.capture);\n }\n};\n\n// Suppress the next click, but only if it's immediate.\nconst suppressClick = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n $window.removeEventListener('click', suppressClick, true);\n};\n\nDOM.suppressClick = () => {\n if (isMini) {\n return;\n }\n $window.addEventListener('click', suppressClick, true);\n setTimeout(() => {\n $window.removeEventListener('click', suppressClick, true);\n }, 0);\n};\n\nDOM.mousePos = (el: HTMLElement, e: MouseEvent | Touch) => {\n // 暂时从 el 上获取 top/left, 后面需要动态获取\n if (!isMini) {\n const rect = el.getBoundingClientRect();\n return new Point(\n e.clientX - rect.left - el.clientLeft,\n e.clientY - rect.top - el.clientTop,\n );\n } else {\n return new Point(\n // @ts-ignore\n e.clientX - el.left - 0,\n // @ts-ignore\n e.clientY - el.top - 0,\n );\n }\n};\n\nDOM.touchPos = (el: HTMLElement, touches: Touch[]) => {\n // 暂时从 el 上获取 top/left, 后面需要动态获取\n if (!isMini) {\n const rect = el.getBoundingClientRect();\n const points = [];\n for (const touche of touches) {\n points.push(\n new Point(\n touche.clientX - rect.left - el.clientLeft,\n touche.clientY - rect.top - el.clientTop,\n ),\n );\n }\n return points;\n } else {\n const points = [];\n for (const touche of touches) {\n points.push(\n new Point(\n // @ts-ignore\n touche.clientX - el.left,\n // @ts-ignore\n touche.clientY - el.top,\n ),\n );\n }\n return points;\n }\n};\n\nDOM.mouseButton = (e: MouseEvent) => {\n if (!isMini) {\n return e.button;\n }\n if (\n // @ts-ignore\n typeof $window.InstallTrigger !== 'undefined' &&\n e.button === 2 &&\n e.ctrlKey &&\n $window.navigator.platform.toUpperCase().indexOf('MAC') >= 0\n ) {\n // Fix for https://github.com/mapbox/mapbox-gl-js/issues/3131:\n // Firefox (detected by InstallTrigger) on Mac determines e.button = 2 when\n // using Control + left click\n return 0;\n }\n return e.button;\n};\n\nDOM.remove = (node: HTMLElement) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n};\n"],"file":"dom.js"}
1
+ {"version":3,"sources":["../../src/utils/dom.ts"],"names":["DOM","create","tagName","className","container","el","window","document","createElement","undefined","appendChild","createNS","namespaceURI","createElementNS","docStyle","documentElement","style","testProp","props","i","selectProp","userSelect","disableDrag","enableDrag","transformProp","setTransform","value","passiveSupported","options","Object","defineProperty","get","addEventListener","removeEventListener","err","target","type","callback","capture","suppressClick","e","preventDefault","stopPropagation","setTimeout","mousePos","rect","getBoundingClientRect","Point","clientX","left","clientLeft","clientY","top","clientTop","touchPos","touches","points","touche","push","mouseButton","InstallTrigger","button","ctrlKey","navigator","platform","toUpperCase","indexOf","remove","node","parentNode","removeChild"],"mappings":";;;;;;;;;AACA;;;;;;;;AAEA,IAAMA,GAEL,GAAG,EAFJ;eAGeA,G;;;AAEfA,GAAG,CAACC,MAAJ,GAAa,UAACC,OAAD,EAAkBC,SAAlB,EAAsCC,SAAtC,EAAkE;AAC7E,MAAMC,EAAE,GAAGC,MAAM,CAACC,QAAP,CAAgBC,aAAhB,CAA8BN,OAA9B,CAAX;;AACA,MAAIC,SAAS,KAAKM,SAAlB,EAA6B;AAC3BJ,IAAAA,EAAE,CAACF,SAAH,GAAeA,SAAf;AACD;;AACD,MAAIC,SAAJ,EAAe;AACbA,IAAAA,SAAS,CAACM,WAAV,CAAsBL,EAAtB;AACD;;AACD,SAAOA,EAAP;AACD,CATD;;AAWAL,GAAG,CAACW,QAAJ,GAAe,UAACC,YAAD,EAAuBV,OAAvB,EAA2C;AACxD,MAAMG,EAAE,GAAGC,MAAM,CAACC,QAAP,CAAgBM,eAAhB,CAAgCD,YAAhC,EAA8CV,OAA9C,CAAX;AACA,SAAOG,EAAP;AACD,CAHD;;AAKA,IAAMS,QAAQ,GAAGR,MAAM,CAACC,QAAP,IAAmBD,MAAM,CAACC,QAAP,CAAgBQ,eAAhB,CAAgCC,KAApE;;AAEA,SAASC,QAAT,CAAkBC,KAAlB,EAA8B;AAC5B,MAAI,CAACJ,QAAL,EAAe;AACb,WAAOI,KAAK,CAAC,CAAD,CAAZ;AACD;;AAH2B,6CAIZA,KAJY;AAAA;;AAAA;AAI5B,wDAAuB;AAAA,UAAZC,CAAY;;AACrB,UAAIA,CAAC,IAAIL,QAAT,EAAmB;AACjB,eAAOK,CAAP;AACD;AACF;AAR2B;AAAA;AAAA;AAAA;AAAA;;AAS5B,SAAOD,KAAK,CAAC,CAAD,CAAZ;AACD;;AAED,IAAME,UAAU,GAAGH,Q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C,UAAT,EAAqB;AACnBD,IAAAA,IAAI,CAACC,UAAL,CAAgBC,WAAhB,CAA4BF,IAA5B;AACD;AACF,CAJD","sourcesContent":["// @ts-ignore\nimport Point from '../geo/point';\n\nconst DOM: {\n [key: string]: (...arg: any[]) => any;\n} = {};\nexport default DOM;\n\nDOM.create = (tagName: string, className?: string, container?: HTMLElement) => {\n const el = window.document.createElement(tagName);\n if (className !== undefined) {\n el.className = className;\n }\n if (container) {\n container.appendChild(el);\n }\n return el;\n};\n\nDOM.createNS = (namespaceURI: string, tagName: string) => {\n const el = window.document.createElementNS(namespaceURI, tagName);\n return el;\n};\n\nconst docStyle = window.document && window.document.documentElement.style;\n\nfunction testProp(props: any) {\n if (!docStyle) {\n return props[0];\n }\n for (const i of props) {\n if (i in docStyle) {\n return i;\n }\n }\n return props[0];\n}\n\nconst selectProp = testProp([\n 'userSelect',\n 'MozUserSelect',\n 'WebkitUserSelect',\n 'msUserSelect',\n]);\nlet userSelect: any;\n\nDOM.disableDrag = () => {\n if (docStyle && selectProp) {\n userSelect = docStyle[selectProp];\n docStyle[selectProp] = 'none';\n }\n};\n\nDOM.enableDrag = () => {\n if (docStyle && selectProp) {\n docStyle[selectProp] = userSelect;\n }\n};\n\nconst transformProp = testProp(['transform', 'WebkitTransform']);\n\nDOM.setTransform = (el: HTMLElement, value: string) => {\n // https://github.com/facebook/flow/issues/7754\n // $FlowFixMe\n el.style[transformProp] = value;\n};\n\n// Feature detection for {passive: false} support in add/removeEventListener.\nlet passiveSupported = false;\n\ntry {\n // https://github.com/facebook/flow/issues/285\n // $FlowFixMe\n const options = Object.defineProperty({}, 'passive', {\n get() {\n // eslint-disable-line\n passiveSupported = true;\n },\n });\n // @ts-ignore\n window.addEventListener('test', options, options);\n // @ts-ignore\n window.removeEventListener('test', options, options);\n} catch (err) {\n passiveSupported = false;\n}\n\nDOM.addEventListener = (\n target: any,\n type: any,\n callback: any,\n options: { passive?: boolean; capture?: boolean } = {},\n) => {\n if ('passive' in options && passiveSupported) {\n target.addEventListener(type, callback, options);\n } else {\n target.addEventListener(type, callback, options.capture);\n }\n};\n\nDOM.removeEventListener = (\n target: any,\n type: any,\n callback: any,\n options: { passive?: boolean; capture?: boolean } = {},\n) => {\n if ('passive' in options && passiveSupported) {\n target.removeEventListener(type, callback, options);\n } else {\n target.removeEventListener(type, callback, options.capture);\n }\n};\n\n// Suppress the next click, but only if it's immediate.\nconst suppressClick = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n window.removeEventListener('click', suppressClick, true);\n};\n\nDOM.suppressClick = () => {\n window.addEventListener('click', suppressClick, true);\n window.setTimeout(() => {\n window.removeEventListener('click', suppressClick, true);\n }, 0);\n};\n\nDOM.mousePos = (el: HTMLElement, e: MouseEvent | Touch) => {\n const rect = el.getBoundingClientRect();\n return new Point(\n e.clientX - rect.left - el.clientLeft,\n e.clientY - rect.top - el.clientTop,\n );\n};\n\nDOM.touchPos = (el: HTMLElement, touches: Touch[]) => {\n const rect = el.getBoundingClientRect();\n const points = [];\n for (const touche of touches) {\n points.push(\n new Point(\n touche.clientX - rect.left - el.clientLeft,\n touche.clientY - rect.top - el.clientTop,\n ),\n );\n }\n return points;\n};\n\nDOM.mouseButton = (e: MouseEvent) => {\n if (\n // @ts-ignore\n typeof window.InstallTrigger !== 'undefined' &&\n e.button === 2 &&\n e.ctrlKey &&\n window.navigator.platform.toUpperCase().indexOf('MAC') >= 0\n ) {\n // Fix for https://github.com/mapbox/mapbox-gl-js/issues/3131:\n // Firefox (detected by InstallTrigger) on Mac determines e.button = 2 when\n // using Control + left click\n return 0;\n }\n return e.button;\n};\n\nDOM.remove = (node: HTMLElement) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n};\n"],"file":"dom.js"}
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PerformanceUtils = exports.PerformanceMarkers = void 0;
7
-
8
- var _l7Utils = require("@antv/l7-utils");
9
-
10
7
  var lastFrameTime = null;
11
8
  var frameTimes = [];
12
9
  var minFramerateTarget = 30;
13
10
  var frameTimeTarget = 1000 / minFramerateTarget;
14
- var performance = _l7Utils.$window.performance;
11
+ var performance = window.performance;
15
12
  var PerformanceMarkers = {
16
13
  create: 'create',
17
14
  load: 'load',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/performance.ts"],"names":["lastFrameTime","frameTimes","minFramerateTarget","frameTimeTarget","performance","$window","PerformanceMarkers","create","load","fullLoad","PerformanceUtils","mark","marker","frame","timestamp","currTimestamp","frameTime","push","clearMetrics","clearMeasures","clearMarks","getPerformanceMetrics","loadTime","measure","duration","fullLoadTime","totalFrames","length","avgFrameTime","reduce","prev","curr","fps","droppedFrames","filter","acc","percentDroppedFrames"],"mappings":";;;;;;;AAAA;;AACA,IAAIA,aAA4B,GAAG,IAAnC;AACA,IAAIC,UAAoB,GAAG,EAA3B;AAEA,IAAMC,kBAAkB,GAAG,EAA3B;AACA,IAAMC,eAAe,GAAG,OAAOD,kBAA/B;AACA,IAAME,WAAW,GAAGC,iBAAQD,WAA5B;AASO,IAAME,kBAAkB,GAAG;AAChCC,EAAAA,MAAM,EAAE,QADwB;AAEhCC,EAAAA,IAAI,EAAE,MAF0B;AAGhCC,EAAAA,QAAQ,EAAE;AAHsB,CAA3B;;AAMA,IAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,IAD8B,gBACzBC,MADyB,EACT;AACnBR,IAAAA,WAAW,CAACO,IAAZ,CAAiBC,MAAjB;AACD,GAH6B;AAI9BC,EAAAA,KAJ8B,iBAIxBC,SAJwB,EAIL;AACvB,QAAMC,aAAa,GAAGD,SAAtB;;AACA,QAAId,aAAa,IAAI,IAArB,EAA2B;AACzB,UAAMgB,SAAS,GAAGD,aAAa,GAAGf,aAAlC;AACAC,MAAAA,UAAU,CAACgB,IAAX,CAAgBD,SAAhB;AACD;;AACDhB,IAAAA,aAAa,GAAGe,aAAhB;AACD,GAX6B;AAY9BG,EAAAA,Y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WAAO;AACLX,MAAAA,QAAQ,EAARA,QADK;AAELG,MAAAA,YAAY,EAAZA,YAFK;AAGLO,MAAAA,GAAG,EAAHA,GAHK;AAILI,MAAAA,oBAAoB,EAApBA;AAJK,KAAP;AAMD;AA3D6B,CAAzB","sourcesContent":["import { $window } from '@antv/l7-utils';\nlet lastFrameTime: number | null = null;\nlet frameTimes: number[] = [];\n\nconst minFramerateTarget = 30;\nconst frameTimeTarget = 1000 / minFramerateTarget;\nconst performance = $window.performance;\n\nexport interface IPerformanceMetrics {\n loadTime: number;\n fullLoadTime: number;\n fps: number;\n percentDroppedFrames: number;\n}\n\nexport const PerformanceMarkers = {\n create: 'create',\n load: 'load',\n fullLoad: 'fullLoad',\n};\n\nexport const PerformanceUtils = {\n mark(marker: string) {\n performance.mark(marker);\n },\n frame(timestamp: number) {\n const currTimestamp = timestamp;\n if (lastFrameTime != null) {\n const frameTime = currTimestamp - lastFrameTime;\n frameTimes.push(frameTime);\n }\n lastFrameTime = currTimestamp;\n },\n clearMetrics() {\n lastFrameTime = null;\n frameTimes = [];\n performance.clearMeasures('loadTime');\n performance.clearMeasures('fullLoadTime');\n // @ts-ignore\n // tslint:disable-next-line:forin\n for (const marker in PerformanceMarkers) {\n // @ts-ignore\n performance.clearMarks(PerformanceMarkers[marker]);\n }\n },\n getPerformanceMetrics(): IPerformanceMetrics {\n const loadTime = performance.measure(\n 'loadTime',\n PerformanceMarkers.create,\n PerformanceMarkers.load,\n // @ts-ignore\n ).duration;\n\n const fullLoadTime = performance.measure(\n 'fullLoadTime',\n PerformanceMarkers.create,\n PerformanceMarkers.fullLoad,\n // @ts-ignore\n ).duration;\n const totalFrames = frameTimes.length;\n\n const avgFrameTime =\n frameTimes.reduce((prev, curr) => prev + curr, 0) / totalFrames / 1000;\n const fps = 1 / avgFrameTime;\n\n // count frames that missed our framerate target\n const droppedFrames = frameTimes\n .filter((frameTime) => frameTime > frameTimeTarget)\n .reduce((acc, curr) => {\n return acc + (curr - frameTimeTarget) / frameTimeTarget;\n }, 0);\n const percentDroppedFrames =\n (droppedFrames / (totalFrames + droppedFrames)) * 100;\n\n return {\n loadTime,\n fullLoadTime,\n fps,\n percentDroppedFrames,\n };\n },\n};\n"],"file":"performance.js"}
1
+ {"version":3,"sources":["../../src/utils/performance.ts"],"names":["lastFrameTime","frameTimes","minFramerateTarget","frameTimeTarget","performance","window","PerformanceMarkers","create","load","fullLoad","PerformanceUtils","mark","marker","frame","timestamp","currTimestamp","frameTime","push","clearMetrics","clearMeasures","clearMarks","getPerformanceMetrics","loadTime","measure","duration","fullLoadTime","totalFrames","length","avgFrameTime","reduce","prev","curr","fps","droppedFrames","filter","acc","percentDroppedFrames"],"mappings":";;;;;;AAAA,IAAIA,aAA4B,GAAG,IAAnC;AACA,IAAIC,UAAoB,GAAG,EAA3B;AAEA,IAAMC,kBAAkB,GAAG,EAA3B;AACA,IAAMC,eAAe,GAAG,OAAOD,kBAA/B;AACA,IAAME,WAAW,GAAGC,MAAM,CAACD,WAA3B;AASO,IAAME,kBAAkB,GAAG;AAChCC,EAAAA,MAAM,EAAE,QADwB;AAEhCC,EAAAA,IAAI,EAAE,MAF0B;AAGhCC,EAAAA,QAAQ,EAAE;AAHsB,CAA3B;;AAMA,IAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,IAD8B,gBACzBC,MADyB,EACT;AACnBR,IAAAA,WAAW,CAACO,IAAZ,CAAiBC,MAAjB;AACD,GAH6B;AAI9BC,EAAAA,KAJ8B,iBAIxBC,SAJwB,EAIL;AACvB,QAAMC,aAAa,GAAGD,SAAtB;;AACA,QAAId,aAAa,IAAI,IAArB,EAA2B;AACzB,UAAMgB,SAAS,GAAGD,aAAa,GAAGf,aAAlC;AACAC,MAAAA,UAAU,CAACgB,IAAX,CAAgBD,SAAhB;AACD;;AACDhB,IAAAA,aAAa,GAAGe,aAAhB;AACD,GAX6B;AAY9BG,EAAAA,YAZ8B,0BAYf;AACblB,IAAAA,aAAa,GAAG,IAAhB;AACAC,IAAA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AAZA,YAFK;AAGLO,MAAAA,GAAG,EAAHA,GAHK;AAILI,MAAAA,oBAAoB,EAApBA;AAJK,KAAP;AAMD;AA3D6B,CAAzB","sourcesContent":["let lastFrameTime: number | null = null;\nlet frameTimes: number[] = [];\n\nconst minFramerateTarget = 30;\nconst frameTimeTarget = 1000 / minFramerateTarget;\nconst performance = window.performance;\n\nexport interface IPerformanceMetrics {\n loadTime: number;\n fullLoadTime: number;\n fps: number;\n percentDroppedFrames: number;\n}\n\nexport const PerformanceMarkers = {\n create: 'create',\n load: 'load',\n fullLoad: 'fullLoad',\n};\n\nexport const PerformanceUtils = {\n mark(marker: string) {\n performance.mark(marker);\n },\n frame(timestamp: number) {\n const currTimestamp = timestamp;\n if (lastFrameTime != null) {\n const frameTime = currTimestamp - lastFrameTime;\n frameTimes.push(frameTime);\n }\n lastFrameTime = currTimestamp;\n },\n clearMetrics() {\n lastFrameTime = null;\n frameTimes = [];\n performance.clearMeasures('loadTime');\n performance.clearMeasures('fullLoadTime');\n // @ts-ignore\n // tslint:disable-next-line:forin\n for (const marker in PerformanceMarkers) {\n // @ts-ignore\n performance.clearMarks(PerformanceMarkers[marker]);\n }\n },\n getPerformanceMetrics(): IPerformanceMetrics {\n const loadTime = performance.measure(\n 'loadTime',\n PerformanceMarkers.create,\n PerformanceMarkers.load,\n // @ts-ignore\n ).duration;\n\n const fullLoadTime = performance.measure(\n 'fullLoadTime',\n PerformanceMarkers.create,\n PerformanceMarkers.fullLoad,\n // @ts-ignore\n ).duration;\n const totalFrames = frameTimes.length;\n\n const avgFrameTime =\n frameTimes.reduce((prev, curr) => prev + curr, 0) / totalFrames / 1000;\n const fps = 1 / avgFrameTime;\n\n // count frames that missed our framerate target\n const droppedFrames = frameTimes\n .filter((frameTime) => frameTime > frameTimeTarget)\n .reduce((acc, curr) => {\n return acc + (curr - frameTimeTarget) / frameTimeTarget;\n }, 0);\n const percentDroppedFrames =\n (droppedFrames / (totalFrames + droppedFrames)) * 100;\n\n return {\n loadTime,\n fullLoadTime,\n fps,\n percentDroppedFrames,\n };\n },\n};\n"],"file":"performance.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-map",
3
- "version": "2.5.37-mini",
3
+ "version": "2.5.37-mini10",
4
4
  "description": "l7 map",
5
5
  "keywords": [],
6
6
  "author": "thinkinggis <lzx199065@gmail.com>",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "homepage": "https://github.com/antvis/L7#readme",
39
39
  "dependencies": {
40
- "@antv/l7-utils": "^2.5.37-mini",
40
+ "@antv/l7-utils": "^2.5.37-mini10",
41
41
  "@babel/runtime": "^7.7.7",
42
42
  "@mapbox/point-geometry": "^0.1.0",
43
43
  "@mapbox/unitbezier": "^0.0.0",