bmap.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('echarts')) :
  3. typeof define === 'function' && define.amd ? define(['exports', 'echarts'], factory) :
  4. (factory((global.bmap = {}),global.echarts));
  5. }(this, (function (exports,echarts) { 'use strict';
  6. /*
  7. * Licensed to the Apache Software Foundation (ASF) under one
  8. * or more contributor license agreements. See the NOTICE file
  9. * distributed with this work for additional information
  10. * regarding copyright ownership. The ASF licenses this file
  11. * to you under the Apache License, Version 2.0 (the
  12. * "License"); you may not use this file except in compliance
  13. * with the License. You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing,
  18. * software distributed under the License is distributed on an
  19. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  20. * KIND, either express or implied. See the License for the
  21. * specific language governing permissions and limitations
  22. * under the License.
  23. */
  24. /* global BMap */
  25. function BMapCoordSys(bmap, api) {
  26. this._bmap = bmap;
  27. this.dimensions = ['lng', 'lat'];
  28. this._mapOffset = [0, 0];
  29. this._api = api;
  30. this._projection = new BMap.MercatorProjection();
  31. }
  32. BMapCoordSys.prototype.dimensions = ['lng', 'lat'];
  33. BMapCoordSys.prototype.setZoom = function (zoom) {
  34. this._zoom = zoom;
  35. };
  36. BMapCoordSys.prototype.setCenter = function (center) {
  37. this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));
  38. };
  39. BMapCoordSys.prototype.setMapOffset = function (mapOffset) {
  40. this._mapOffset = mapOffset;
  41. };
  42. BMapCoordSys.prototype.getBMap = function () {
  43. return this._bmap;
  44. };
  45. BMapCoordSys.prototype.dataToPoint = function (data) {
  46. var point = new BMap.Point(data[0], data[1]);
  47. // TODO mercator projection is toooooooo slow
  48. // var mercatorPoint = this._projection.lngLatToPoint(point);
  49. // var width = this._api.getZr().getWidth();
  50. // var height = this._api.getZr().getHeight();
  51. // var divider = Math.pow(2, 18 - 10);
  52. // return [
  53. // Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),
  54. // Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)
  55. // ];
  56. var px = this._bmap.pointToOverlayPixel(point);
  57. var mapOffset = this._mapOffset;
  58. return [px.x - mapOffset[0], px.y - mapOffset[1]];
  59. };
  60. BMapCoordSys.prototype.pointToData = function (pt) {
  61. var mapOffset = this._mapOffset;
  62. var pt = this._bmap.overlayPixelToPoint({
  63. x: pt[0] + mapOffset[0],
  64. y: pt[1] + mapOffset[1]
  65. });
  66. return [pt.lng, pt.lat];
  67. };
  68. BMapCoordSys.prototype.getViewRect = function () {
  69. var api = this._api;
  70. return new echarts.graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());
  71. };
  72. BMapCoordSys.prototype.getRoamTransform = function () {
  73. return echarts.matrix.create();
  74. };
  75. BMapCoordSys.prototype.prepareCustoms = function (data) {
  76. var rect = this.getViewRect();
  77. return {
  78. coordSys: {
  79. // The name exposed to user is always 'cartesian2d' but not 'grid'.
  80. type: 'bmap',
  81. x: rect.x,
  82. y: rect.y,
  83. width: rect.width,
  84. height: rect.height
  85. },
  86. api: {
  87. coord: echarts.util.bind(this.dataToPoint, this),
  88. size: echarts.util.bind(dataToCoordSize, this)
  89. }
  90. };
  91. };
  92. function dataToCoordSize(dataSize, dataItem) {
  93. dataItem = dataItem || [0, 0];
  94. return echarts.util.map([0, 1], function (dimIdx) {
  95. var val = dataItem[dimIdx];
  96. var halfSize = dataSize[dimIdx] / 2;
  97. var p1 = [];
  98. var p2 = [];
  99. p1[dimIdx] = val - halfSize;
  100. p2[dimIdx] = val + halfSize;
  101. p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
  102. return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
  103. }, this);
  104. }
  105. var Overlay;
  106. // For deciding which dimensions to use when creating list data
  107. BMapCoordSys.dimensions = BMapCoordSys.prototype.dimensions;
  108. function createOverlayCtor() {
  109. function Overlay(root) {
  110. this._root = root;
  111. }
  112. Overlay.prototype = new BMap.Overlay();
  113. /**
  114. * 初始化
  115. *
  116. * @param {BMap.Map} map
  117. * @override
  118. */
  119. Overlay.prototype.initialize = function (map) {
  120. map.getPanes().labelPane.appendChild(this._root);
  121. return this._root;
  122. };
  123. /**
  124. * @override
  125. */
  126. Overlay.prototype.draw = function () {};
  127. return Overlay;
  128. }
  129. BMapCoordSys.create = function (ecModel, api) {
  130. var bmapCoordSys;
  131. var root = api.getDom();
  132. // TODO Dispose
  133. ecModel.eachComponent('bmap', function (bmapModel) {
  134. var painter = api.getZr().painter;
  135. var viewportRoot = painter.getViewportRoot();
  136. if (typeof BMap === 'undefined') {
  137. throw new Error('BMap api is not loaded');
  138. }
  139. Overlay = Overlay || createOverlayCtor();
  140. if (bmapCoordSys) {
  141. throw new Error('Only one bmap component can exist');
  142. }
  143. if (!bmapModel.__bmap) {
  144. // Not support IE8
  145. var bmapRoot = root.querySelector('.ec-extension-bmap');
  146. if (bmapRoot) {
  147. // Reset viewport left and top, which will be changed
  148. // in moving handler in BMapView
  149. viewportRoot.style.left = '0px';
  150. viewportRoot.style.top = '0px';
  151. root.removeChild(bmapRoot);
  152. }
  153. bmapRoot = document.createElement('div');
  154. bmapRoot.style.cssText = 'width:100%;height:100%';
  155. // Not support IE8
  156. bmapRoot.classList.add('ec-extension-bmap');
  157. root.appendChild(bmapRoot);
  158. var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);
  159. var overlay = new Overlay(viewportRoot);
  160. bmap.addOverlay(overlay);
  161. // Override
  162. painter.getViewportRootOffset = function () {
  163. return {offsetLeft: 0, offsetTop: 0};
  164. };
  165. }
  166. var bmap = bmapModel.__bmap;
  167. // Set bmap options
  168. // centerAndZoom before layout and render
  169. var center = bmapModel.get('center');
  170. var zoom = bmapModel.get('zoom');
  171. if (center && zoom) {
  172. var pt = new BMap.Point(center[0], center[1]);
  173. bmap.centerAndZoom(pt, zoom);
  174. }
  175. bmapCoordSys = new BMapCoordSys(bmap, api);
  176. bmapCoordSys.setMapOffset(bmapModel.__mapOffset || [0, 0]);
  177. bmapCoordSys.setZoom(zoom);
  178. bmapCoordSys.setCenter(center);
  179. bmapModel.coordinateSystem = bmapCoordSys;
  180. });
  181. ecModel.eachSeries(function (seriesModel) {
  182. if (seriesModel.get('coordinateSystem') === 'bmap') {
  183. seriesModel.coordinateSystem = bmapCoordSys;
  184. }
  185. });
  186. };
  187. /*
  188. * Licensed to the Apache Software Foundation (ASF) under one
  189. * or more contributor license agreements. See the NOTICE file
  190. * distributed with this work for additional information
  191. * regarding copyright ownership. The ASF licenses this file
  192. * to you under the Apache License, Version 2.0 (the
  193. * "License"); you may not use this file except in compliance
  194. * with the License. You may obtain a copy of the License at
  195. *
  196. * http://www.apache.org/licenses/LICENSE-2.0
  197. *
  198. * Unless required by applicable law or agreed to in writing,
  199. * software distributed under the License is distributed on an
  200. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  201. * KIND, either express or implied. See the License for the
  202. * specific language governing permissions and limitations
  203. * under the License.
  204. */
  205. function v2Equal(a, b) {
  206. return a && b && a[0] === b[0] && a[1] === b[1];
  207. }
  208. echarts.extendComponentModel({
  209. type: 'bmap',
  210. getBMap: function () {
  211. // __bmap is injected when creating BMapCoordSys
  212. return this.__bmap;
  213. },
  214. setCenterAndZoom: function (center, zoom) {
  215. this.option.center = center;
  216. this.option.zoom = zoom;
  217. },
  218. centerOrZoomChanged: function (center, zoom) {
  219. var option = this.option;
  220. return !(v2Equal(center, option.center) && zoom === option.zoom);
  221. },
  222. defaultOption: {
  223. center: [104.114129, 37.550339],
  224. zoom: 5,
  225. mapStyle: {},
  226. mapStyleV2: {},
  227. roam: false
  228. }
  229. });
  230. /**
  231. * @module zrender/core/util
  232. */
  233. // 用于处理merge时无法遍历Date等对象的问题
  234. var BUILTIN_OBJECT = {
  235. '[object Function]': 1,
  236. '[object RegExp]': 1,
  237. '[object Date]': 1,
  238. '[object Error]': 1,
  239. '[object CanvasGradient]': 1,
  240. '[object CanvasPattern]': 1,
  241. // For node-canvas
  242. '[object Image]': 1,
  243. '[object Canvas]': 1
  244. };
  245. var TYPED_ARRAY = {
  246. '[object Int8Array]': 1,
  247. '[object Uint8Array]': 1,
  248. '[object Uint8ClampedArray]': 1,
  249. '[object Int16Array]': 1,
  250. '[object Uint16Array]': 1,
  251. '[object Int32Array]': 1,
  252. '[object Uint32Array]': 1,
  253. '[object Float32Array]': 1,
  254. '[object Float64Array]': 1
  255. };
  256. var objToString = Object.prototype.toString;
  257. /**
  258. * Those data types can be cloned:
  259. * Plain object, Array, TypedArray, number, string, null, undefined.
  260. * Those data types will be assgined using the orginal data:
  261. * BUILTIN_OBJECT
  262. * Instance of user defined class will be cloned to a plain object, without
  263. * properties in prototype.
  264. * Other data types is not supported (not sure what will happen).
  265. *
  266. * Caution: do not support clone Date, for performance consideration.
  267. * (There might be a large number of date in `series.data`).
  268. * So date should not be modified in and out of echarts.
  269. *
  270. * @param {*} source
  271. * @return {*} new
  272. */
  273. function clone(source) {
  274. if (source == null || typeof source !== 'object') {
  275. return source;
  276. }
  277. var result = source;
  278. var typeStr = objToString.call(source);
  279. if (typeStr === '[object Array]') {
  280. if (!isPrimitive(source)) {
  281. result = [];
  282. for (var i = 0, len = source.length; i < len; i++) {
  283. result[i] = clone(source[i]);
  284. }
  285. }
  286. }
  287. else if (TYPED_ARRAY[typeStr]) {
  288. if (!isPrimitive(source)) {
  289. var Ctor = source.constructor;
  290. if (source.constructor.from) {
  291. result = Ctor.from(source);
  292. }
  293. else {
  294. result = new Ctor(source.length);
  295. for (var i = 0, len = source.length; i < len; i++) {
  296. result[i] = clone(source[i]);
  297. }
  298. }
  299. }
  300. }
  301. else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
  302. result = {};
  303. for (var key in source) {
  304. if (source.hasOwnProperty(key)) {
  305. result[key] = clone(source[key]);
  306. }
  307. }
  308. }
  309. return result;
  310. }
  311. /**
  312. * @memberOf module:zrender/core/util
  313. * @param {*} target
  314. * @param {*} source
  315. * @param {boolean} [overwrite=false]
  316. */
  317. /**
  318. * @param {Array} targetAndSources The first item is target, and the rests are source.
  319. * @param {boolean} [overwrite=false]
  320. * @return {*} target
  321. */
  322. /**
  323. * @param {*} target
  324. * @param {*} source
  325. * @memberOf module:zrender/core/util
  326. */
  327. /**
  328. * @param {*} target
  329. * @param {*} source
  330. * @param {boolean} [overlay=false]
  331. * @memberOf module:zrender/core/util
  332. */
  333. /**
  334. * 查询数组中元素的index
  335. * @memberOf module:zrender/core/util
  336. */
  337. /**
  338. * 构造类继承关系
  339. *
  340. * @memberOf module:zrender/core/util
  341. * @param {Function} clazz 源类
  342. * @param {Function} baseClazz 基类
  343. */
  344. /**
  345. * @memberOf module:zrender/core/util
  346. * @param {Object|Function} target
  347. * @param {Object|Function} sorce
  348. * @param {boolean} overlay
  349. */
  350. /**
  351. * Consider typed array.
  352. * @param {Array|TypedArray} data
  353. */
  354. /**
  355. * 数组或对象遍历
  356. * @memberOf module:zrender/core/util
  357. * @param {Object|Array} obj
  358. * @param {Function} cb
  359. * @param {*} [context]
  360. */
  361. /**
  362. * 数组映射
  363. * @memberOf module:zrender/core/util
  364. * @param {Array} obj
  365. * @param {Function} cb
  366. * @param {*} [context]
  367. * @return {Array}
  368. */
  369. /**
  370. * @memberOf module:zrender/core/util
  371. * @param {Array} obj
  372. * @param {Function} cb
  373. * @param {Object} [memo]
  374. * @param {*} [context]
  375. * @return {Array}
  376. */
  377. /**
  378. * 数组过滤
  379. * @memberOf module:zrender/core/util
  380. * @param {Array} obj
  381. * @param {Function} cb
  382. * @param {*} [context]
  383. * @return {Array}
  384. */
  385. /**
  386. * 数组项查找
  387. * @memberOf module:zrender/core/util
  388. * @param {Array} obj
  389. * @param {Function} cb
  390. * @param {*} [context]
  391. * @return {*}
  392. */
  393. /**
  394. * @memberOf module:zrender/core/util
  395. * @param {Function} func
  396. * @param {*} context
  397. * @return {Function}
  398. */
  399. /**
  400. * @memberOf module:zrender/core/util
  401. * @param {Function} func
  402. * @return {Function}
  403. */
  404. /**
  405. * @memberOf module:zrender/core/util
  406. * @param {*} value
  407. * @return {boolean}
  408. */
  409. /**
  410. * @memberOf module:zrender/core/util
  411. * @param {*} value
  412. * @return {boolean}
  413. */
  414. /**
  415. * @memberOf module:zrender/core/util
  416. * @param {*} value
  417. * @return {boolean}
  418. */
  419. /**
  420. * @memberOf module:zrender/core/util
  421. * @param {*} value
  422. * @return {boolean}
  423. */
  424. /**
  425. * @memberOf module:zrender/core/util
  426. * @param {*} value
  427. * @return {boolean}
  428. */
  429. /**
  430. * @memberOf module:zrender/core/util
  431. * @param {*} value
  432. * @return {boolean}
  433. */
  434. /**
  435. * @memberOf module:zrender/core/util
  436. * @param {*} value
  437. * @return {boolean}
  438. */
  439. function isDom(value) {
  440. return typeof value === 'object'
  441. && typeof value.nodeType === 'number'
  442. && typeof value.ownerDocument === 'object';
  443. }
  444. /**
  445. * Whether is exactly NaN. Notice isNaN('a') returns true.
  446. * @param {*} value
  447. * @return {boolean}
  448. */
  449. /**
  450. * If value1 is not null, then return value1, otherwise judget rest of values.
  451. * Low performance.
  452. * @memberOf module:zrender/core/util
  453. * @return {*} Final value
  454. */
  455. /**
  456. * @memberOf module:zrender/core/util
  457. * @param {Array} arr
  458. * @param {number} startIndex
  459. * @param {number} endIndex
  460. * @return {Array}
  461. */
  462. /**
  463. * Normalize css liked array configuration
  464. * e.g.
  465. * 3 => [3, 3, 3, 3]
  466. * [4, 2] => [4, 2, 4, 2]
  467. * [4, 3, 2] => [4, 3, 2, 3]
  468. * @param {number|Array.<number>} val
  469. * @return {Array.<number>}
  470. */
  471. /**
  472. * @memberOf module:zrender/core/util
  473. * @param {boolean} condition
  474. * @param {string} message
  475. */
  476. /**
  477. * @memberOf module:zrender/core/util
  478. * @param {string} str string to be trimed
  479. * @return {string} trimed string
  480. */
  481. var primitiveKey = '__ec_primitive__';
  482. /**
  483. * Set an object as primitive to be ignored traversing children in clone or merge
  484. */
  485. function isPrimitive(obj) {
  486. return obj[primitiveKey];
  487. }
  488. /*
  489. * Licensed to the Apache Software Foundation (ASF) under one
  490. * or more contributor license agreements. See the NOTICE file
  491. * distributed with this work for additional information
  492. * regarding copyright ownership. The ASF licenses this file
  493. * to you under the Apache License, Version 2.0 (the
  494. * "License"); you may not use this file except in compliance
  495. * with the License. You may obtain a copy of the License at
  496. *
  497. * http://www.apache.org/licenses/LICENSE-2.0
  498. *
  499. * Unless required by applicable law or agreed to in writing,
  500. * software distributed under the License is distributed on an
  501. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  502. * KIND, either express or implied. See the License for the
  503. * specific language governing permissions and limitations
  504. * under the License.
  505. */
  506. echarts.extendComponentView({
  507. type: 'bmap',
  508. render: function (bMapModel, ecModel, api) {
  509. var rendering = true;
  510. var bmap = bMapModel.getBMap();
  511. var viewportRoot = api.getZr().painter.getViewportRoot();
  512. var coordSys = bMapModel.coordinateSystem;
  513. var moveHandler = function (type, target) {
  514. if (rendering) {
  515. return;
  516. }
  517. var offsetEl = viewportRoot.parentNode.parentNode.parentNode;
  518. var mapOffset = [
  519. -parseInt(offsetEl.style.left, 10) || 0,
  520. -parseInt(offsetEl.style.top, 10) || 0
  521. ];
  522. viewportRoot.style.left = mapOffset[0] + 'px';
  523. viewportRoot.style.top = mapOffset[1] + 'px';
  524. coordSys.setMapOffset(mapOffset);
  525. bMapModel.__mapOffset = mapOffset;
  526. api.dispatchAction({
  527. type: 'bmapRoam'
  528. });
  529. };
  530. function zoomEndHandler() {
  531. if (rendering) {
  532. return;
  533. }
  534. api.dispatchAction({
  535. type: 'bmapRoam'
  536. });
  537. }
  538. bmap.removeEventListener('moving', this._oldMoveHandler);
  539. // FIXME
  540. // Moveend may be triggered by centerAndZoom method when creating coordSys next time
  541. // bmap.removeEventListener('moveend', this._oldMoveHandler);
  542. bmap.removeEventListener('zoomend', this._oldZoomEndHandler);
  543. bmap.addEventListener('moving', moveHandler);
  544. // bmap.addEventListener('moveend', moveHandler);
  545. bmap.addEventListener('zoomend', zoomEndHandler);
  546. this._oldMoveHandler = moveHandler;
  547. this._oldZoomEndHandler = zoomEndHandler;
  548. var roam = bMapModel.get('roam');
  549. if (roam && roam !== 'scale') {
  550. bmap.enableDragging();
  551. }
  552. else {
  553. bmap.disableDragging();
  554. }
  555. if (roam && roam !== 'move') {
  556. bmap.enableScrollWheelZoom();
  557. bmap.enableDoubleClickZoom();
  558. bmap.enablePinchToZoom();
  559. }
  560. else {
  561. bmap.disableScrollWheelZoom();
  562. bmap.disableDoubleClickZoom();
  563. bmap.disablePinchToZoom();
  564. }
  565. /* map 2.0 */
  566. var originalStyle = bMapModel.__mapStyle;
  567. var newMapStyle = bMapModel.get('mapStyle') || {};
  568. // FIXME, Not use JSON methods
  569. var mapStyleStr = JSON.stringify(newMapStyle);
  570. if (JSON.stringify(originalStyle) !== mapStyleStr) {
  571. // FIXME May have blank tile when dragging if setMapStyle
  572. if (Object.keys(newMapStyle).length) {
  573. bmap.setMapStyle(clone(newMapStyle));
  574. }
  575. bMapModel.__mapStyle = JSON.parse(mapStyleStr);
  576. }
  577. /* map 3.0 */
  578. var originalStyle2 = bMapModel.__mapStyle2;
  579. var newMapStyle2 = bMapModel.get('mapStyleV2') || {};
  580. // FIXME, Not use JSON methods
  581. var mapStyleStr2 = JSON.stringify(newMapStyle2);
  582. if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
  583. // FIXME May have blank tile when dragging if setMapStyle
  584. if (Object.keys(newMapStyle2).length) {
  585. bmap.setMapStyleV2(clone(newMapStyle2));
  586. }
  587. bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
  588. }
  589. rendering = false;
  590. }
  591. });
  592. /*
  593. * Licensed to the Apache Software Foundation (ASF) under one
  594. * or more contributor license agreements. See the NOTICE file
  595. * distributed with this work for additional information
  596. * regarding copyright ownership. The ASF licenses this file
  597. * to you under the Apache License, Version 2.0 (the
  598. * "License"); you may not use this file except in compliance
  599. * with the License. You may obtain a copy of the License at
  600. *
  601. * http://www.apache.org/licenses/LICENSE-2.0
  602. *
  603. * Unless required by applicable law or agreed to in writing,
  604. * software distributed under the License is distributed on an
  605. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  606. * KIND, either express or implied. See the License for the
  607. * specific language governing permissions and limitations
  608. * under the License.
  609. */
  610. /**
  611. * BMap component extension
  612. */
  613. echarts.registerCoordinateSystem('bmap', BMapCoordSys);
  614. // Action
  615. echarts.registerAction({
  616. type: 'bmapRoam',
  617. event: 'bmapRoam',
  618. update: 'updateLayout'
  619. }, function (payload, ecModel) {
  620. ecModel.eachComponent('bmap', function (bMapModel) {
  621. var bmap = bMapModel.getBMap();
  622. var center = bmap.getCenter();
  623. bMapModel.setCenterAndZoom([center.lng, center.lat], bmap.getZoom());
  624. });
  625. });
  626. var version = '1.0.0';
  627. exports.version = version;
  628. })));
  629. //# sourceMappingURL=bmap.js.map