UNPKG

@visactor/vrender-core

Version:

```typescript import { xxx } from '@visactor/vrender-core'; ```

39 lines (37 loc) 1.33 kB
import { DefaultDrawContribution } from "./contributions/render/draw-contribution"; export class DefaultRenderService { constructor(drawContribution = new 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; } } //# sourceMappingURL=render-service.js.map