cione-comp-lib
Version:
`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`
25 lines (24 loc) • 822 B
JavaScript
import { isArray } from "../../../../zrender/lib/core/util.mjs";
import { GraphicComponentModel } from "./GraphicModel.mjs";
import { GraphicComponentView } from "./GraphicView.mjs";
function install(registers) {
registers.registerComponentModel(GraphicComponentModel);
registers.registerComponentView(GraphicComponentView);
registers.registerPreprocessor(function(option) {
var graphicOption = option.graphic;
if (isArray(graphicOption)) {
if (!graphicOption[0] || !graphicOption[0].elements) {
option.graphic = [{
elements: graphicOption
}];
} else {
option.graphic = [option.graphic[0]];
}
} else if (graphicOption && !graphicOption.elements) {
option.graphic = [{
elements: [graphicOption]
}];
}
});
}
export { install };