@visactor/vrender-core 0.18.0-alpha.1 → 0.18.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/graphic/richText.ts"],"names":[],"mappings":"","file":"richText.js","sourcesContent":["import type { IColor } from '../color';\nimport type { IContext2d } from '../context';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { IImage, IImageGraphicAttribute } from './image';\nimport type { ITextGraphicAttribute } from './text';\n\nexport type IRichTextAttribute = {\n width: number;\n height: number;\n ellipsis: boolean | string;\n wordBreak: RichTextWordBreak;\n verticalDirection: RichTextVerticalDirection;\n maxHeight: number;\n maxWidth: number;\n textAlign: RichTextGlobalAlignType;\n textBaseline: RichTextGlobalBaselineType;\n layoutDirection: RichTextLayoutDirectionType;\n textConfig: IRichTextCharacter[];\n singleLine: boolean;\n};\n\nexport type IRichTextGraphicAttribute = Partial<IGraphicAttribute> & Partial<IRichTextAttribute>;\n\nexport type RichTextWordBreak = 'break-word' | 'break-all';\nexport type RichTextVerticalDirection = 'top' | 'middle' | 'bottom';\nexport type RichTextGlobalAlignType = 'left' | 'right' | 'center';\nexport type RichTextGlobalBaselineType = 'top' | 'middle' | 'bottom';\nexport type RichTextLayoutDirectionType = 'horizontal' | 'vertical';\nexport type RichTextFontStyle = 'normal' | 'italic' | 'oblique';\nexport type RichTextTextDecoration = 'none' | 'underline' | 'line-through';\n// export type RichTextTextAlign = 'left' | 'right' | 'center';\nexport type RichTextScript = 'normal' | 'sub' | 'super';\n\nexport type IRichTextBasicCharacter = {\n lineHeight?: number | string;\n textAlign?: CanvasTextAlign; // left, right, center\n textBaseline?: CanvasTextBaseline;\n direction?: RichTextLayoutDirectionType;\n};\n\nexport type IRichTextParagraphCharacter = IRichTextBasicCharacter & {\n text: string | number;\n fontSize?: number;\n fontFamily?: string;\n fill?: IColor | boolean;\n stroke?: IColor | boolean;\n fontWeight?: string;\n // lineHeight?: number;\n fontStyle?: RichTextFontStyle; // normal, italic, oblique\n textDecoration?: RichTextTextDecoration; // none, underline, line-through\n // textAlign?: RichTextTextAlign; // left, right, center\n script?: RichTextScript; // normal, sub, super\n underline?: boolean;\n lineThrough?: boolean;\n // direction?: RichTextLayoutDirectionType;\n};\n\nexport type IRichTextImageCharacter = IRichTextBasicCharacter & {\n // 图片基础属性\n image: string | HTMLImageElement | HTMLCanvasElement;\n width: number;\n height: number;\n\n // hover相关属性\n // backgroundShow?: boolean; // 是否显示background\n backgroundShowMode?: 'always' | 'hover';\n backgroundFill?: boolean | IColor; // 背景矩形填充颜色\n backgroundFillOpacity?: number; // 背景矩形填充透明度\n backgroundStroke?: boolean | IColor; // 背景矩形边框颜色\n backgroundStrokeOpacity?: number; // 背景矩形边框透明度\n backgroundRadius?: number; // 背景矩形圆角\n // background size 同时控制了该icon的响应范围\n backgroundWidth?: number;\n backgroundHeight?: number;\n\n // 唯一标识符\n id?: string;\n\n // lineHeight?: number;\n // textAlign?: RichTextTextAlign; // left, right, center\n // direction?: RichTextLayoutDirectionType;\n margin?: number | number[];\n\n funcType?: string;\n hoverImage?: string | HTMLImageElement | HTMLCanvasElement;\n};\n\nexport type IRichTextCharacter = IRichTextParagraphCharacter | IRichTextImageCharacter;\n\nexport type IRichTextIconGraphicAttribute = IImageGraphicAttribute & {\n id?: string;\n backgroundShowMode?: 'always' | 'hover' | 'never';\n backgroundFill?: boolean | IColor; // 背景矩形填充颜色\n backgroundFillOpacity?: number; // 背景矩形填充透明度\n backgroundStroke?: boolean | IColor; // 背景矩形边框颜色\n backgroundStrokeOpacity?: number; // 背景矩形边框透明度\n backgroundRadius?: number; // 背景矩形圆角\n backgroundWidth?: number;\n backgroundHeight?: number;\n\n // lineHeight?: number;\n textAlign?: CanvasTextAlign; // left, right, center\n textBaseline?: CanvasTextBaseline;\n direction?: RichTextLayoutDirectionType;\n\n margin?: number | number[];\n\n // backgroundShow?: boolean;\n};\n\nexport interface IRichTextParagraph {\n text: string;\n ascent: number;\n descent: number;\n width: number;\n height: number;\n lineHeight: number;\n fontSize: number;\n length: number;\n newLine: boolean;\n character: IRichTextParagraphCharacter;\n left: number;\n top: number;\n direction?: 'horizontal' | 'vertical';\n widthOrigin?: number;\n heightOrigin?: number;\n textBaseline?: CanvasTextBaseline;\n ellipsis: 'normal' | 'add' | 'replace' | 'hide';\n ellipsisWidth: number;\n ellipsisOtherParagraphWidth: number;\n verticalEllipsis?: boolean;\n updateWidth: () => void;\n draw: (ctx: IContext2d, baseline: number, deltaLeft: number, isLineFirst: boolean, textAlign: string) => void;\n getWidthWithEllips: (direction: string) => number;\n}\n\nexport interface IRichTextLine {\n left: number;\n top: number;\n width: number;\n height: number;\n baseline: number;\n ascent: number;\n descent: number;\n paragraphs: (IRichTextParagraph | IRichTextIcon)[];\n actualWidth: number;\n blankWidth: number;\n textAlign: string;\n direction: 'horizontal' | 'vertical';\n directionKey: {\n width: string;\n height: string;\n left: string;\n x: string;\n y: string;\n };\n draw: (\n ctx: IContext2d,\n lastLine: boolean,\n x: number,\n y: number,\n drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void\n ) => void;\n getWidthWithEllips: () => number;\n}\n\nexport interface IRichTextFrame {\n left: number;\n top: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n actualHeight: number;\n ellipsis: boolean | string;\n wordBreak: 'break-word' | 'break-all';\n verticalDirection: 'top' | 'middle' | 'bottom';\n lines: IRichTextLine[];\n globalAlign: 'left' | 'center' | 'right' | 'start' | 'end';\n globalBaseline: 'top' | 'middle' | 'bottom';\n layoutDirection: 'horizontal' | 'vertical';\n directionKey: {\n width: string;\n height: string;\n left: string;\n top: string;\n bottom: string;\n };\n isWidthMax: boolean;\n isHeightMax: boolean;\n singleLine: boolean;\n icons: Map<string, IRichTextIcon>;\n draw: (\n ctx: IContext2d,\n drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void\n ) => boolean;\n getActualSize: () => {\n width: number;\n height: number;\n };\n getRawActualSize: () => {\n width: number;\n height: number;\n };\n getActualSizeWidthEllipsis: () => {\n width: number;\n height: number;\n };\n}\n\nexport interface IRichText extends IGraphic<IRichTextGraphicAttribute> {\n getFrameCache: () => IRichTextFrame;\n}\n\nexport interface IRichTextIcon extends IImage {\n attribute: IRichTextIconGraphicAttribute;\n richtextId?: string;\n globalX?: number;\n globalY?: number;\n\n _x: number;\n _y: number;\n _hovered: boolean;\n _marginArray: [number, number, number, number];\n\n setHoverState: (hovered: boolean) => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/graphic/richText.ts"],"names":[],"mappings":"","file":"richText.js","sourcesContent":["import type { IColor } from '../color';\nimport type { IContext2d } from '../context';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { IImage, IImageGraphicAttribute } from './image';\n\nexport type IRichTextAttribute = {\n width: number;\n height: number;\n ellipsis: boolean | string;\n wordBreak: RichTextWordBreak;\n verticalDirection: RichTextVerticalDirection;\n maxHeight: number;\n maxWidth: number;\n textAlign: RichTextGlobalAlignType;\n textBaseline: RichTextGlobalBaselineType;\n layoutDirection: RichTextLayoutDirectionType;\n textConfig: IRichTextCharacter[];\n singleLine: boolean;\n};\n\nexport type IRichTextGraphicAttribute = Partial<IGraphicAttribute> & Partial<IRichTextAttribute>;\n\nexport type RichTextWordBreak = 'break-word' | 'break-all';\nexport type RichTextVerticalDirection = 'top' | 'middle' | 'bottom';\nexport type RichTextGlobalAlignType = 'left' | 'right' | 'center';\nexport type RichTextGlobalBaselineType = 'top' | 'middle' | 'bottom';\nexport type RichTextLayoutDirectionType = 'horizontal' | 'vertical';\nexport type RichTextFontStyle = 'normal' | 'italic' | 'oblique';\nexport type RichTextTextDecoration = 'none' | 'underline' | 'line-through';\n// export type RichTextTextAlign = 'left' | 'right' | 'center';\nexport type RichTextScript = 'normal' | 'sub' | 'super';\n\nexport type IRichTextBasicCharacter = {\n lineHeight?: number | string;\n textAlign?: CanvasTextAlign; // left, right, center\n textBaseline?: CanvasTextBaseline;\n direction?: RichTextLayoutDirectionType;\n};\n\nexport type IRichTextParagraphCharacter = IRichTextBasicCharacter & {\n text: string | number;\n fontSize?: number;\n fontFamily?: string;\n fill?: IColor | boolean;\n stroke?: IColor | boolean;\n fontWeight?: string;\n // lineHeight?: number;\n fontStyle?: RichTextFontStyle; // normal, italic, oblique\n textDecoration?: RichTextTextDecoration; // none, underline, line-through\n // textAlign?: RichTextTextAlign; // left, right, center\n script?: RichTextScript; // normal, sub, super\n underline?: boolean;\n lineThrough?: boolean;\n // direction?: RichTextLayoutDirectionType;\n};\n\nexport type IRichTextImageCharacter = IRichTextBasicCharacter & {\n // 图片基础属性\n image: string | HTMLImageElement | HTMLCanvasElement;\n width: number;\n height: number;\n\n // hover相关属性\n // backgroundShow?: boolean; // 是否显示background\n backgroundShowMode?: 'always' | 'hover';\n backgroundFill?: boolean | IColor; // 背景矩形填充颜色\n backgroundFillOpacity?: number; // 背景矩形填充透明度\n backgroundStroke?: boolean | IColor; // 背景矩形边框颜色\n backgroundStrokeOpacity?: number; // 背景矩形边框透明度\n backgroundRadius?: number; // 背景矩形圆角\n // background size 同时控制了该icon的响应范围\n backgroundWidth?: number;\n backgroundHeight?: number;\n\n // 唯一标识符\n id?: string;\n\n // lineHeight?: number;\n // textAlign?: RichTextTextAlign; // left, right, center\n // direction?: RichTextLayoutDirectionType;\n margin?: number | number[];\n\n funcType?: string;\n hoverImage?: string | HTMLImageElement | HTMLCanvasElement;\n};\n\nexport type IRichTextCharacter = IRichTextParagraphCharacter | IRichTextImageCharacter;\n\nexport type IRichTextIconGraphicAttribute = IImageGraphicAttribute & {\n id?: string;\n backgroundShowMode?: 'always' | 'hover' | 'never';\n backgroundFill?: boolean | IColor; // 背景矩形填充颜色\n backgroundFillOpacity?: number; // 背景矩形填充透明度\n backgroundStroke?: boolean | IColor; // 背景矩形边框颜色\n backgroundStrokeOpacity?: number; // 背景矩形边框透明度\n backgroundRadius?: number; // 背景矩形圆角\n backgroundWidth?: number;\n backgroundHeight?: number;\n\n // lineHeight?: number;\n textAlign?: CanvasTextAlign; // left, right, center\n textBaseline?: CanvasTextBaseline;\n direction?: RichTextLayoutDirectionType;\n\n margin?: number | number[];\n\n // backgroundShow?: boolean;\n};\n\nexport interface IRichTextParagraph {\n text: string;\n ascent: number;\n descent: number;\n width: number;\n height: number;\n lineHeight: number;\n fontSize: number;\n length: number;\n newLine: boolean;\n character: IRichTextParagraphCharacter;\n left: number;\n top: number;\n direction?: 'horizontal' | 'vertical';\n widthOrigin?: number;\n heightOrigin?: number;\n textBaseline?: CanvasTextBaseline;\n ellipsis: 'normal' | 'add' | 'replace' | 'hide';\n ellipsisWidth: number;\n ellipsisOtherParagraphWidth: number;\n verticalEllipsis?: boolean;\n updateWidth: () => void;\n draw: (ctx: IContext2d, baseline: number, deltaLeft: number, isLineFirst: boolean, textAlign: string) => void;\n getWidthWithEllips: (direction: string) => number;\n}\n\nexport interface IRichTextLine {\n left: number;\n top: number;\n width: number;\n height: number;\n baseline: number;\n ascent: number;\n descent: number;\n paragraphs: (IRichTextParagraph | IRichTextIcon)[];\n actualWidth: number;\n blankWidth: number;\n textAlign: string;\n direction: 'horizontal' | 'vertical';\n directionKey: {\n width: string;\n height: string;\n left: string;\n x: string;\n y: string;\n };\n draw: (\n ctx: IContext2d,\n lastLine: boolean,\n x: number,\n y: number,\n drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void\n ) => void;\n getWidthWithEllips: () => number;\n}\n\nexport interface IRichTextFrame {\n left: number;\n top: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n actualHeight: number;\n ellipsis: boolean | string;\n wordBreak: 'break-word' | 'break-all';\n verticalDirection: 'top' | 'middle' | 'bottom';\n lines: IRichTextLine[];\n globalAlign: 'left' | 'center' | 'right' | 'start' | 'end';\n globalBaseline: 'top' | 'middle' | 'bottom';\n layoutDirection: 'horizontal' | 'vertical';\n directionKey: {\n width: string;\n height: string;\n left: string;\n top: string;\n bottom: string;\n };\n isWidthMax: boolean;\n isHeightMax: boolean;\n singleLine: boolean;\n icons: Map<string, IRichTextIcon>;\n draw: (\n ctx: IContext2d,\n drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void\n ) => boolean;\n getActualSize: () => {\n width: number;\n height: number;\n };\n getRawActualSize: () => {\n width: number;\n height: number;\n };\n getActualSizeWidthEllipsis: () => {\n width: number;\n height: number;\n };\n}\n\nexport interface IRichText extends IGraphic<IRichTextGraphicAttribute> {\n getFrameCache: () => IRichTextFrame;\n}\n\nexport interface IRichTextIcon extends IImage {\n attribute: IRichTextIconGraphicAttribute;\n richtextId?: string;\n globalX?: number;\n globalY?: number;\n\n _x: number;\n _y: number;\n _hovered: boolean;\n _marginArray: [number, number, number, number];\n\n setHoverState: (hovered: boolean) => void;\n}\n"]}
@@ -71,10 +71,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
71
71
  }
