@visactor/vrender-core
Version:
## Description
58 lines (50 loc) • 2.5 kB
JavaScript
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
return c > 3 && r && Object.defineProperty(target, key, r), r;
}, __metadata = this && this.__metadata || function(k, v) {
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
}, __param = this && this.__param || function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
import { injectable, inject } from "../common/inversify-lite";
import { DrawContribution } from "./contributions/render";
export const RenderService = Symbol.for("RenderService");
export const BeforeRenderConstribution = Symbol.for("BeforeRenderConstribution");
let DefaultRenderService = class {
constructor(drawContribution) {
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));
}
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;
}
};
DefaultRenderService = __decorate([ injectable(), __param(0, inject(DrawContribution)), __metadata("design:paramtypes", [ Object ]) ], DefaultRenderService);
export { DefaultRenderService };
//# sourceMappingURL=render-service.js.map