CoordinateSystem.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. var zrUtil = require("zrender/lib/core/util");
  2. var coordinateSystemCreators = {};
  3. function CoordinateSystemManager() {
  4. this._coordinateSystems = [];
  5. }
  6. CoordinateSystemManager.prototype = {
  7. constructor: CoordinateSystemManager,
  8. create: function (ecModel, api) {
  9. var coordinateSystems = [];
  10. zrUtil.each(coordinateSystemCreators, function (creater, type) {
  11. var list = creater.create(ecModel, api);
  12. coordinateSystems = coordinateSystems.concat(list || []);
  13. });
  14. this._coordinateSystems = coordinateSystems;
  15. },
  16. update: function (ecModel, api) {
  17. zrUtil.each(this._coordinateSystems, function (coordSys) {
  18. // FIXME MUST have
  19. coordSys.update && coordSys.update(ecModel, api);
  20. });
  21. },
  22. getCoordinateSystems: function () {
  23. return this._coordinateSystems.slice();
  24. }
  25. };
  26. CoordinateSystemManager.register = function (type, coordinateSystemCreator) {
  27. coordinateSystemCreators[type] = coordinateSystemCreator;
  28. };
  29. CoordinateSystemManager.get = function (type) {
  30. return coordinateSystemCreators[type];
  31. };
  32. var _default = CoordinateSystemManager;
  33. module.exports = _default;