@visactor/vrender-core
Version:
```typescript import { xxx } from '@visactor/vrender-core'; ```
47 lines (42 loc) • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.DefaultRenderService = void 0;
const draw_contribution_1 = require("./contributions/render/draw-contribution");
class DefaultRenderService {
constructor(drawContribution = new draw_contribution_1.DefaultDrawContribution) {
this.drawContribution = drawContribution;
}
prepare(updateBounds) {
updateBounds && this.renderTreeRoots.forEach((g => {
this._prepare(g, updateBounds);
}));
}
_prepare(g, updateBounds) {
g.forEachChildren((g => {
this._prepare(g, updateBounds);
})), g.update({
bounds: updateBounds,
trans: !0
});
}
prepareRenderList() {}
beforeDraw(params) {}
draw(params) {
this.drawContribution.draw(this, Object.assign({}, this.drawParams));
}
afterDraw(params) {
this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
}
reInit() {
this.drawContribution.reInit();
}
render(groups, params) {
this.renderTreeRoots = groups, this.drawParams = params;
const updateBounds = params.updateBounds;
this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params),
this.afterDraw(params), this.drawParams = null;
}
}
exports.DefaultRenderService = DefaultRenderService;
//# sourceMappingURL=render-service.js.map