@antv/l7-map 2.17.11 → 2.18.0

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/camera.js CHANGED
@@ -12,8 +12,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
12
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+ var _l7Utils = require("@antv/l7-utils");
15
16
  var _eventemitter = require("eventemitter3");
16
- var _lodash = require("lodash");
17
17
  var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
18
18
  var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
19
19
  var _point = _interopRequireDefault(require("./geo/point"));
@@ -22,6 +22,7 @@ var _event = require("./handler/events/event");
22
22
  var _util = require("./util");
23
23
  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); }; }
24
24
  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; } } // @ts-ignore
25
+ var merge = _l7Utils.lodashUtil.merge;
25
26
  var Camera = /*#__PURE__*/function (_EventEmitter) {
26
27
  (0, _inherits2.default)(Camera, _EventEmitter);
27
28
  var _super = _createSuper(Camera);
@@ -109,7 +110,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
109
110
  }, {
110
111
  key: "panTo",
111
112
  value: function panTo(lnglat, options, eventData) {
112
- return this.easeTo((0, _lodash.merge)({
113
+ return this.easeTo(merge({
113
114
  center: lnglat
114
115
  }, options), eventData);
115
116
  }
@@ -152,7 +153,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
152
153
  }, {
153
154
  key: "zoomTo",
154
155
  value: function zoomTo(zoom, options, eventData) {
155
- return this.easeTo((0, _lodash.merge)({
156
+ return this.easeTo(merge({
156
157
  zoom: zoom
157
158
  }, options), eventData);
158
159
  }
@@ -172,14 +173,14 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
172
173
  }, {
173
174
  key: "rotateTo",
174
175
  value: function rotateTo(bearing, options, eventData) {
175
- return this.easeTo((0, _lodash.merge)({
176
+ return this.easeTo(merge({
176
177
  bearing: bearing
177
178
  }, options), eventData);
178
179
  }
179
180
  }, {
180
181
  key: "resetNorth",
181
182
  value: function resetNorth(options, eventData) {
182
- this.rotateTo(0, (0, _lodash.merge)({
183
+ this.rotateTo(0, merge({
183
184
  duration: 1000
184
185
  }, options), eventData);
185
186
  return this;
@@ -187,7 +188,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
187
188
  }, {
188
189
  key: "resetNorthPitch",
189
190
  value: function resetNorthPitch(options, eventData) {
190
- this.easeTo((0, _lodash.merge)({
191
+ this.easeTo(merge({
191
192
  bearing: 0,
192
193
  pitch: 0,
193
194
  duration: 1000
@@ -270,7 +271,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
270
271
  var _this2 = this;
271
272
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
272
273
  var eventData = arguments.length > 1 ? arguments[1] : undefined;
273
- options = (0, _lodash.merge)({
274
+ options = merge({
274
275
  offset: [0, 0],
275
276
  duration: 500,
276
277
  easing: _util.ease
@@ -359,7 +360,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
359
360
  return this.jumpTo(coercedOptions, eventData);
360
361
  }
361
362
  this.stop();
362
- options = (0, _lodash.merge)({
363
+ options = merge({
363
364
  offset: [0, 0],
364
365
  speed: 1.2,
365
366
  curve: 1.42,
@@ -637,7 +638,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
637
638
  right: 0,
638
639
  left: 0
639
640
  };
640
- options = (0, _lodash.merge)({
641
+ options = merge({
641
642
  padding: defaultPadding,
642
643
  offset: [0, 0],
643
644
  maxZoom: this.transform.maxZoom
@@ -651,7 +652,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
651
652
  left: p
652
653
  };
653
654
  }
654
- options.padding = (0, _lodash.merge)(defaultPadding, options.padding);
655
+ options.padding = merge(defaultPadding, options.padding);
655
656
  var tr = this.transform;
656
657
  var edgePadding = tr.padding;
657
658
 
@@ -711,7 +712,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
711
712
  if (!calculatedOptions) {
712
713
  return this;
713
714
  }
714
- options = (0, _lodash.merge)(calculatedOptions, options);
715
+ options = merge(calculatedOptions, options);
715
716
  // Explictly remove the padding field because, calculatedOptions already accounts for padding by setting zoom and center accordingly.
716
717
  delete options.padding;
717
718
  // @ts-ignore
package/lib/earthmap.js CHANGED
@@ -13,7 +13,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
13
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _l7Utils = require("@antv/l7-utils");
16
- var _lodash = require("lodash");
17
16
  var _camera = _interopRequireDefault(require("./camera"));
18
17
  var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
19
18
  var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
@@ -57,7 +56,7 @@ function loadStyles(css, doc) {
57
56
  loadStyles(".l7-map {\n font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.l7-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.l7-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n\n.l7-canary {\n background-color: salmon;\n}\n\n.l7-canvas-container.l7-interactive,\n.l7-ctrl-group button.l7-ctrl-compass {\n cursor: -webkit-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.l7-canvas-container.l7-interactive.l7-track-pointer {\n cursor: pointer;\n}\n\n.l7-canvas-container.l7-interactive:active,\n.l7-ctrl-group button.l7-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate,\n.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.l7-canvas-container.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: pinch-zoom;\n touch-action: pinch-zoom;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.l7-ctrl-top-left,\n.l7-ctrl-top-right,\n.l7-ctrl-bottom-left,\n.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }\n.l7-ctrl-top-left { top: 0; left: 0; }\n.l7-ctrl-top-right { top: 0; right: 0; }\n.l7-ctrl-bottom-left { bottom: 0; left: 0; }\n.l7-ctrl-bottom-right { right: 0; bottom: 0; }\n\n.l7-ctrl {\n clear: both;\n pointer-events: auto;\n\n /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */\n -webkit-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }\n.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }\n.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }\n.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }\n\n\n.l7-crosshair,\n.l7-crosshair .l7-interactive,\n.l7-crosshair .l7-interactive:active {\n cursor: crosshair;\n}\n\n.l7-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: 0.5;\n z-index: 10;\n}\n"); // @ts-ignore
58
57
  var defaultMinZoom = -2;
59
58
  var defaultMaxZoom = 22;
60
-
59
+ var merge = _l7Utils.lodashUtil.merge;
61
60
  // the default values, but also the valid range
62
61
  var defaultMinPitch = 0;
63
62
  var defaultMaxPitch = 60;
@@ -94,7 +93,7 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
94
93
  function EarthMap(options) {
95
94
  var _this;
96
95
  (0, _classCallCheck2.default)(this, EarthMap);
97
- _this = _super.call(this, (0, _lodash.merge)({}, DefaultOptions, options));
96
+ _this = _super.call(this, merge({}, DefaultOptions, options));
98
97
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
99
98
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
100
99
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = exports.EXTENT = void 0;
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _l7Utils = require("@antv/l7-utils");
12
11
  var _glMatrix = require("gl-matrix");
13
12
  var _point = _interopRequireDefault(require("../geo/point"));
14
13
  var _util = require("../util");
@@ -809,11 +808,7 @@ var Transform = /*#__PURE__*/function () {
809
808
  var s = Math.max(sx || 0, sy || 0);
810
809
  if (s) {
811
810
  this.center = this.unproject(new _point.default(sx ? (maxX + minX) / 2 : point.x, sy ? (maxY + minY) / 2 : point.y));
812
- if (_l7Utils.isMini) {
813
- this.zoom = Math.max(this.zoom, Math.max(-1, this.minZoom));
814
- } else {
815
- this.zoom += this.scaleZoom(s);
816
- }
811
+ this.zoom += this.scaleZoom(s);
817
812
  this.unmodified = unmodified;
818
813
  this.constraining = false;
819
814
  return;
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.Event = void 0;
8
8
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _merge = _interopRequireDefault(require("lodash/merge"));
10
+ var _l7Utils = require("@antv/l7-utils");
11
11
  // tslint:disable-next-line:no-submodule-imports
12
+
13
+ var merge = _l7Utils.lodashUtil.merge;
12
14
  var Event = /*#__PURE__*/(0, _createClass2.default)(function Event(type) {
13
15
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14
16
  (0, _classCallCheck2.default)(this, Event);
15
- (0, _merge.default)(this, data);
17
+ merge(this, data);
16
18
  this.type = type;
17
19
  });
18
20
  exports.Event = Event;
@@ -10,12 +10,13 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
10
10
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
- var _merge = _interopRequireDefault(require("lodash/merge"));
13
+ var _l7Utils = require("@antv/l7-utils");
14
14
  var _dom = _interopRequireDefault(require("../../utils/dom"));
15
15
  var _event = require("./event");
16
16
  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); }; }
17
17
  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; } } // @ts-ignore
18
18
  // tslint:disable-next-line:no-submodule-imports
19
+ var merge = _l7Utils.lodashUtil.merge;
19
20
  var MapMouseEvent = /*#__PURE__*/function (_Event) {
20
21
  (0, _inherits2.default)(MapMouseEvent, _Event);
21
22
  var _super = _createSuper(MapMouseEvent);
@@ -49,7 +50,7 @@ var MapMouseEvent = /*#__PURE__*/function (_Event) {
49
50
  (0, _classCallCheck2.default)(this, MapMouseEvent);
50
51
  var point = _dom.default.mousePos(map.getCanvasContainer(), originalEvent);
51
52
  var lngLat = map.unproject(point);
52
- _this = _super.call(this, type, (0, _merge.default)({
53
+ _this = _super.call(this, type, merge({
53
54
  point: point,
54
55
  lngLat: lngLat,
55
56
  originalEvent: originalEvent
@@ -8,29 +8,30 @@ exports.default = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _point = _interopRequireDefault(require("../geo/point"));
11
- var _merge = _interopRequireDefault(require("lodash/merge"));
11
+ var _l7Utils = require("@antv/l7-utils");
12
12
  var _util = require("../util");
13
13
  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; } } }; }
14
14
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
15
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } // @ts-ignore
16
16
  // tslint:disable-next-line:no-submodule-imports
17
+ var merge = _l7Utils.lodashUtil.merge;
17
18
  var defaultInertiaOptions = {
18
19
  linearity: 0.3,
19
20
  easing: (0, _util.bezier)(0, 0, 0.3, 1)
20
21
  };
21
- var defaultPanInertiaOptions = (0, _merge.default)({
22
+ var defaultPanInertiaOptions = merge({
22
23
  deceleration: 2500,
23
24
  maxSpeed: 1400
24
25
  }, defaultInertiaOptions);
25
- var defaultZoomInertiaOptions = (0, _merge.default)({
26
+ var defaultZoomInertiaOptions = merge({
26
27
  deceleration: 20,
27
28
  maxSpeed: 1400
28
29
  }, defaultInertiaOptions);
29
- var defaultBearingInertiaOptions = (0, _merge.default)({
30
+ var defaultBearingInertiaOptions = merge({
30
31
  deceleration: 1000,
31
32
  maxSpeed: 360
32
33
  }, defaultInertiaOptions);
33
- var defaultPitchInertiaOptions = (0, _merge.default)({
34
+ var defaultPitchInertiaOptions = merge({
34
35
  deceleration: 1000,
35
36
  maxSpeed: 90
36
37
  }, defaultInertiaOptions);
@@ -107,7 +108,7 @@ var HandlerInertia = /*#__PURE__*/function () {
107
108
  var duration = lastEntry.time - this.inertiaBuffer[0].time;
108
109
  var easeOptions = {};
109
110
  if (deltas.pan.mag()) {
110
- var result = calculateEasing(deltas.pan.mag(), duration, (0, _merge.default)({}, defaultPanInertiaOptions, panInertiaOptions || {}));
111
+ var result = calculateEasing(deltas.pan.mag(), duration, merge({}, defaultPanInertiaOptions, panInertiaOptions || {}));
111
112
  easeOptions.offset = deltas.pan.mult(result.amount / deltas.pan.mag());
112
113
  easeOptions.center = this.map.transform.center;
113
114
  extendDuration(easeOptions, result);
@@ -132,7 +133,7 @@ var HandlerInertia = /*#__PURE__*/function () {
132
133
  easeOptions.around = last ? this.map.unproject(last) : this.map.getCenter();
133
134
  }
134
135
  this.clear();
135
- return (0, _merge.default)(easeOptions, {
136
+ return merge(easeOptions, {
136
137
  noMoveStart: true
137
138
  });
138
139
  }
@@ -10,7 +10,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
12
  var _l7Utils = require("@antv/l7-utils");
13
- var _lodash = require("lodash");
14
13
  var _point = _interopRequireDefault(require("../geo/point"));
15
14
  var _dom = _interopRequireDefault(require("../utils/dom"));
16
15
  var _blockable_map_event = _interopRequireDefault(require("./blockable_map_event"));
@@ -34,6 +33,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
34
33
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
35
34
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } // @ts-ignore
36
35
  // tslint:disable-next-line: no-submodule-imports
36
+ var merge = _l7Utils.lodashUtil.merge;
37
37
  var _isMoving = function isMoving(p) {
38
38
  return p.zoom || p.drag || p.pitch || p.rotate;
39
39
  };
@@ -145,67 +145,52 @@ var HandlerManager = /*#__PURE__*/function () {
145
145
  this.addDefaultHandlers(options);
146
146
  var el = this.el;
147
147
  this.listeners = [];
148
- if (!_l7Utils.isMini) {
149
- // l7 - mini
150
- this.listeners = [
151
- // Bind touchstart and touchmove with passive: false because, even though
152
- // they only fire a map events and therefore could theoretically be
153
- // passive, binding with passive: true causes iOS not to respect
154
- // e.preventDefault() in _other_ handlers, even if they are non-passive
155
- // (see https://bugs.webkit.org/show_bug.cgi?id=184251)
156
- [el, 'touchstart', {
157
- passive: false
158
- }], [el, 'touchmove', {
159
- passive: false
160
- }], [el, 'touchend', undefined], [el, 'touchcancel', undefined], [el, 'mousedown', undefined], [el, 'mousemove', undefined], [el, 'mouseup', undefined],
161
- // Bind window-level event listeners for move and up/end events. In the absence of
162
- // the pointer capture API, which is not supported by all necessary platforms,
163
- // window-level event listeners give us the best shot at capturing events that
164
- // fall outside the map canvas element. Use `{capture: true}` for the move event
165
- // to prevent map move events from being fired during a drag.
166
- // @ts-ignore
167
- [window.document, 'mousemove', {
168
- capture: true
169
- }],
170
- // @ts-ignore
171
- [window.document, 'mouseup', undefined], [el, 'mouseover', undefined], [el, 'mouseout', undefined], [el, 'dblclick', undefined], [el, 'click', undefined], [el, 'keydown', {
172
- capture: false
173
- }], [el, 'keyup', undefined], [el, 'wheel', {
174
- passive: false
175
- }], [el, 'contextmenu', undefined],
176
- // @ts-ignore
177
- [window, 'blur', undefined]];
178
- var _iterator2 = _createForOfIteratorHelper(this.listeners),
179
- _step2;
180
- try {
181
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
182
- var _step2$value = (0, _slicedToArray2.default)(_step2.value, 3),
183
- target = _step2$value[0],
184
- type = _step2$value[1],
185
- listenerOptions = _step2$value[2];
186
- // @ts-ignore
187
- _dom.default.addEventListener(target, type,
188
- // @ts-ignore
189
- target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
190
- }
191
- } catch (err) {
192
- _iterator2.e(err);
193
- } finally {
194
- _iterator2.f();
195
- }
196
- } else {
197
- _l7Utils.$window.document.addEventListener('touchstart', function (e) {
198
- _this.handleEvent(e);
199
- }, {});
200
- _l7Utils.$window.document.addEventListener('touchmove', function (e) {
201
- _this.handleEvent(e);
202
- }, {});
203
- _l7Utils.$window.document.addEventListener('touchend', function (e) {
204
- _this.handleEvent(e);
205
- }, {});
206
- _l7Utils.$window.document.addEventListener('touchcancel', function (e) {
207
- _this.handleEvent(e);
208
- }, {});
148
+ // l7 - mini
149
+ this.listeners = [
150
+ // Bind touchstart and touchmove with passive: false because, even though
151
+ // they only fire a map events and therefore could theoretically be
152
+ // passive, binding with passive: true causes iOS not to respect
153
+ // e.preventDefault() in _other_ handlers, even if they are non-passive
154
+ // (see https://bugs.webkit.org/show_bug.cgi?id=184251)
155
+ [el, 'touchstart', {
156
+ passive: false
157
+ }], [el, 'touchmove', {
158
+ passive: false
159
+ }], [el, 'touchend', undefined], [el, 'touchcancel', undefined], [el, 'mousedown', undefined], [el, 'mousemove', undefined], [el, 'mouseup', undefined],
160
+ // Bind window-level event listeners for move and up/end events. In the absence of
161
+ // the pointer capture API, which is not supported by all necessary platforms,
162
+ // window-level event listeners give us the best shot at capturing events that
163
+ // fall outside the map canvas element. Use `{capture: true}` for the move event
164
+ // to prevent map move events from being fired during a drag.
165
+ // @ts-ignore
166
+ [window.document, 'mousemove', {
167
+ capture: true
168
+ }],
169
+ // @ts-ignore
170
+ [window.document, 'mouseup', undefined], [el, 'mouseover', undefined], [el, 'mouseout', undefined], [el, 'dblclick', undefined], [el, 'click', undefined], [el, 'keydown', {
171
+ capture: false
172
+ }], [el, 'keyup', undefined], [el, 'wheel', {
173
+ passive: false
174
+ }], [el, 'contextmenu', undefined],
175
+ // @ts-ignore
176
+ [window, 'blur', undefined]];
177
+ var _iterator2 = _createForOfIteratorHelper(this.listeners),
178
+ _step2;
179
+ try {
180
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
181
+ var _step2$value = (0, _slicedToArray2.default)(_step2.value, 3),
182
+ target = _step2$value[0],
183
+ type = _step2$value[1],
184
+ listenerOptions = _step2$value[2];
185
+ // @ts-ignore
186
+ _dom.default.addEventListener(target, type,
187
+ // @ts-ignore
188
+ target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
189
+ }
190
+ } catch (err) {
191
+ _iterator2.e(err);
192
+ } finally {
193
+ _iterator2.f();
209
194
  }
210
195
  }
211
196
  (0, _createClass2.default)(HandlerManager, [{
@@ -293,7 +278,7 @@ var HandlerManager = /*#__PURE__*/function () {
293
278
  if (!HandlerResult) {
294
279
  return;
295
280
  }
296
- (0, _lodash.merge)(mergedIHandlerResult, HandlerResult);
281
+ merge(mergedIHandlerResult, HandlerResult);
297
282
  var eventData = {
298
283
  handlerName: name,
299
284
  originalEvent: HandlerResult.originalEvent || e
@@ -407,7 +392,7 @@ var HandlerManager = /*#__PURE__*/function () {
407
392
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
408
393
  var t = _step6.value;
409
394
  var target = t.target;
410
- if (_l7Utils.isMini || this.el.contains(target)) {
395
+ if (this.el.contains(target)) {
411
396
  mapTouches.push(t);
412
397
  }
413
398
  }
@@ -453,8 +438,8 @@ var HandlerManager = /*#__PURE__*/function () {
453
438
  if (change.noInertia) {
454
439
  combined.noInertia = change.noInertia;
455
440
  }
456
- (0, _lodash.merge)(combinedEventsInProgress, eventsInProgress);
457
- (0, _lodash.merge)(combinedDeactivatedHandlers, deactivatedHandlers);
441
+ merge(combinedEventsInProgress, eventsInProgress);
442
+ merge(combinedDeactivatedHandlers, deactivatedHandlers);
458
443
  }
459
444
  } catch (err) {
460
445
  _iterator7.e(err);
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _l7Utils = require("@antv/l7-utils");
11
10
  /**
12
11
  * The `DragPanHandler` allows the user to pan the map by clicking and dragging
13
12
  * the cursor.
@@ -48,9 +47,7 @@ var DragPanHandler = /*#__PURE__*/function () {
48
47
  this.inertiaOptions = options || {};
49
48
  this.mousePan.enable();
50
49
  this.touchPan.enable();
51
- if (!_l7Utils.isMini) {
52
- this.el.classList.add('l7-touch-drag-pan');
53
- }
50
+ this.el.classList.add('l7-touch-drag-pan');
54
51
  }
55
52
 
56
53
  /**
@@ -64,9 +61,7 @@ var DragPanHandler = /*#__PURE__*/function () {
64
61
  value: function disable() {
65
62
  this.mousePan.disable();
66
63
  this.touchPan.disable();
67
- if (!_l7Utils.isMini) {
68
- this.el.classList.remove('l7-touch-drag-pan');
69
- }
64
+ this.el.classList.remove('l7-touch-drag-pan');
70
65
  }
71
66
 
72
67
  /**
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _l7Utils = require("@antv/l7-utils");
11
10
  /**
12
11
  * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
13
12
  * pinching on a touchscreen.
@@ -48,9 +47,7 @@ var TouchZoomRotateHandler = /*#__PURE__*/function () {
48
47
  this.touchRotate.enable(options);
49
48
  }
50
49
  this.tapDragZoom.enable();
51
- if (!_l7Utils.isMini) {
52
- this.el.classList.add('l7-touch-zoom-rotate');
53
- }
50
+ this.el.classList.add('l7-touch-zoom-rotate');
54
51
  }
55
52
 
56
53
  /**
@@ -65,9 +62,7 @@ var TouchZoomRotateHandler = /*#__PURE__*/function () {
65
62
  this.touchZoom.disable();
66
63
  this.touchRotate.disable();
67
64
  this.tapDragZoom.disable();
68
- if (!_l7Utils.isMini) {
69
- this.el.classList.remove('l7-touch-zoom-rotate');
70
- }
65
+ this.el.classList.remove('l7-touch-zoom-rotate');
71
66
  }
72
67
 
73
68
  /**
package/lib/hash.js CHANGED
@@ -9,9 +9,10 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _l7Utils = require("@antv/l7-utils");
12
- var _lodash = require("lodash");
13
12
  // @ts-ignore
14
13
  // tslint:disable-next-line:no-submodule-imports
14
+
15
+ var throttle = _l7Utils.lodashUtil.throttle;
15
16
  /*
16
17
  * Adds the map's position to its page's location hash.
17
18
  * Passed as an option to the map object.
@@ -68,20 +69,20 @@ var Hash = /*#__PURE__*/function () {
68
69
  this.hashName = hashName && encodeURIComponent(hashName);
69
70
 
70
71
  // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
71
- this.updateHash = (0, _lodash.throttle)(this.updateHashUnthrottled, 30 * 1000 / 100);
72
+ this.updateHash = throttle(this.updateHashUnthrottled, 30 * 1000 / 100);
72
73
  }
73
74
  (0, _createClass2.default)(Hash, [{
74
75
  key: "addTo",
75
76
  value: function addTo(map) {
76
77
  this.map = map;
77
- _l7Utils.$window.addEventListener('hashchange', this.onHashChange, false);
78
+ window.addEventListener('hashchange', this.onHashChange, false);
78
79
  this.map.on('moveend', this.updateHash);
79
80
  return this;
80
81
  }
81
82
  }, {
82
83
  key: "remove",
83
84
  value: function remove() {
84
- _l7Utils.$window.removeEventListener('hashchange', this.onHashChange, false);
85
+ window.removeEventListener('hashchange', this.onHashChange, false);
85
86
  this.map.off('moveend', this.updateHash);
86
87
  // clearTimeout(this.updateHash());
87
88
 
package/lib/map.js CHANGED
@@ -14,7 +14,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _l7Utils = require("@antv/l7-utils");
17
- var _lodash = require("lodash");
18
17
  var _camera = _interopRequireDefault(require("./camera"));
19
18
  var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
20
19
  var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
@@ -59,7 +58,7 @@ function loadStyles(css, doc) {
59
58
  loadStyles(".l7-map {\n font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.l7-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.l7-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n\n.l7-canary {\n background-color: salmon;\n}\n\n.l7-canvas-container.l7-interactive,\n.l7-ctrl-group button.l7-ctrl-compass {\n cursor: -webkit-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.l7-canvas-container.l7-interactive.l7-track-pointer {\n cursor: pointer;\n}\n\n.l7-canvas-container.l7-interactive:active,\n.l7-ctrl-group button.l7-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate,\n.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.l7-canvas-container.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: pinch-zoom;\n touch-action: pinch-zoom;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.l7-ctrl-top-left,\n.l7-ctrl-top-right,\n.l7-ctrl-bottom-left,\n.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }\n.l7-ctrl-top-left { top: 0; left: 0; }\n.l7-ctrl-top-right { top: 0; right: 0; }\n.l7-ctrl-bottom-left { bottom: 0; left: 0; }\n.l7-ctrl-bottom-right { right: 0; bottom: 0; }\n\n.l7-ctrl {\n clear: both;\n pointer-events: auto;\n\n /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */\n -webkit-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }\n.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }\n.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }\n.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }\n\n\n.l7-crosshair,\n.l7-crosshair .l7-interactive,\n.l7-crosshair .l7-interactive:active {\n cursor: crosshair;\n}\n\n.l7-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: 0.5;\n z-index: 10;\n}\n"); // @ts-ignore
60
59
  var defaultMinZoom = -2;
61
60
  var defaultMaxZoom = 22;
62
-
61
+ var merge = _l7Utils.lodashUtil.merge;
63
62
  // the default values, but also the valid range
64
63
  var defaultMinPitch = 0;
65
64
  var defaultMaxPitch = 60;
@@ -96,7 +95,7 @@ var Map = /*#__PURE__*/function (_Camera) {
96
95
  function Map(options) {
97
96
  var _this;
98
97
  (0, _classCallCheck2.default)(this, Map);
99
- _this = _super.call(this, (0, _lodash.merge)({}, DefaultOptions, options));
98
+ _this = _super.call(this, merge({}, DefaultOptions, options));
100
99
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
101
100
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
102
101
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
@@ -109,11 +108,7 @@ var Map = /*#__PURE__*/function (_Camera) {
109
108
  }).update();
110
109
  }
111
110
  });
112
- if (_l7Utils.isMini) {
113
- _this.initMiniContainer();
114
- } else {
115
- _this.initContainer();
116
- }
111
+ _this.initContainer();
117
112
  _this.resize();
118
113
  _this.handlers = new _handler_manager.default((0, _assertThisInitialized2.default)(_this), _this.options);
119
114
  if (typeof window !== 'undefined') {
@@ -121,11 +116,9 @@ var Map = /*#__PURE__*/function (_Camera) {
121
116
  window.addEventListener('resize', _this.onWindowResize, false);
122
117
  window.addEventListener('orientationchange', _this.onWindowResize, false);
123
118
  }
124
- if (!_l7Utils.isMini) {
125
- var hashName = typeof options.hash === 'string' && options.hash || undefined;
126
- if (options.hash) {
127
- _this.hash = new _hash.default(hashName).addTo((0, _assertThisInitialized2.default)(_this));
128
- }
119
+ var hashName = typeof options.hash === 'string' && options.hash || undefined;
120
+ if (options.hash) {
121
+ _this.hash = new _hash.default(hashName).addTo((0, _assertThisInitialized2.default)(_this));
129
122
  }
130
123
 
131
124
  // don't set position from options if set through hash
@@ -138,7 +131,7 @@ var Map = /*#__PURE__*/function (_Camera) {
138
131
  });
139
132
  if (options.bounds) {
140
133
  _this.resize();
141
- _this.fitBounds(options.bounds, (0, _lodash.merge)({}, options.fitBoundsOptions, {
134
+ _this.fitBounds(options.bounds, merge({}, options.fitBoundsOptions, {
142
135
  duration: 0
143
136
  }));
144
137
  }
@@ -154,18 +147,15 @@ var Map = /*#__PURE__*/function (_Camera) {
154
147
  height = _this$containerDimens2[1];
155
148
  this.transform.resize(width, height);
156
149
  // 小程序环境不需要执行后续动作
157
- if (_l7Utils.isMini) {
158
- return this;
159
- }
160
150
  var fireMoving = !this.moving;
161
151
  if (fireMoving) {
162
152
  this.stop();
163
- this.emit('movestart', new _l7Utils.$window.Event('movestart', eventData));
164
- this.emit('move', new _l7Utils.$window.Event('move', eventData));
153
+ this.emit('movestart', new window.Event('movestart', eventData));
154
+ this.emit('move', new window.Event('move', eventData));
165
155
  }
166
- this.emit('resize', new _l7Utils.$window.Event('resize', eventData));
156
+ this.emit('resize', new window.Event('resize', eventData));
167
157
  if (fireMoving) {
168
- this.emit('moveend', new _l7Utils.$window.Event('moveend', eventData));
158
+ this.emit('moveend', new window.Event('moveend', eventData));
169
159
  }
170
160
  return this;
171
161
  }
@@ -391,15 +381,10 @@ var Map = /*#__PURE__*/function (_Camera) {
391
381
  var width = 0;
392
382
  var height = 0;
393
383
  if (this.container) {
394
- if (_l7Utils.isMini) {
395
- width = this.container.width / _l7Utils.$window.devicePixelRatio;
396
- height = this.container.height / _l7Utils.$window.devicePixelRatio;
397
- } else {
398
- width = this.container.clientWidth;
399
- height = this.container.clientHeight;
400
- width = width === 0 ? 400 : width;
401
- height = height === 0 ? 300 : height;
402
- }
384
+ width = this.container.clientWidth;
385
+ height = this.container.clientHeight;
386
+ width = width === 0 ? 400 : width;
387
+ height = height === 0 ? 300 : height;
403
388
  }
404
389
  return [width, height];
405
390
  }