UNPKG

@visactor/vtable

Version:

canvas table width high performance

70 lines (56 loc) 3.35 kB
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; }; import { BaseRenderContributionTime, injectable } from "./../../../vrender"; let BeforeImageRenderContribution = class { constructor() { this.time = BaseRenderContributionTime.beforeFillStroke, this.useStyle = !0, this.order = 0; } drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, imageAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) { const {shape: shape} = image.attribute; if ("circle" === shape) { const {width: width = imageAttribute.width, height: height = imageAttribute.height} = image.attribute; context.beginPath(), context.arc(x + width / 2, y + height / 2, Math.min(width, height) / 2, 0, 2 * Math.PI), context.closePath(), context.save(), context.clip(); } } }; BeforeImageRenderContribution = __decorate([ injectable() ], BeforeImageRenderContribution); export { BeforeImageRenderContribution }; let AfterImageRenderContribution = class { constructor() { this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0; } drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, imageAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) { const {shape: shape} = image.attribute; "circle" === shape && context.restore(); } }; AfterImageRenderContribution = __decorate([ injectable() ], AfterImageRenderContribution); export { AfterImageRenderContribution }; let BeforeGifImageRenderContribution = class { constructor() { this.time = BaseRenderContributionTime.beforeFillStroke, this.useStyle = !0, this.order = 0; } drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, imageAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) { const {isGif: isGif} = image.attribute; isGif && image.playing && (image.attribute.opacity = 0); } }; BeforeGifImageRenderContribution = __decorate([ injectable() ], BeforeGifImageRenderContribution); export { BeforeGifImageRenderContribution }; let AfterGifImageRenderContribution = class { constructor() { this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0; } drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, imageAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) { const {isGif: isGif} = image.attribute; isGif && image.playing && (image.attribute.opacity = 1, context.globalAlpha = image.attribute.opacity, image.renderFrame(context, x, y)); } }; AfterGifImageRenderContribution = __decorate([ injectable() ], AfterGifImageRenderContribution); export { AfterGifImageRenderContribution }; //# sourceMappingURL=image-contribution-render.js.map