72
72
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
73
73
  var _a, _b, _c, _d, _e;
74
- const {points: points} = area.attribute;
75
- if (points.length < 2) return;
76
74
  context.beginPath();
77
- const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0, startP = points[0];
75
+ const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0, {points: points} = area.attribute, startP = points[0];
78
76
  context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
79
77
  for (let i = 1; i < points.length; i++) {
80
78
  const p = points[i];
@@ -206,7 +204,6 @@ let DefaultCanvasAreaRender = class extends BaseRender {
206
204
  }
207
205
  _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, connect, fillCb, strokeCb) {
208
206
  var _a, _b, _c, _d;
209
- if (!(cache && cache.top && cache.bottom && cache.top.curves && cache.top.curves.length && cache.bottom.curves && cache.bottom.curves.length)) return;
210
207
  let {connectedType: connectedType, connectedX: connectedX, connectedY: connectedY, connectedStyle: connectedStyle} = attribute;
211
208
  const da = [];
212
209
  if (connect && (isArray(defaultAttribute) ? (connectedType = null !== (_a = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _a ? _a : defaultAttribute[1].connectedType,
@@ -218,6 +215,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
218
215
  "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"),
219
216
  isArray(defaultAttribute) ? defaultAttribute.forEach((i => da.push(i))) : da.push(defaultAttribute),
220
217
  da.push(attribute)), connect && "none" === connectedType) return !1;
218
+ if (!cache) return;
221
219
  context.beginPath();
222
220
  const {points: points, segments: segments} = area.attribute;
223
221
  let endP, startP, direction = Direction.ROW;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/area-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAqB3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAA8B,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,8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,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAChD,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EACpC,SAAS,EACT,SAAS,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EACvC;wBACE,OAAO;wBACP,OAAO;wBACP,OAAO;wBACP,WAAW,EAAE,OAAO;wBACpB,IAAI,EAAE,aAAa;wBACnB,KAAK,EAAE,UAAU;wBACjB,KAAK,EAAE,UAAU;qBAClB,CACF,CAAC;iBACH;gBACD,OAAO,CAAC,cAAc,CACpB,IAAI,EACJ,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EACpC,OAAO,GAAG,OAAO,EACjB,OAAO,GAAG,OAAO,EACjB,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAChC,CAAC;gBACF,OAAO,CAAC,MAAM,EAAE,CAAC;aAClB;SACF;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAvoBY,uBAAuB;IADnC,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;;GANrB,uBAAuB,CAuoBnC;SAvoBY,uBAAuB","file":"area-render.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport { abs, isArray, min } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport type {\n IArea,\n IAreaCacheItem,\n IAreaGraphicAttribute,\n IGraphicAttribute,\n IContext2d,\n ICurveType,\n IMarkAttribute,\n IThemeAttribute,\n ISegPath2D,\n IDirection,\n IAreaRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IStrokeType\n} from '../../../interface';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport {\n genLinearSegments,\n genBasisSegments,\n genMonotoneXSegments,\n genMonotoneYSegments,\n genStepSegments,\n genLinearClosedSegments\n} from '../../../common/segment';\n\nimport { getTheme } from '../../../graphic/theme';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { AreaRenderContribution } from './contributions/constants';\nimport { BaseRenderContributionTime, Direction } from '../../../common/enums';\nimport { drawAreaSegments } from '../../../common/render-area';\nimport { AREA_NUMBER_TYPE } from '../../../graphic/constants';\nimport { drawSegments } from '../../../common/render-curve';\nimport { BaseRender } from './base-render';\nimport {\n defaultAreaBackgroundRenderContribution,\n defaultAreaTextureRenderContribution\n} from './contributions/area-contribution-render';\nimport { segments } from '../../../common/shape/arc';\n\nfunction calcLineCache(\n points: IPointLike[],\n curveType: ICurveType,\n params?: { direction?: IDirection; startPoint?: IPointLike }\n): ISegPath2D | null {\n switch (curveType) {\n case 'linear':\n return genLinearSegments(points, params);\n case 'basis':\n return genBasisSegments(points, params);\n case 'monotoneX':\n return genMonotoneXSegments(points, params);\n case 'monotoneY':\n return genMonotoneYSegments(points, params);\n case 'step':\n return genStepSegments(points, 0.5, params);\n case 'stepBefore':\n return genStepSegments(points, 0, params);\n case 'stepAfter':\n return genStepSegments(points, 1, params);\n case 'linearClosed':\n return genLinearClosedSegments(points, params);\n default:\n return genLinearSegments(points, params);\n }\n}\n\n@injectable()\nexport class DefaultCanvasAreaRender extends BaseRender<IArea> implements IGraphicRender {\n type: 'area';\n numberType: number = AREA_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(AreaRenderContribution)\n protected readonly areaRenderContribitions: IContributionProvider<IAreaRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution];\n this.init(areaRenderContribitions);\n }\n\n drawLinearAreaHighPerformance(\n area: IArea,\n context: IContext2d,\n fill: boolean,\n stroke: boolean,\n fillOpacity: number,\n strokeOpacity: number,\n offsetX: number,\n offsetY: number,\n areaAttribute: Required<IAreaGraphicAttribute>,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const { points } = area.attribute;\n if (points.length < 2) {\n return;\n }\n context.beginPath();\n\n const z = this.z ?? 0;\n const startP = points[0];\n\n context.moveTo(startP.x + offsetX, startP.y + offsetY, z);\n for (let i = 1; i < points.length; i++) {\n const p = points[i];\n context.lineTo(p.x + offsetX, p.y + offsetY, z);\n }\n for (let i = points.length - 1; i >= 0; i--) {\n const p = points[i];\n context.lineTo((p.x1 ?? p.x) + offsetX, (p.y1 ?? p.y) + offsetY, z);\n }\n context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute);\n\n this.beforeRenderStep(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n areaAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute: area.attribute }\n );\n\n const { x: originX = 0, x: originY = 0 } = area.attribute;\n if (fill !== false) {\n if (fillCb) {\n fillCb(context, area.attribute, areaAttribute);\n } else if (fillOpacity) {\n context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);\n context.fill();\n }\n }\n\n this.afterRenderStep(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n areaAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute: area.attribute }\n );\n\n if (stroke) {\n const { stroke = areaAttribute && areaAttribute.stroke } = area.attribute;\n if (isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {\n context.beginPath();\n if (stroke[0]) {\n context.moveTo(startP.x + offsetX, startP.y + offsetY, z);\n for (let i = 1; i < points.length; i++) {\n const p = points[i];\n context.lineTo(p.x + offsetX, p.y + offsetY, z);\n }\n } else if (stroke[2]) {\n const endP = points[points.length - 1];\n context.moveTo(endP.x + offsetX, endP.y + offsetY, z);\n for (let i = points.length - 2; i >= 0; i--) {\n const p = points[i];\n context.lineTo((p.x1 ?? p.x) + offsetX, (p.y1 ?? p.y) + offsetY, z);\n }\n }\n }\n if (strokeCb) {\n strokeCb(context, area.attribute, areaAttribute);\n } else {\n context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);\n context.stroke();\n }\n }\n }\n\n drawShape(\n area: IArea,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const areaAttribute = getTheme(area, params?.theme).area;\n const {\n fill = areaAttribute.fill,\n stroke = areaAttribute.stroke,\n fillOpacity = areaAttribute.fillOpacity,\n z = areaAttribute.z,\n strokeOpacity = areaAttribute.strokeOpacity\n } = area.attribute;\n\n const data = this.valid(area, areaAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { doFill, doStroke } = data;\n\n const { clipRange = areaAttribute.clipRange, closePath, points, segments } = area.attribute;\n let { curveType = areaAttribute.curveType } = area.attribute;\n if (closePath && curveType === 'linear') {\n curveType = 'linearClosed';\n }\n\n if (clipRange === 1 && !segments && !points.some(p => p.defined === false) && curveType === 'linear') {\n return this.drawLinearAreaHighPerformance(\n area,\n context,\n !!fill,\n doStroke,\n fillOpacity,\n strokeOpacity,\n x,\n y,\n areaAttribute,\n drawContext,\n params,\n fillCb,\n strokeCb\n );\n }\n\n // 更新cache\n if (area.shouldUpdateShape()) {\n if (segments && segments.length) {\n let startPoint: IPointLike;\n let lastTopSeg: { endX: number; endY: number };\n const topCaches = segments\n .map((seg, index) => {\n if (seg.points.length <= 1) {\n // 第一个点的话,直接设置lastTopSeg\n if (index === 0) {\n seg.points[0] && (lastTopSeg = { endX: seg.points[0].x, endY: seg.points[0].y });\n return null;\n }\n }\n // 添加上一个segment结束的点作为这个segment的起始点\n if (index === 1) {\n startPoint = { x: lastTopSeg.endX, y: lastTopSeg.endY };\n } else if (index > 1) {\n startPoint.x = lastTopSeg.endX;\n startPoint.y = lastTopSeg.endY;\n }\n const data = calcLineCache(seg.points, curveType, {\n startPoint\n });\n lastTopSeg = data;\n return data;\n })\n .filter(item => !!item);\n let lastBottomSeg: ISegPath2D;\n const bottomCaches = [];\n for (let i = segments.length - 1; i >= 0; i--) {\n const points = segments[i].points;\n const bottomPoints: IPointLike[] = [];\n for (let i = points.length - 1; i >= 0; i--) {\n bottomPoints.push({\n x: points[i].x1 ?? points[i].x,\n y: points[i].y1 ?? points[i].y\n });\n }\n // 处理一下bottom的segments,bottom的segments需要手动添加endPoints\n if (i !== 0) {\n const lastSegmentPoints = segments[i - 1].points;\n const endPoint = lastSegmentPoints[lastSegmentPoints.length - 1];\n endPoint &&\n bottomPoints.push({\n x: endPoint.x1 ?? endPoint.x,\n y: endPoint.y1 ?? endPoint.y\n });\n }\n if (bottomPoints.length > 1) {\n lastBottomSeg = calcLineCache(\n bottomPoints,\n curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType\n );\n bottomCaches.unshift(lastBottomSeg);\n }\n }\n area.cacheArea = bottomCaches.map((item, index) => ({\n top: topCaches[index],\n bottom: item\n }));\n } else if (points && points.length) {\n // 转换points\n const topPoints = points;\n const bottomPoints: IPointLike[] = [];\n for (let i = points.length - 1; i >= 0; i--) {\n bottomPoints.push({\n x: points[i].x1 ?? points[i].x,\n y: points[i].y1 ?? points[i].y\n });\n }\n const topCache = calcLineCache(topPoints, curveType);\n const bottomCache = calcLineCache(\n bottomPoints,\n curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType\n );\n\n area.cacheArea = { top: topCache, bottom: bottomCache };\n } else {\n area.cacheArea = null;\n area.clearUpdateShapeTag();\n return;\n }\n area.clearUpdateShapeTag();\n }\n\n if (Array.isArray(area.cacheArea)) {\n const segments = area.attribute.segments.filter(item => item.points.length);\n // 如果第一个seg只有一个点,那么shift出去\n if (segments[0].points.length === 1) {\n segments.shift();\n }\n if (clipRange === 1) {\n let skip = false;\n // 性能优化,不需要clip的线段不需要计算长度\n area.cacheArea.forEach((cache, index) => {\n if (skip) {\n return;\n }\n skip = this.drawSegmentItem(\n context,\n cache,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n segments[index],\n [areaAttribute, area.attribute],\n clipRange,\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n });\n } else {\n // 如果是segments的话,每个clipRange需要重新计算\n // 整个线段的总长度\n const totalLength = area.cacheArea.reduce((l, c) => l + c.top.getLength(), 0);\n // 总需要绘制的长度\n const totalDrawLength = clipRange * totalLength;\n // 直到上次绘制的长度\n let drawedLengthUntilLast = 0;\n let skip = false;\n area.cacheArea.forEach((cache, index) => {\n if (skip) {\n return;\n }\n const curSegLength = cache.top.getLength();\n const _cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;\n drawedLengthUntilLast += curSegLength;\n if (_cr > 0) {\n skip = this.drawSegmentItem(\n context,\n cache,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n segments[index],\n [areaAttribute, area.attribute],\n min(_cr, 1),\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n }\n } else {\n this.drawSegmentItem(\n context,\n area.cacheArea as IAreaCacheItem,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n area.attribute,\n areaAttribute,\n clipRange,\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n }\n\n draw(area: IArea, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const areaAttribute = getTheme(area, params?.theme).area;\n this._draw(area, areaAttribute, false, drawContext, params);\n }\n\n /**\n * 绘制segment\n * @param context\n * @param cache\n * @param fill\n * @param stroke\n * @param attribute\n * @param defaultAttribute\n * @param clipRange\n * @param offsetX\n * @param offsetY\n * @param fillCb\n * @param strokeCb\n * @returns 返回true代表跳过后续绘制\n */\n protected drawSegmentItem(\n context: IContext2d,\n cache: IAreaCacheItem,\n fill: boolean,\n fillOpacity: number,\n stroke: boolean,\n strokeOpacity: number,\n attribute: Partial<IAreaGraphicAttribute>,\n defaultAttribute: Required<IAreaGraphicAttribute> | Partial<IAreaGraphicAttribute>[],\n clipRange: number,\n offsetX: number,\n offsetY: number,\n offsetZ: number,\n area: IArea,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean\n ): boolean {\n let ret = false;\n ret =\n ret ||\n this._drawSegmentItem(\n context,\n cache,\n fill,\n fillOpacity,\n stroke,\n strokeOpacity,\n attribute,\n defaultAttribute,\n clipRange,\n offsetX,\n offsetY,\n offsetZ,\n area,\n drawContext,\n false,\n fillCb,\n strokeCb\n );\n ret =\n ret ||\n this._drawSegmentItem(\n context,\n cache,\n fill,\n fillOpacity,\n stroke,\n strokeOpacity,\n attribute,\n defaultAttribute,\n clipRange,\n offsetX,\n offsetY,\n offsetZ,\n area,\n drawContext,\n true,\n fillCb,\n strokeCb\n );\n return ret;\n }\n\n protected _drawSegmentItem(\n context: IContext2d,\n cache: IAreaCacheItem,\n fill: boolean,\n fillOpacity: number,\n stroke: boolean,\n strokeOpacity: number,\n attribute: Partial<IAreaGraphicAttribute>,\n defaultAttribute: Required<IAreaGraphicAttribute> | Partial<IAreaGraphicAttribute>[],\n clipRange: number,\n offsetX: number,\n offsetY: number,\n offsetZ: number,\n area: IArea,\n drawContext: IDrawContext,\n connect: boolean,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean\n ) {\n if (\n !(\n cache &&\n cache.top &&\n cache.bottom &&\n cache.top.curves &&\n cache.top.curves.length &&\n cache.bottom.curves &&\n cache.bottom.curves.length\n )\n ) {\n return;\n }\n // 绘制connect区域\n let { connectedType, connectedX, connectedY, connectedStyle } = attribute;\n const da = [];\n if (connect) {\n if (isArray(defaultAttribute)) {\n connectedType = connectedType ?? defaultAttribute[0].connectedType ?? defaultAttribute[1].connectedType;\n connectedX = connectedX ?? defaultAttribute[0].connectedX ?? defaultAttribute[1].connectedX;\n connectedY = connectedY ?? defaultAttribute[0].connectedY ?? defaultAttribute[1].connectedY;\n connectedStyle = connectedStyle ?? defaultAttribute[0].connectedStyle ?? defaultAttribute[1].connectedStyle;\n } else {\n connectedType = connectedType ?? defaultAttribute.connectedType;\n connectedX = connectedX ?? defaultAttribute.connectedX;\n connectedY = connectedY ?? defaultAttribute.connectedY;\n connectedStyle = connectedStyle ?? defaultAttribute.connectedStyle;\n }\n\n // 如果有非法值就是none\n if (connectedType !== 'connect' && connectedType !== 'zero') {\n connectedType = 'none';\n }\n\n if (isArray(defaultAttribute)) {\n defaultAttribute.forEach(i => da.push(i));\n } else {\n da.push(defaultAttribute);\n }\n da.push(attribute);\n }\n\n if (connect && connectedType === 'none') {\n return false;\n }\n\n context.beginPath();\n\n const ret: boolean = false;\n const { points, segments } = area.attribute;\n let direction = Direction.ROW;\n let endP: IPointLike;\n let startP: IPointLike;\n if (segments) {\n const endSeg = segments[segments.length - 1];\n const startSeg = segments[0];\n startP = startSeg.points[0];\n endP = endSeg.points[endSeg.points.length - 1];\n } else {\n startP = points[0];\n endP = points[points.length - 1];\n }\n const xTotalLength = abs(endP.x - startP.x);\n const yTotalLength = abs(endP.y - startP.y);\n direction = xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN;\n drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {\n offsetX,\n offsetY,\n offsetZ,\n direction,\n drawConnect: connect,\n mode: connectedType,\n zeroX: connectedX,\n zeroY: connectedY\n });\n\n this.beforeRenderStep(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n defaultAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute }\n );\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);\n\n const { x: originX = 0, x: originY = 0 } = attribute;\n if (fill !== false) {\n if (fillCb) {\n fillCb(context, attribute, defaultAttribute);\n } else if (fillOpacity) {\n context.setCommonStyle(\n area,\n connect ? connectedStyle : attribute,\n originX - offsetX,\n originY - offsetY,\n connect ? da : defaultAttribute\n );\n context.fill();\n }\n }\n\n this.afterRenderStep(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n defaultAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute }\n );\n\n if (stroke !== false) {\n if (strokeCb) {\n strokeCb(context, attribute, defaultAttribute);\n } else {\n const { stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke } = attribute;\n if (isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {\n context.beginPath();\n drawSegments(\n context.camera ? context : context.nativeContext,\n stroke[0] ? cache.top : cache.bottom,\n clipRange,\n direction === Direction.ROW ? 'x' : 'y',\n {\n offsetX,\n offsetY,\n offsetZ,\n drawConnect: connect,\n mode: connectedType,\n zeroX: connectedX,\n zeroY: connectedY\n }\n );\n }\n context.setStrokeStyle(\n area,\n connect ? connectedStyle : attribute,\n originX - offsetX,\n originY - offsetY,\n connect ? da : defaultAttribute\n );\n context.stroke();\n }\n }\n\n return ret;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/area-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAqB3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAA8B,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACrC,MAAM,0CAA0C,CAAC;AAGlD,SAAS,aAAa,CACpB,MAAoB,EACpB,SAAqB,EACrB,MAA4D;IAE5D,QAAQ,SAAS,EAAE;QACjB,KAAK,QAAQ;YACX,OAAO,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,KAAK,OAAO;YAC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CAAC,gBAAgB,CAChC,CAAC;gBACF,OAAO,CAAC,MAAM,EAAE,CAAC;aAClB;SACF;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AA1nBY,uBAAuB;IADnC,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;;GANrB,uBAAuB,CA0nBnC;SA1nBY,uBAAuB","file":"area-render.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport { abs, isArray, min } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport type {\n IArea,\n IAreaCacheItem,\n IAreaGraphicAttribute,\n IGraphicAttribute,\n IContext2d,\n ICurveType,\n IMarkAttribute,\n IThemeAttribute,\n ISegPath2D,\n IDirection,\n IAreaRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IStrokeType\n} from '../../../interface';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport {\n genLinearSegments,\n genBasisSegments,\n genMonotoneXSegments,\n genMonotoneYSegments,\n genStepSegments,\n genLinearClosedSegments\n} from '../../../common/segment';\n\nimport { getTheme } from '../../../graphic/theme';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { AreaRenderContribution } from './contributions/constants';\nimport { BaseRenderContributionTime, Direction } from '../../../common/enums';\nimport { drawAreaSegments } from '../../../common/render-area';\nimport { AREA_NUMBER_TYPE } from '../../../graphic/constants';\nimport { drawSegments } from '../../../common/render-curve';\nimport { BaseRender } from './base-render';\nimport {\n defaultAreaBackgroundRenderContribution,\n defaultAreaTextureRenderContribution\n} from './contributions/area-contribution-render';\nimport { segments } from '../../../common/shape/arc';\n\nfunction calcLineCache(\n points: IPointLike[],\n curveType: ICurveType,\n params?: { direction?: IDirection; startPoint?: IPointLike }\n): ISegPath2D | null {\n switch (curveType) {\n case 'linear':\n return genLinearSegments(points, params);\n case 'basis':\n return genBasisSegments(points, params);\n case 'monotoneX':\n return genMonotoneXSegments(points, params);\n case 'monotoneY':\n return genMonotoneYSegments(points, params);\n case 'step':\n return genStepSegments(points, 0.5, params);\n case 'stepBefore':\n return genStepSegments(points, 0, params);\n case 'stepAfter':\n return genStepSegments(points, 1, params);\n case 'linearClosed':\n return genLinearClosedSegments(points, params);\n default:\n return genLinearSegments(points, params);\n }\n}\n\n@injectable()\nexport class DefaultCanvasAreaRender extends BaseRender<IArea> implements IGraphicRender {\n type: 'area';\n numberType: number = AREA_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(AreaRenderContribution)\n protected readonly areaRenderContribitions: IContributionProvider<IAreaRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution];\n this.init(areaRenderContribitions);\n }\n\n drawLinearAreaHighPerformance(\n area: IArea,\n context: IContext2d,\n fill: boolean,\n stroke: boolean,\n fillOpacity: number,\n strokeOpacity: number,\n offsetX: number,\n offsetY: number,\n areaAttribute: Required<IAreaGraphicAttribute>,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n context.beginPath();\n\n const z = this.z ?? 0;\n const { points } = area.attribute;\n const startP = points[0];\n\n context.moveTo(startP.x + offsetX, startP.y + offsetY, z);\n for (let i = 1; i < points.length; i++) {\n const p = points[i];\n context.lineTo(p.x + offsetX, p.y + offsetY, z);\n }\n for (let i = points.length - 1; i >= 0; i--) {\n const p = points[i];\n context.lineTo((p.x1 ?? p.x) + offsetX, (p.y1 ?? p.y) + offsetY, z);\n }\n context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute);\n\n this.beforeRenderStep(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n areaAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute: area.attribute }\n );\n\n const { x: originX = 0, x: originY = 0 } = area.attribute;\n if (fill !== false) {\n if (fillCb) {\n fillCb(context, area.attribute, areaAttribute);\n } else if (fillOpacity) {\n context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);\n context.fill();\n }\n }\n\n this.afterRenderStep(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n areaAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute: area.attribute }\n );\n\n if (stroke) {\n const { stroke = areaAttribute && areaAttribute.stroke } = area.attribute;\n if (isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {\n context.beginPath();\n if (stroke[0]) {\n context.moveTo(startP.x + offsetX, startP.y + offsetY, z);\n for (let i = 1; i < points.length; i++) {\n const p = points[i];\n context.lineTo(p.x + offsetX, p.y + offsetY, z);\n }\n } else if (stroke[2]) {\n const endP = points[points.length - 1];\n context.moveTo(endP.x + offsetX, endP.y + offsetY, z);\n for (let i = points.length - 2; i >= 0; i--) {\n const p = points[i];\n context.lineTo((p.x1 ?? p.x) + offsetX, (p.y1 ?? p.y) + offsetY, z);\n }\n }\n }\n if (strokeCb) {\n strokeCb(context, area.attribute, areaAttribute);\n } else {\n context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);\n context.stroke();\n }\n }\n }\n\n drawShape(\n area: IArea,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const areaAttribute = getTheme(area, params?.theme).area;\n const {\n fill = areaAttribute.fill,\n stroke = areaAttribute.stroke,\n fillOpacity = areaAttribute.fillOpacity,\n z = areaAttribute.z,\n strokeOpacity = areaAttribute.strokeOpacity\n } = area.attribute;\n\n const data = this.valid(area, areaAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { doFill, doStroke } = data;\n\n const { clipRange = areaAttribute.clipRange, closePath, points, segments } = area.attribute;\n let { curveType = areaAttribute.curveType } = area.attribute;\n if (closePath && curveType === 'linear') {\n curveType = 'linearClosed';\n }\n\n if (clipRange === 1 && !segments && !points.some(p => p.defined === false) && curveType === 'linear') {\n return this.drawLinearAreaHighPerformance(\n area,\n context,\n !!fill,\n doStroke,\n fillOpacity,\n strokeOpacity,\n x,\n y,\n areaAttribute,\n drawContext,\n params,\n fillCb,\n strokeCb\n );\n }\n\n // 更新cache\n if (area.shouldUpdateShape()) {\n if (segments && segments.length) {\n let startPoint: IPointLike;\n let lastTopSeg: { endX: number; endY: number };\n const topCaches = segments\n .map((seg, index) => {\n if (seg.points.length <= 1) {\n // 第一个点的话,直接设置lastTopSeg\n if (index === 0) {\n seg.points[0] && (lastTopSeg = { endX: seg.points[0].x, endY: seg.points[0].y });\n return null;\n }\n }\n // 添加上一个segment结束的点作为这个segment的起始点\n if (index === 1) {\n startPoint = { x: lastTopSeg.endX, y: lastTopSeg.endY };\n } else if (index > 1) {\n startPoint.x = lastTopSeg.endX;\n startPoint.y = lastTopSeg.endY;\n }\n const data = calcLineCache(seg.points, curveType, {\n startPoint\n });\n lastTopSeg = data;\n return data;\n })\n .filter(item => !!item);\n let lastBottomSeg: ISegPath2D;\n const bottomCaches = [];\n for (let i = segments.length - 1; i >= 0; i--) {\n const points = segments[i].points;\n const bottomPoints: IPointLike[] = [];\n for (let i = points.length - 1; i >= 0; i--) {\n bottomPoints.push({\n x: points[i].x1 ?? points[i].x,\n y: points[i].y1 ?? points[i].y\n });\n }\n // 处理一下bottom的segments,bottom的segments需要手动添加endPoints\n if (i !== 0) {\n const lastSegmentPoints = segments[i - 1].points;\n const endPoint = lastSegmentPoints[lastSegmentPoints.length - 1];\n endPoint &&\n bottomPoints.push({\n x: endPoint.x1 ?? endPoint.x,\n y: endPoint.y1 ?? endPoint.y\n });\n }\n if (bottomPoints.length > 1) {\n lastBottomSeg = calcLineCache(\n bottomPoints,\n curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType\n );\n bottomCaches.unshift(lastBottomSeg);\n }\n }\n area.cacheArea = bottomCaches.map((item, index) => ({\n top: topCaches[index],\n bottom: item\n }));\n } else if (points && points.length) {\n // 转换points\n const topPoints = points;\n const bottomPoints: IPointLike[] = [];\n for (let i = points.length - 1; i >= 0; i--) {\n bottomPoints.push({\n x: points[i].x1 ?? points[i].x,\n y: points[i].y1 ?? points[i].y\n });\n }\n const topCache = calcLineCache(topPoints, curveType);\n const bottomCache = calcLineCache(\n bottomPoints,\n curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType\n );\n\n area.cacheArea = { top: topCache, bottom: bottomCache };\n } else {\n area.cacheArea = null;\n area.clearUpdateShapeTag();\n return;\n }\n area.clearUpdateShapeTag();\n }\n\n if (Array.isArray(area.cacheArea)) {\n const segments = area.attribute.segments.filter(item => item.points.length);\n // 如果第一个seg只有一个点,那么shift出去\n if (segments[0].points.length === 1) {\n segments.shift();\n }\n if (clipRange === 1) {\n let skip = false;\n // 性能优化,不需要clip的线段不需要计算长度\n area.cacheArea.forEach((cache, index) => {\n if (skip) {\n return;\n }\n skip = this.drawSegmentItem(\n context,\n cache,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n segments[index],\n [areaAttribute, area.attribute],\n clipRange,\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n });\n } else {\n // 如果是segments的话,每个clipRange需要重新计算\n // 整个线段的总长度\n const totalLength = area.cacheArea.reduce((l, c) => l + c.top.getLength(), 0);\n // 总需要绘制的长度\n const totalDrawLength = clipRange * totalLength;\n // 直到上次绘制的长度\n let drawedLengthUntilLast = 0;\n let skip = false;\n area.cacheArea.forEach((cache, index) => {\n if (skip) {\n return;\n }\n const curSegLength = cache.top.getLength();\n const _cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;\n drawedLengthUntilLast += curSegLength;\n if (_cr > 0) {\n skip = this.drawSegmentItem(\n context,\n cache,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n segments[index],\n [areaAttribute, area.attribute],\n min(_cr, 1),\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n }\n } else {\n this.drawSegmentItem(\n context,\n area.cacheArea as IAreaCacheItem,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n area.attribute,\n areaAttribute,\n clipRange,\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n }\n\n draw(area: IArea, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const areaAttribute = getTheme(area, params?.theme).area;\n this._draw(area, areaAttribute, false, drawContext, params);\n }\n\n /**\n * 绘制segment\n * @param context\n * @param cache\n * @param fill\n * @param stroke\n * @param attribute\n * @param defaultAttribute\n * @param clipRange\n * @param offsetX\n * @param offsetY\n * @param fillCb\n * @param strokeCb\n * @returns 返回true代表跳过后续绘制\n */\n protected drawSegmentItem(\n context: IContext2d,\n cache: IAreaCacheItem,\n fill: boolean,\n fillOpacity: number,\n stroke: boolean,\n strokeOpacity: number,\n attribute: Partial<IAreaGraphicAttribute>,\n defaultAttribute: Required<IAreaGraphicAttribute> | Partial<IAreaGraphicAttribute>[],\n clipRange: number,\n offsetX: number,\n offsetY: number,\n offsetZ: number,\n area: IArea,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean\n ): boolean {\n let ret = false;\n ret =\n ret ||\n this._drawSegmentItem(\n context,\n cache,\n fill,\n fillOpacity,\n stroke,\n strokeOpacity,\n attribute,\n defaultAttribute,\n clipRange,\n offsetX,\n offsetY,\n offsetZ,\n area,\n drawContext,\n false,\n fillCb,\n strokeCb\n );\n ret =\n ret ||\n this._drawSegmentItem(\n context,\n cache,\n fill,\n fillOpacity,\n stroke,\n strokeOpacity,\n attribute,\n defaultAttribute,\n clipRange,\n offsetX,\n offsetY,\n offsetZ,\n area,\n drawContext,\n true,\n fillCb,\n strokeCb\n );\n return ret;\n }\n\n protected _drawSegmentItem(\n context: IContext2d,\n cache: IAreaCacheItem,\n fill: boolean,\n fillOpacity: number,\n stroke: boolean,\n strokeOpacity: number,\n attribute: Partial<IAreaGraphicAttribute>,\n defaultAttribute: Required<IAreaGraphicAttribute> | Partial<IAreaGraphicAttribute>[],\n clipRange: number,\n offsetX: number,\n offsetY: number,\n offsetZ: number,\n area: IArea,\n drawContext: IDrawContext,\n connect: boolean,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean\n ) {\n // 绘制connect区域\n let { connectedType, connectedX, connectedY, connectedStyle } = attribute;\n const da = [];\n if (connect) {\n if (isArray(defaultAttribute)) {\n connectedType = connectedType ?? defaultAttribute[0].connectedType ?? defaultAttribute[1].connectedType;\n connectedX = connectedX ?? defaultAttribute[0].connectedX ?? defaultAttribute[1].connectedX;\n connectedY = connectedY ?? defaultAttribute[0].connectedY ?? defaultAttribute[1].connectedY;\n connectedStyle = connectedStyle ?? defaultAttribute[0].connectedStyle ?? defaultAttribute[1].connectedStyle;\n } else {\n connectedType = connectedType ?? defaultAttribute.connectedType;\n connectedX = connectedX ?? defaultAttribute.connectedX;\n connectedY = connectedY ?? defaultAttribute.connectedY;\n connectedStyle = connectedStyle ?? defaultAttribute.connectedStyle;\n }\n\n // 如果有非法值就是none\n if (connectedType !== 'connect' && connectedType !== 'zero') {\n connectedType = 'none';\n }\n\n if (isArray(defaultAttribute)) {\n defaultAttribute.forEach(i => da.push(i));\n } else {\n da.push(defaultAttribute);\n }\n da.push(attribute);\n }\n\n if (connect && connectedType === 'none') {\n return false;\n }\n\n if (!cache) {\n return;\n }\n context.beginPath();\n\n const ret: boolean = false;\n const { points, segments } = area.attribute;\n let direction = Direction.ROW;\n let endP: IPointLike;\n let startP: IPointLike;\n if (segments) {\n const endSeg = segments[segments.length - 1];\n const startSeg = segments[0];\n startP = startSeg.points[0];\n endP = endSeg.points[endSeg.points.length - 1];\n } else {\n startP = points[0];\n endP = points[points.length - 1];\n }\n const xTotalLength = abs(endP.x - startP.x);\n const yTotalLength = abs(endP.y - startP.y);\n direction = xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN;\n drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {\n offsetX,\n offsetY,\n offsetZ,\n direction,\n drawConnect: connect,\n mode: connectedType,\n zeroX: connectedX,\n zeroY: connectedY\n });\n\n this.beforeRenderStep(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n defaultAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute }\n );\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);\n\n const { x: originX = 0, x: originY = 0 } = attribute;\n if (fill !== false) {\n if (fillCb) {\n fillCb(context, attribute, defaultAttribute);\n } else if (fillOpacity) {\n context.setCommonStyle(\n area,\n connect ? connectedStyle : attribute,\n originX - offsetX,\n originY - offsetY,\n connect ? da : defaultAttribute\n );\n context.fill();\n }\n }\n\n this.afterRenderStep(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n defaultAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute }\n );\n\n if (stroke !== false) {\n if (strokeCb) {\n strokeCb(context, attribute, defaultAttribute);\n } else {\n const { stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke } = attribute;\n if (isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {\n context.beginPath();\n drawSegments(\n context.camera ? context : context.nativeContext,\n stroke[0] ? cache.top : cache.bottom,\n clipRange,\n direction === Direction.ROW ? 'x' : 'y',\n {\n offsetX,\n offsetY,\n offsetZ,\n drawConnect: connect,\n mode: connectedType,\n zeroX: connectedX,\n zeroY: connectedY\n }\n );\n }\n context.setStrokeStyle(\n area,\n connect ? connectedStyle : attribute,\n originX - offsetX,\n originY - offsetY,\n connect ? da : defaultAttribute\n );\n context.stroke();\n }\n }\n\n return ret;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-core",
3
- "version": "0.18.0-alpha.1",
3
+ "version": "0.18.0-alpha.3",
4
4
  "description": "",
5
5
  "sideEffects": [
6
6
  "./src/modules.ts",