bmap.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. var echarts = require("echarts");
  20. var BMapCoordSys = require("./BMapCoordSys");
  21. require("./BMapModel");
  22. require("./BMapView");
  23. /*
  24. * Licensed to the Apache Software Foundation (ASF) under one
  25. * or more contributor license agreements. See the NOTICE file
  26. * distributed with this work for additional information
  27. * regarding copyright ownership. The ASF licenses this file
  28. * to you under the Apache License, Version 2.0 (the
  29. * "License"); you may not use this file except in compliance
  30. * with the License. You may obtain a copy of the License at
  31. *
  32. * http://www.apache.org/licenses/LICENSE-2.0
  33. *
  34. * Unless required by applicable law or agreed to in writing,
  35. * software distributed under the License is distributed on an
  36. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  37. * KIND, either express or implied. See the License for the
  38. * specific language governing permissions and limitations
  39. * under the License.
  40. */
  41. /**
  42. * BMap component extension
  43. */
  44. echarts.registerCoordinateSystem('bmap', BMapCoordSys); // Action
  45. echarts.registerAction({
  46. type: 'bmapRoam',
  47. event: 'bmapRoam',
  48. update: 'updateLayout'
  49. }, function (payload, ecModel) {
  50. ecModel.eachComponent('bmap', function (bMapModel) {
  51. var bmap = bMapModel.getBMap();
  52. var center = bmap.getCenter();
  53. bMapModel.setCenterAndZoom([center.lng, center.lat], bmap.getZoom());
  54. });
  55. });
  56. var version = '1.0.0';
  57. exports.version = version;