UNPKG

@visactor/vtable

Version:

canvas table width high performance

76 lines (64 loc) 3.83 kB
"use strict"; 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; }; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.AfterGifImageRenderContribution = exports.BeforeGifImageRenderContribution = exports.AfterImageRenderContribution = exports.BeforeImageRenderContribution = void 0; const vrender_1 = require("./../../../vrender"); let BeforeImageRenderContribution = class { constructor() { this.time = vrender_1.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([ (0, vrender_1.injectable)() ], BeforeImageRenderContribution), exports.BeforeImageRenderContribution = BeforeImageRenderContribution; let AfterImageRenderContribution = class { constructor() { this.time = vrender_1.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([ (0, vrender_1.injectable)() ], AfterImageRenderContribution), exports.AfterImageRenderContribution = AfterImageRenderContribution; let BeforeGifImageRenderContribution = class { constructor() { this.time = vrender_1.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([ (0, vrender_1.injectable)() ], BeforeGifImageRenderContribution), exports.BeforeGifImageRenderContribution = BeforeGifImageRenderContribution; let AfterGifImageRenderContribution = class { constructor() { this.time = vrender_1.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([ (0, vrender_1.injectable)() ], AfterGifImageRenderContribution), exports.AfterGifImageRenderContribution = AfterGifImageRenderContribution; //# sourceMappingURL=image-contribution-render.js.map