@visactor/vrender-components 0.17.11-alpha.1 → 0.17.11-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.
- package/cjs/data-zoom/data-zoom.d.ts +5 -1
- package/cjs/data-zoom/data-zoom.js +141 -89
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/marker/area.js +5 -1
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +1 -0
- package/cjs/marker/base.js +6 -3
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/line.js +7 -1
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.js +2 -1
- package/cjs/marker/point.js.map +1 -1
- package/dist/index.js +192 -95
- package/dist/index.min.js +1 -1
- package/es/data-zoom/data-zoom.d.ts +5 -1
- package/es/data-zoom/data-zoom.js +127 -70
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/marker/area.js +6 -2
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +1 -0
- package/es/marker/base.js +6 -3
- package/es/marker/base.js.map +1 -1
- package/es/marker/line.js +8 -2
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.js +3 -2
- package/es/marker/point.js.map +1 -1
- package/package.json +3 -3
package/cjs/marker/point.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/point.ts"],"names":[],"mappings":";;;AAYA,yDAAwD;AAGxD,6CAAyC;AACzC,wCAAqC;AAErC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAuF;AAGvF,iCAAgD;AAGhD,yCAAoD;AAEpD,IAAA,iCAAsB,GAAE,CAAC;AACzB,MAAa,SAAU,SAAQ,aAAsB;IAUnD,YAAY,UAA0B,EAAE,OAA0B;QA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,CAAC;QACrF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AA5QH,8BA6QC;AA3QQ,2BAAiB,GAAG,iCAAwB,CAAC","file":"point.js","sourcesContent":["import type {\n IGroup,\n IImage,\n INode,\n ISymbol,\n IImageGraphicAttribute,\n IRichText,\n IRichTextGraphicAttribute,\n ILine,\n ILineGraphicAttribute\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { merge } from '@visactor/vutils';\nimport { Segment } from '../segment';\nimport type { TagAttributes } from '../tag';\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_POINT_TEXT_STYLE_MAP, DEFAULT_MARK_POINT_THEME } from './config';\nimport type { IItemContent, IItemLine, MarkPointAttrs } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkPointItemPosition } from './type';\nimport type { Point } from '../core/type';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkPointComponent } from './register';\n\nloadMarkPointComponent();\nexport class MarkPoint extends Marker<MarkPointAttrs> {\n name = 'markPoint';\n static defaultAttributes = DEFAULT_MARK_POINT_THEME;\n\n private _item!: ISymbol | Tag | IImage | IRichText;\n\n private _line?: Segment;\n\n private _decorativeLine!: ILine;\n\n constructor(attributes: MarkPointAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkPoint.defaultAttributes, attributes));\n }\n\n protected setLabelPos() {\n //do nothing\n }\n\n protected setItemAttributes(\n item: ISymbol | Tag | IImage | IRichText,\n itemContent: IItemContent,\n itemPosition: Point,\n itemType: 'symbol' | 'text' | 'image' | 'richText' | 'custom'\n ) {\n if (!item) {\n return;\n }\n const {\n autoRotate = true,\n refX = 0,\n refY = 0,\n refAngle = 0,\n textStyle = {},\n richTextStyle = {},\n imageStyle = {},\n position = IMarkPointItemPosition.middle\n } = itemContent;\n const itemAngle = this._line?.getEndAngle() || 0;\n const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);\n const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);\n if (itemType === 'text') {\n item.setAttributes({\n ...(textStyle as TagAttributes),\n textStyle: {\n ...DEFAULT_MARK_POINT_TEXT_STYLE_MAP[itemContent?.position || 'end'],\n ...textStyle.textStyle\n }\n });\n } else if (itemType === 'richText') {\n item.setAttributes({\n dx: this.getItemDx(item, position, richTextStyle) + (richTextStyle.dx || 0),\n dy: this.getItemDy(item, position, richTextStyle) + (richTextStyle.dy || 0)\n });\n } else if (itemType === 'image') {\n item.setAttributes({\n dx: this.getItemDx(item, position, imageStyle) + (imageStyle.dx || 0),\n dy: this.getItemDy(item, position, imageStyle) + (imageStyle.dy || 0)\n });\n }\n item.setAttributes({\n x: itemPosition.x + (itemOffsetX || 0),\n y: itemPosition.y + (itemOffsetY || 0),\n angle: autoRotate && itemAngle + refAngle\n });\n\n // if (this.attribute.limitRect && this.attribute.itemContent?.confine) {\n // const { x, y, width, height } = this.attribute.limitRect;\n // limitShapeInBounds(item, {\n // x1: x,\n // y1: y,\n // x2: x + width,\n // y2: y + height\n // });\n // }\n }\n\n protected getItemDx(\n item: ISymbol | Tag | IImage | IRichText,\n position: keyof typeof IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const width = (item as IGroup)?.AABBBounds?.width() ?? (style?.width || 0);\n if (position.includes('inside')) {\n return -width;\n }\n if (position === 'insideTop') {\n return 0;\n }\n return 0;\n }\n\n protected getItemDy(\n item: ISymbol | Tag | IImage | IRichText,\n position: keyof typeof IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const height = (item as IGroup)?.AABBBounds?.height() ?? (style?.height || 0);\n if (position.includes('top') || position.includes('Top')) {\n return -height;\n }\n if (position.includes('middle') || position.includes('Middle')) {\n return -height / 2;\n }\n return 0;\n }\n\n protected initItem(itemContent: IItemContent, itemPosition: Point) {\n const { type = 'text', symbolStyle, richTextStyle, imageStyle, renderCustomCallback } = itemContent;\n let item: ISymbol | Tag | IImage | IRichText | IGroup;\n if (type === 'symbol') {\n item = graphicCreator.symbol({\n ...itemPosition,\n ...symbolStyle\n });\n } else if (type === 'text') {\n item = new Tag({\n ...itemPosition\n });\n } else if (type === 'richText') {\n item = graphicCreator.richtext({\n ...itemPosition,\n ...richTextStyle\n });\n } else if (type === 'image') {\n item = graphicCreator.image({\n ...itemPosition,\n ...imageStyle\n });\n } else if (type === 'custom' && renderCustomCallback) {\n item = renderCustomCallback();\n }\n this.setItemAttributes(item, itemContent, itemPosition, type);\n return item;\n }\n\n protected getItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point) {\n let points: Point[] = [];\n const { type = 'type-s' } = itemLine;\n if (type === 'type-do') {\n points = [\n position,\n {\n x: (position.x + itemPosition.x) / 2,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else if (type === 'type-po') {\n points = [\n position,\n {\n x: itemPosition.x,\n y: position.y\n },\n itemPosition\n ];\n } else if (type === 'type-op') {\n points = [\n position,\n {\n x: position.x,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else {\n points = [position, itemPosition];\n }\n return points;\n }\n\n protected setItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point, visible: boolean) {\n if (this._line) {\n const { startSymbol, endSymbol, lineStyle } = itemLine;\n const points = this.getItemLineAttr(itemLine, position, itemPosition);\n this._line.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n visible\n });\n }\n }\n\n protected getDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point) {\n const decorativeLength = itemLine?.decorativeLine?.length || 10;\n const itemAngle = this._line.getEndAngle() || 0;\n const startPointOffsetX = (decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const startPointOffsetY = (decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n const endPointOffsetX = (-decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const endPointOffsetY = (-decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n return {\n startPointOffsetX,\n startPointOffsetY,\n endPointOffsetX,\n endPointOffsetY\n };\n }\n\n protected setDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point, visible: boolean) {\n if (this._decorativeLine) {\n const { lineStyle } = itemLine;\n const { startPointOffsetX, startPointOffsetY, endPointOffsetX, endPointOffsetY } = this.getDecorativeLineAttr(\n itemLine,\n itemPosition\n );\n this._decorativeLine.setAttributes({\n points: [\n {\n x: itemPosition.x + startPointOffsetX,\n y: itemPosition.y + startPointOffsetY\n },\n {\n x: itemPosition.x + endPointOffsetX,\n y: itemPosition.y + endPointOffsetY\n }\n ] as IPointLike[],\n ...(lineStyle as Partial<ILineGraphicAttribute>),\n visible\n });\n }\n }\n\n protected initMarker(container: IGroup) {\n const { position, itemLine = {}, itemContent = {} } = this.attribute as MarkPointAttrs;\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n\n const line = new Segment({\n points: [],\n pickable: false // 组件容器本身不参与拾取\n });\n line.name = 'mark-point-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const decorativeLine = graphicCreator.line({\n points: []\n });\n decorativeLine.name = 'mark-point-decorativeLine';\n this._decorativeLine = decorativeLine;\n container.add(decorativeLine as unknown as INode);\n\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine.decorativeLine?.visible);\n\n const item = this.initItem(itemContent as any, itemPosition);\n this._item = item;\n container.add(item as unknown as INode);\n }\n\n protected updateMarker() {\n const { position, itemLine = {}, itemContent = {} } = this.attribute as MarkPointAttrs;\n const { type = 'text' } = itemContent;\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine.decorativeLine?.visible);\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n }\n\n protected isValidPoints() {\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/point.ts"],"names":[],"mappings":";;;AAYA,yDAAwD;AAGxD,6CAAwD;AACxD,wCAAqC;AAErC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAuF;AAGvF,iCAAgD;AAGhD,yCAAoD;AAEpD,IAAA,iCAAsB,GAAE,CAAC;AACzB,MAAa,SAAU,SAAQ,aAAsB;IAUnD,YAAY,UAA0B,EAAE,OAA0B;QAChE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAVhG,SAAI,GAAG,WAAW,CAAC;IAWnB,CAAC;IAES,WAAW;IAErB,CAAC;IAES,iBAAiB,CACzB,IAAwC,EACxC,WAAyB,EACzB,YAAmB,EACnB,QAA6D;;QAE7D,IAAI,CAAC,IAAI,EAAE;YACT,OAAO;SACR;QACD,MAAM,EACJ,UAAU,GAAG,IAAI,EACjB,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,CAAC,EACR,QAAQ,GAAG,CAAC,EACZ,SAAS,GAAG,EAAE,EACd,aAAa,GAAG,EAAE,EAClB,UAAU,GAAG,EAAE,EACf,QAAQ,GAAG,6BAAsB,CAAC,MAAM,EACzC,GAAG,WAAW,CAAC;QAChB,MAAM,SAAS,GAAG,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW,EAAE,KAAI,CAAC,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,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,SAA2B,CAAC;QACvF,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;QACtC,MAAM,YAAY,GAAG;YACnB,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC;YAC1C,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC;SAC3C,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzE,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAA,QAAQ,CAAC,cAAc,0CAAE,OAAO,CAAC,CAAC;QACrF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;IAES,aAAa;QACrB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,SAA2B,CAAC;QACtD,IAAI,IAAA,sBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAA,sBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;YAC1D,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAhRH,8BAiRC;AA/QQ,2BAAiB,GAAG,iCAAwB,CAAC","file":"point.js","sourcesContent":["import type {\n IGroup,\n IImage,\n INode,\n ISymbol,\n IImageGraphicAttribute,\n IRichText,\n IRichTextGraphicAttribute,\n ILine,\n ILineGraphicAttribute\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isValidNumber, merge } from '@visactor/vutils';\nimport { Segment } from '../segment';\nimport type { TagAttributes } from '../tag';\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_POINT_TEXT_STYLE_MAP, DEFAULT_MARK_POINT_THEME } from './config';\nimport type { IItemContent, IItemLine, MarkPointAttrs } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkPointItemPosition } from './type';\nimport type { Point } from '../core/type';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkPointComponent } from './register';\n\nloadMarkPointComponent();\nexport class MarkPoint extends Marker<MarkPointAttrs> {\n name = 'markPoint';\n static defaultAttributes = DEFAULT_MARK_POINT_THEME;\n\n private _item!: ISymbol | Tag | IImage | IRichText;\n\n private _line?: Segment;\n\n private _decorativeLine!: ILine;\n\n constructor(attributes: MarkPointAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkPoint.defaultAttributes, attributes));\n }\n\n protected setLabelPos() {\n //do nothing\n }\n\n protected setItemAttributes(\n item: ISymbol | Tag | IImage | IRichText,\n itemContent: IItemContent,\n itemPosition: Point,\n itemType: 'symbol' | 'text' | 'image' | 'richText' | 'custom'\n ) {\n if (!item) {\n return;\n }\n const {\n autoRotate = true,\n refX = 0,\n refY = 0,\n refAngle = 0,\n textStyle = {},\n richTextStyle = {},\n imageStyle = {},\n position = IMarkPointItemPosition.middle\n } = itemContent;\n const itemAngle = this._line?.getEndAngle() || 0;\n const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);\n const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);\n if (itemType === 'text') {\n item.setAttributes({\n ...(textStyle as TagAttributes),\n textStyle: {\n ...DEFAULT_MARK_POINT_TEXT_STYLE_MAP[itemContent?.position || 'end'],\n ...textStyle.textStyle\n }\n });\n } else if (itemType === 'richText') {\n item.setAttributes({\n dx: this.getItemDx(item, position, richTextStyle) + (richTextStyle.dx || 0),\n dy: this.getItemDy(item, position, richTextStyle) + (richTextStyle.dy || 0)\n });\n } else if (itemType === 'image') {\n item.setAttributes({\n dx: this.getItemDx(item, position, imageStyle) + (imageStyle.dx || 0),\n dy: this.getItemDy(item, position, imageStyle) + (imageStyle.dy || 0)\n });\n }\n item.setAttributes({\n x: itemPosition.x + (itemOffsetX || 0),\n y: itemPosition.y + (itemOffsetY || 0),\n angle: autoRotate && itemAngle + refAngle\n });\n\n // if (this.attribute.limitRect && this.attribute.itemContent?.confine) {\n // const { x, y, width, height } = this.attribute.limitRect;\n // limitShapeInBounds(item, {\n // x1: x,\n // y1: y,\n // x2: x + width,\n // y2: y + height\n // });\n // }\n }\n\n protected getItemDx(\n item: ISymbol | Tag | IImage | IRichText,\n position: keyof typeof IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const width = (item as IGroup)?.AABBBounds?.width() ?? (style?.width || 0);\n if (position.includes('inside')) {\n return -width;\n }\n if (position === 'insideTop') {\n return 0;\n }\n return 0;\n }\n\n protected getItemDy(\n item: ISymbol | Tag | IImage | IRichText,\n position: keyof typeof IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const height = (item as IGroup)?.AABBBounds?.height() ?? (style?.height || 0);\n if (position.includes('top') || position.includes('Top')) {\n return -height;\n }\n if (position.includes('middle') || position.includes('Middle')) {\n return -height / 2;\n }\n return 0;\n }\n\n protected initItem(itemContent: IItemContent, itemPosition: Point) {\n const { type = 'text', symbolStyle, richTextStyle, imageStyle, renderCustomCallback } = itemContent;\n let item: ISymbol | Tag | IImage | IRichText | IGroup;\n if (type === 'symbol') {\n item = graphicCreator.symbol({\n ...itemPosition,\n ...symbolStyle\n });\n } else if (type === 'text') {\n item = new Tag({\n ...itemPosition\n });\n } else if (type === 'richText') {\n item = graphicCreator.richtext({\n ...itemPosition,\n ...richTextStyle\n });\n } else if (type === 'image') {\n item = graphicCreator.image({\n ...itemPosition,\n ...imageStyle\n });\n } else if (type === 'custom' && renderCustomCallback) {\n item = renderCustomCallback();\n }\n this.setItemAttributes(item, itemContent, itemPosition, type);\n return item;\n }\n\n protected getItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point) {\n let points: Point[] = [];\n const { type = 'type-s' } = itemLine;\n if (type === 'type-do') {\n points = [\n position,\n {\n x: (position.x + itemPosition.x) / 2,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else if (type === 'type-po') {\n points = [\n position,\n {\n x: itemPosition.x,\n y: position.y\n },\n itemPosition\n ];\n } else if (type === 'type-op') {\n points = [\n position,\n {\n x: position.x,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else {\n points = [position, itemPosition];\n }\n return points;\n }\n\n protected setItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point, visible: boolean) {\n if (this._line) {\n const { startSymbol, endSymbol, lineStyle } = itemLine;\n const points = this.getItemLineAttr(itemLine, position, itemPosition);\n this._line.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n visible\n });\n }\n }\n\n protected getDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point) {\n const decorativeLength = itemLine?.decorativeLine?.length || 10;\n const itemAngle = this._line.getEndAngle() || 0;\n const startPointOffsetX = (decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const startPointOffsetY = (decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n const endPointOffsetX = (-decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const endPointOffsetY = (-decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n return {\n startPointOffsetX,\n startPointOffsetY,\n endPointOffsetX,\n endPointOffsetY\n };\n }\n\n protected setDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point, visible: boolean) {\n if (this._decorativeLine) {\n const { lineStyle } = itemLine;\n const { startPointOffsetX, startPointOffsetY, endPointOffsetX, endPointOffsetY } = this.getDecorativeLineAttr(\n itemLine,\n itemPosition\n );\n this._decorativeLine.setAttributes({\n points: [\n {\n x: itemPosition.x + startPointOffsetX,\n y: itemPosition.y + startPointOffsetY\n },\n {\n x: itemPosition.x + endPointOffsetX,\n y: itemPosition.y + endPointOffsetY\n }\n ] as IPointLike[],\n ...(lineStyle as Partial<ILineGraphicAttribute>),\n visible\n });\n }\n }\n\n protected initMarker(container: IGroup) {\n const { position, itemLine = {}, itemContent = {} } = this.attribute as MarkPointAttrs;\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n\n const line = new Segment({\n points: [],\n pickable: false // 组件容器本身不参与拾取\n });\n line.name = 'mark-point-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const decorativeLine = graphicCreator.line({\n points: []\n });\n decorativeLine.name = 'mark-point-decorativeLine';\n this._decorativeLine = decorativeLine;\n container.add(decorativeLine as unknown as INode);\n\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine.decorativeLine?.visible);\n\n const item = this.initItem(itemContent as any, itemPosition);\n this._item = item;\n container.add(item as unknown as INode);\n }\n\n protected updateMarker() {\n const { position, itemLine = {}, itemContent = {} } = this.attribute as MarkPointAttrs;\n const { type = 'text' } = itemContent;\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine.decorativeLine?.visible);\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n }\n\n protected isValidPoints() {\n const { position } = this.attribute as MarkPointAttrs;\n if (isValidNumber(position.x) && isValidNumber(position.y)) {\n return true;\n }\n return false;\n }\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -8267,12 +8267,10 @@
|
|
|
8267
8267
|
get: function get() {
|
|
8268
8268
|
var textTheme = getTheme(this).text,
|
|
8269
8269
|
attribute = this.attribute;
|
|
8270
|
-
if (this.
|
|
8270
|
+
if (!this.isSimplify()) return;
|
|
8271
8271
|
var _attribute$maxLineWid2 = attribute.maxLineWidth,
|
|
8272
8272
|
maxLineWidth = _attribute$maxLineWid2 === void 0 ? textTheme.maxLineWidth : _attribute$maxLineWid2;
|
|
8273
|
-
return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(),
|
|
8274
|
-
return item.text;
|
|
8275
|
-
}).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString());
|
|
8273
|
+
return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), null != this.clipedText && this.clipedText !== attribute.text.toString());
|
|
8276
8274
|
}
|
|
8277
8275
|
}, {
|
|
8278
8276
|
key: "multilineLayout",
|
|
@@ -24289,6 +24287,23 @@
|
|
|
24289
24287
|
};
|
|
24290
24288
|
loadDataZoomComponent();
|
|
24291
24289
|
class DataZoom extends AbstractComponent {
|
|
24290
|
+
setPropsFromAttrs() {
|
|
24291
|
+
const { start, end, orient, previewData, previewPointsX, previewPointsY, previewPointsX1, previewPointsY1 } = this
|
|
24292
|
+
.attribute;
|
|
24293
|
+
start && (this.state.start = start);
|
|
24294
|
+
end && (this.state.end = end);
|
|
24295
|
+
const { width, height } = this.getLayoutAttrFromConfig();
|
|
24296
|
+
this._spanCache = this.state.end - this.state.start;
|
|
24297
|
+
this._isHorizontal = orient === 'top' || orient === 'bottom';
|
|
24298
|
+
this._layoutCache.max = this._isHorizontal ? width : height;
|
|
24299
|
+
this._layoutCache.attPos = this._isHorizontal ? 'x' : 'y';
|
|
24300
|
+
this._layoutCache.attSize = this._isHorizontal ? 'width' : 'height';
|
|
24301
|
+
previewData && (this._previewData = previewData);
|
|
24302
|
+
vutils.isFunction(previewPointsX) && (this._previewPointsX = previewPointsX);
|
|
24303
|
+
vutils.isFunction(previewPointsY) && (this._previewPointsY = previewPointsY);
|
|
24304
|
+
vutils.isFunction(previewPointsX1) && (this._previewPointsX1 = previewPointsX1);
|
|
24305
|
+
vutils.isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
|
|
24306
|
+
}
|
|
24292
24307
|
constructor(attributes, options) {
|
|
24293
24308
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, DataZoom.defaultAttributes, attributes));
|
|
24294
24309
|
this.name = 'dataZoom';
|
|
@@ -24384,15 +24399,7 @@
|
|
|
24384
24399
|
});
|
|
24385
24400
|
}
|
|
24386
24401
|
}, this.attribute.delayTime);
|
|
24387
|
-
const {
|
|
24388
|
-
const { width, height } = size;
|
|
24389
|
-
start && (this.state.start = start);
|
|
24390
|
-
end && (this.state.end = end);
|
|
24391
|
-
this._spanCache = this.state.end - this.state.start;
|
|
24392
|
-
this._isHorizontal = orient === 'top' || orient === 'bottom';
|
|
24393
|
-
this._layoutCache.max = this._isHorizontal ? width : height;
|
|
24394
|
-
this._layoutCache.attPos = this._isHorizontal ? 'x' : 'y';
|
|
24395
|
-
this._layoutCache.attSize = this._isHorizontal ? 'width' : 'height';
|
|
24402
|
+
const { position, showDetail } = attributes;
|
|
24396
24403
|
this._activeCache.startPos = position;
|
|
24397
24404
|
this._activeCache.lastPos = position;
|
|
24398
24405
|
if (showDetail === 'auto') {
|
|
@@ -24401,11 +24408,11 @@
|
|
|
24401
24408
|
else {
|
|
24402
24409
|
this._showText = showDetail;
|
|
24403
24410
|
}
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
24408
|
-
|
|
24411
|
+
this.setPropsFromAttrs();
|
|
24412
|
+
}
|
|
24413
|
+
setAttributes(params, forceUpdateTag) {
|
|
24414
|
+
super.setAttributes(params, forceUpdateTag);
|
|
24415
|
+
this.setPropsFromAttrs();
|
|
24409
24416
|
}
|
|
24410
24417
|
bindEvents() {
|
|
24411
24418
|
if (this.attribute.disableTriggerEvent) {
|
|
@@ -24553,66 +24560,126 @@
|
|
|
24553
24560
|
0 }, dragMaskStyle), 'rect');
|
|
24554
24561
|
}
|
|
24555
24562
|
}
|
|
24563
|
+
isTextOverflow(componentBoundsLike, textPosition, textMeasure, textValue, layout) {
|
|
24564
|
+
const { width: textWidth, height: textHeight } = textMeasure.fullMeasure(textValue);
|
|
24565
|
+
if (this._isHorizontal) {
|
|
24566
|
+
if (layout === 'start') {
|
|
24567
|
+
const x1 = textPosition.x - textWidth;
|
|
24568
|
+
if (x1 < componentBoundsLike.x1) {
|
|
24569
|
+
return true;
|
|
24570
|
+
}
|
|
24571
|
+
}
|
|
24572
|
+
else {
|
|
24573
|
+
const x2 = textPosition.x + textWidth;
|
|
24574
|
+
if (x2 > componentBoundsLike.x2) {
|
|
24575
|
+
return true;
|
|
24576
|
+
}
|
|
24577
|
+
}
|
|
24578
|
+
}
|
|
24579
|
+
else {
|
|
24580
|
+
if (layout === 'start') {
|
|
24581
|
+
const y1 = textPosition.y - textHeight;
|
|
24582
|
+
if (y1 < componentBoundsLike.y1) {
|
|
24583
|
+
return true;
|
|
24584
|
+
}
|
|
24585
|
+
}
|
|
24586
|
+
else {
|
|
24587
|
+
const y2 = textPosition.y + textHeight;
|
|
24588
|
+
if (y2 > componentBoundsLike.y2) {
|
|
24589
|
+
return true;
|
|
24590
|
+
}
|
|
24591
|
+
}
|
|
24592
|
+
}
|
|
24593
|
+
return false;
|
|
24594
|
+
}
|
|
24556
24595
|
renderText() {
|
|
24557
24596
|
const { startTextStyle, endTextStyle } = this.attribute;
|
|
24558
|
-
const { formatMethod: startTextFormat } = startTextStyle,
|
|
24597
|
+
const { formatMethod: startTextFormat } = startTextStyle, restStartTextStyle = __rest(startTextStyle, ["formatMethod"]);
|
|
24559
24598
|
const { formatMethod: endTextFormat } = endTextStyle, restEndTextStyle = __rest(endTextStyle, ["formatMethod"]);
|
|
24560
24599
|
const { start, end } = this.state;
|
|
24561
24600
|
this._startValue = this._statePointToData(start);
|
|
24562
24601
|
this._endValue = this._statePointToData(end);
|
|
24563
24602
|
const { position, width, height } = this.getLayoutAttrFromConfig();
|
|
24603
|
+
const startTextValue = startTextFormat ? startTextFormat(this._startValue) : this._startValue;
|
|
24604
|
+
const endTextValue = endTextFormat ? endTextFormat(this._endValue) : this._endValue;
|
|
24605
|
+
const startTextMeasure = new vutils.TextMeasure({
|
|
24606
|
+
defaultFontParams: restStartTextStyle.textStyle
|
|
24607
|
+
});
|
|
24608
|
+
const endTextMeasure = new vutils.TextMeasure({
|
|
24609
|
+
defaultFontParams: restEndTextStyle.textStyle
|
|
24610
|
+
});
|
|
24611
|
+
const componentBoundsLike = {
|
|
24612
|
+
x1: position.x,
|
|
24613
|
+
y1: position.y,
|
|
24614
|
+
x2: position.x + width,
|
|
24615
|
+
y2: position.y + height
|
|
24616
|
+
};
|
|
24617
|
+
let startTextPosition;
|
|
24618
|
+
let endTextPosition;
|
|
24619
|
+
let startTextAlignStyle;
|
|
24620
|
+
let endTextAlignStyle;
|
|
24564
24621
|
if (this._isHorizontal) {
|
|
24565
|
-
|
|
24566
|
-
text: startTextFormat ? startTextFormat(this._startValue) : this._startValue,
|
|
24622
|
+
startTextPosition = {
|
|
24567
24623
|
x: position.x + start * width,
|
|
24568
|
-
y: position.y + height / 2
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
childrenPickable: false,
|
|
24572
|
-
textStyle: {
|
|
24573
|
-
textAlign: 'right',
|
|
24574
|
-
textBaseline: 'middle'
|
|
24575
|
-
}
|
|
24576
|
-
}), `data-zoom-start-text-${position}`);
|
|
24577
|
-
this._endText = this.maybeAddLabel(this._container, vutils.merge({}, restEndTextStyle, {
|
|
24578
|
-
text: endTextFormat ? endTextFormat(this._endValue) : this._endValue,
|
|
24624
|
+
y: position.y + height / 2
|
|
24625
|
+
};
|
|
24626
|
+
endTextPosition = {
|
|
24579
24627
|
x: position.x + end * width,
|
|
24580
|
-
y: position.y + height / 2
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
|
|
24584
|
-
|
|
24585
|
-
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24628
|
+
y: position.y + height / 2
|
|
24629
|
+
};
|
|
24630
|
+
startTextAlignStyle = {
|
|
24631
|
+
textAlign: this.isTextOverflow(componentBoundsLike, startTextPosition, startTextMeasure, startTextValue, 'start')
|
|
24632
|
+
? 'left'
|
|
24633
|
+
: 'right',
|
|
24634
|
+
textBaseline: 'middle'
|
|
24635
|
+
};
|
|
24636
|
+
endTextAlignStyle = {
|
|
24637
|
+
textAlign: this.isTextOverflow(componentBoundsLike, endTextPosition, endTextMeasure, endTextValue, 'end')
|
|
24638
|
+
? 'right'
|
|
24639
|
+
: 'left',
|
|
24640
|
+
textBaseline: 'middle'
|
|
24641
|
+
};
|
|
24589
24642
|
}
|
|
24590
24643
|
else {
|
|
24591
|
-
|
|
24592
|
-
text: startTextFormat ? startTextFormat(this._startValue) : this._startValue,
|
|
24644
|
+
startTextPosition = {
|
|
24593
24645
|
x: position.x + width / 2,
|
|
24594
|
-
y: position.y + start * height
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
childrenPickable: false,
|
|
24598
|
-
textStyle: {
|
|
24599
|
-
textAlign: 'center',
|
|
24600
|
-
textBaseline: 'bottom'
|
|
24601
|
-
}
|
|
24602
|
-
}), `data-zoom-start-text-${position}`);
|
|
24603
|
-
this._endText = this.maybeAddLabel(this._container, vutils.merge({}, restEndTextStyle, {
|
|
24604
|
-
text: endTextFormat ? endTextFormat(this._endValue) : this._endValue,
|
|
24646
|
+
y: position.y + start * height
|
|
24647
|
+
};
|
|
24648
|
+
endTextPosition = {
|
|
24605
24649
|
x: position.x + width / 2,
|
|
24606
|
-
y: position.y + end * height
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24650
|
+
y: position.y + end * height
|
|
24651
|
+
};
|
|
24652
|
+
startTextAlignStyle = {
|
|
24653
|
+
textAlign: 'center',
|
|
24654
|
+
textBaseline: this.isTextOverflow(componentBoundsLike, startTextPosition, startTextMeasure, startTextValue, 'start')
|
|
24655
|
+
? 'top'
|
|
24656
|
+
: 'bottom'
|
|
24657
|
+
};
|
|
24658
|
+
endTextAlignStyle = {
|
|
24659
|
+
textAlign: 'center',
|
|
24660
|
+
textBaseline: this.isTextOverflow(componentBoundsLike, endTextPosition, endTextMeasure, endTextValue, 'end')
|
|
24661
|
+
? 'bottom'
|
|
24662
|
+
: 'top'
|
|
24663
|
+
};
|
|
24615
24664
|
}
|
|
24665
|
+
this._startText = this.maybeAddLabel(this._container, vutils.merge({}, restStartTextStyle, {
|
|
24666
|
+
text: startTextValue,
|
|
24667
|
+
x: startTextPosition.x,
|
|
24668
|
+
y: startTextPosition.y,
|
|
24669
|
+
visible: this._showText,
|
|
24670
|
+
pickable: false,
|
|
24671
|
+
childrenPickable: false,
|
|
24672
|
+
textStyle: startTextAlignStyle
|
|
24673
|
+
}), `data-zoom-start-text-${position}`);
|
|
24674
|
+
this._endText = this.maybeAddLabel(this._container, vutils.merge({}, restEndTextStyle, {
|
|
24675
|
+
text: endTextValue,
|
|
24676
|
+
x: endTextPosition.x,
|
|
24677
|
+
y: endTextPosition.y,
|
|
24678
|
+
visible: this._showText,
|
|
24679
|
+
pickable: false,
|
|
24680
|
+
childrenPickable: false,
|
|
24681
|
+
textStyle: endTextAlignStyle
|
|
24682
|
+
}), `data-zoom-end-text-${position}`);
|
|
24616
24683
|
}
|
|
24617
24684
|
getLayoutAttrFromConfig() {
|
|
24618
24685
|
var _a, _b, _c, _d;
|
|
@@ -24676,23 +24743,23 @@
|
|
|
24676
24743
|
render() {
|
|
24677
24744
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
24678
24745
|
this._layoutAttrFromConfig = null;
|
|
24679
|
-
const { orient, backgroundStyle, backgroundChartStyle = {}, selectedBackgroundStyle = {}, selectedBackgroundChartStyle = {}, middleHandlerStyle = {}, startHandlerStyle = {}, endHandlerStyle = {}, brushSelect } = this.attribute;
|
|
24746
|
+
const { orient, backgroundStyle, backgroundChartStyle = {}, selectedBackgroundStyle = {}, selectedBackgroundChartStyle = {}, middleHandlerStyle = {}, startHandlerStyle = {}, endHandlerStyle = {}, brushSelect, zoomLock } = this.attribute;
|
|
24680
24747
|
const { start, end } = this.state;
|
|
24681
24748
|
const { position, width, height } = this.getLayoutAttrFromConfig();
|
|
24682
24749
|
const startHandlerMinSize = (_a = startHandlerStyle.triggerMinSize) !== null && _a !== void 0 ? _a : 40;
|
|
24683
24750
|
const endHandlerMinSize = (_b = endHandlerStyle.triggerMinSize) !== null && _b !== void 0 ? _b : 40;
|
|
24684
24751
|
const group = this.createOrUpdateChild('dataZoom-container', {}, 'group');
|
|
24685
24752
|
this._container = group;
|
|
24686
|
-
this._background = group.createOrUpdateChild('background', Object.assign({ x: position.x, y: position.y, width,
|
|
24687
|
-
height, cursor: brushSelect ? 'crosshair' : 'auto' }, backgroundStyle), 'rect');
|
|
24753
|
+
this._background = group.createOrUpdateChild('background', Object.assign(Object.assign({ x: position.x, y: position.y, width,
|
|
24754
|
+
height, cursor: brushSelect ? 'crosshair' : 'auto' }, backgroundStyle), { pickable: !zoomLock }), 'rect');
|
|
24688
24755
|
((_c = backgroundChartStyle.line) === null || _c === void 0 ? void 0 : _c.visible) && this.setPreviewAttributes('line', group);
|
|
24689
24756
|
((_d = backgroundChartStyle.area) === null || _d === void 0 ? void 0 : _d.visible) && this.setPreviewAttributes('area', group);
|
|
24690
24757
|
brushSelect && this.renderDragMask();
|
|
24691
24758
|
if (this._isHorizontal) {
|
|
24692
|
-
this._selectedBackground = group.createOrUpdateChild('selectedBackground', Object.assign({ x: position.x + start * width, y: position.y, width: (end - start) * width, height: height, cursor: brushSelect ? 'crosshair' : 'move' }, selectedBackgroundStyle), 'rect');
|
|
24759
|
+
this._selectedBackground = group.createOrUpdateChild('selectedBackground', Object.assign(Object.assign({ x: position.x + start * width, y: position.y, width: (end - start) * width, height: height, cursor: brushSelect ? 'crosshair' : 'move' }, selectedBackgroundStyle), { pickable: !zoomLock }), 'rect');
|
|
24693
24760
|
}
|
|
24694
24761
|
else {
|
|
24695
|
-
this._selectedBackground = group.createOrUpdateChild('selectedBackground', Object.assign({ x: position.x, y: position.y + start * height, width, height: (end - start) * height, cursor: brushSelect ? 'crosshair' : 'move' }, selectedBackgroundStyle), 'rect');
|
|
24762
|
+
this._selectedBackground = group.createOrUpdateChild('selectedBackground', Object.assign(Object.assign({ x: position.x, y: position.y + start * height, width, height: (end - start) * height, cursor: brushSelect ? 'crosshair' : 'move' }, selectedBackgroundStyle), { pickable: !zoomLock }), 'rect');
|
|
24696
24763
|
}
|
|
24697
24764
|
((_e = selectedBackgroundChartStyle.line) === null || _e === void 0 ? void 0 : _e.visible) && this.setSelectedPreviewAttributes('line', group);
|
|
24698
24765
|
((_f = selectedBackgroundChartStyle.area) === null || _f === void 0 ? void 0 : _f.visible) && this.setSelectedPreviewAttributes('area', group);
|
|
@@ -24702,34 +24769,34 @@
|
|
|
24702
24769
|
if (this._isHorizontal) {
|
|
24703
24770
|
if (middleHandlerStyle.visible) {
|
|
24704
24771
|
const middleHandlerBackgroundSize = ((_g = middleHandlerStyle.background) === null || _g === void 0 ? void 0 : _g.size) || 10;
|
|
24705
|
-
this._middleHandlerRect = group.createOrUpdateChild('middleHandlerRect', Object.assign({ x: position.x + start * width, y: position.y - middleHandlerBackgroundSize, width: (end - start) * width, height: middleHandlerBackgroundSize }, (_h = middleHandlerStyle.background) === null || _h === void 0 ? void 0 : _h.style), 'rect');
|
|
24706
|
-
this._middleHandlerSymbol = group.createOrUpdateChild('middleHandlerSymbol', Object.assign({ x: position.x + ((start + end) / 2) * width, y: position.y - middleHandlerBackgroundSize / 2, strokeBoundsBuffer: 0, angle: 0, symbolType: (_k = (_j = middleHandlerStyle.icon) === null || _j === void 0 ? void 0 : _j.symbolType) !== null && _k !== void 0 ? _k : 'square' }, middleHandlerStyle.icon), 'symbol');
|
|
24772
|
+
this._middleHandlerRect = group.createOrUpdateChild('middleHandlerRect', Object.assign(Object.assign({ x: position.x + start * width, y: position.y - middleHandlerBackgroundSize, width: (end - start) * width, height: middleHandlerBackgroundSize }, (_h = middleHandlerStyle.background) === null || _h === void 0 ? void 0 : _h.style), { pickable: !zoomLock }), 'rect');
|
|
24773
|
+
this._middleHandlerSymbol = group.createOrUpdateChild('middleHandlerSymbol', Object.assign(Object.assign({ x: position.x + ((start + end) / 2) * width, y: position.y - middleHandlerBackgroundSize / 2, strokeBoundsBuffer: 0, angle: 0, symbolType: (_k = (_j = middleHandlerStyle.icon) === null || _j === void 0 ? void 0 : _j.symbolType) !== null && _k !== void 0 ? _k : 'square' }, middleHandlerStyle.icon), { pickable: !zoomLock }), 'symbol');
|
|
24707
24774
|
}
|
|
24708
|
-
this._startHandler = group.createOrUpdateChild('startHandler', Object.assign(Object.assign({ x: position.x + start * width, y: position.y + height / 2, size: height, symbolType: (_l = startHandlerStyle.symbolType) !== null && _l !== void 0 ? _l : 'square' }, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), 'symbol');
|
|
24709
|
-
this._endHandler = group.createOrUpdateChild('endHandler', Object.assign(Object.assign({ x: position.x + end * width, y: position.y + height / 2, size: height, symbolType: (_m = endHandlerStyle.symbolType) !== null && _m !== void 0 ? _m : 'square' }, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), 'symbol');
|
|
24775
|
+
this._startHandler = group.createOrUpdateChild('startHandler', Object.assign(Object.assign(Object.assign({ x: position.x + start * width, y: position.y + height / 2, size: height, symbolType: (_l = startHandlerStyle.symbolType) !== null && _l !== void 0 ? _l : 'square' }, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), { pickable: !zoomLock }), 'symbol');
|
|
24776
|
+
this._endHandler = group.createOrUpdateChild('endHandler', Object.assign(Object.assign(Object.assign({ x: position.x + end * width, y: position.y + height / 2, size: height, symbolType: (_m = endHandlerStyle.symbolType) !== null && _m !== void 0 ? _m : 'square' }, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), { pickable: !zoomLock }), 'symbol');
|
|
24710
24777
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize);
|
|
24711
24778
|
const startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize);
|
|
24712
24779
|
const endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize);
|
|
24713
24780
|
const endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
|
|
24714
|
-
this._startHandlerMask = group.createOrUpdateChild('startHandlerMask', Object.assign({ x: position.x + start * width - startHandlerWidth / 2, y: position.y + height / 2 - startHandlerHeight / 2, width: startHandlerWidth, height: startHandlerHeight, fill: 'white', fillOpacity: 0, zIndex: 999 }, DEFAULT_HANDLER_ATTR_MAP.horizontal), 'rect');
|
|
24715
|
-
this._endHandlerMask = group.createOrUpdateChild('endHandlerMask', Object.assign({ x: position.x + end * width - endHandlerWidth / 2, y: position.y + height / 2 - endHandlerHeight / 2, width: endHandlerWidth, height: endHandlerHeight, fill: 'white', fillOpacity: 0, zIndex: 999 }, DEFAULT_HANDLER_ATTR_MAP.horizontal), 'rect');
|
|
24781
|
+
this._startHandlerMask = group.createOrUpdateChild('startHandlerMask', Object.assign(Object.assign({ x: position.x + start * width - startHandlerWidth / 2, y: position.y + height / 2 - startHandlerHeight / 2, width: startHandlerWidth, height: startHandlerHeight, fill: 'white', fillOpacity: 0, zIndex: 999 }, DEFAULT_HANDLER_ATTR_MAP.horizontal), { pickable: !zoomLock }), 'rect');
|
|
24782
|
+
this._endHandlerMask = group.createOrUpdateChild('endHandlerMask', Object.assign(Object.assign({ x: position.x + end * width - endHandlerWidth / 2, y: position.y + height / 2 - endHandlerHeight / 2, width: endHandlerWidth, height: endHandlerHeight, fill: 'white', fillOpacity: 0, zIndex: 999 }, DEFAULT_HANDLER_ATTR_MAP.horizontal), { pickable: !zoomLock }), 'rect');
|
|
24716
24783
|
}
|
|
24717
24784
|
else {
|
|
24718
24785
|
if (middleHandlerStyle.visible) {
|
|
24719
24786
|
const middleHandlerBackgroundSize = ((_o = middleHandlerStyle.background) === null || _o === void 0 ? void 0 : _o.size) || 10;
|
|
24720
|
-
this._middleHandlerRect = group.createOrUpdateChild('middleHandlerRect', Object.assign({ x: orient === 'left' ? position.x - middleHandlerBackgroundSize : position.x + width, y: position.y + start * height, width: middleHandlerBackgroundSize, height: (end - start) * height }, (_p = middleHandlerStyle.background) === null || _p === void 0 ? void 0 : _p.style), 'rect');
|
|
24721
|
-
this._middleHandlerSymbol = group.createOrUpdateChild('middleHandlerSymbol', Object.assign({ x: orient === 'left'
|
|
24787
|
+
this._middleHandlerRect = group.createOrUpdateChild('middleHandlerRect', Object.assign(Object.assign({ x: orient === 'left' ? position.x - middleHandlerBackgroundSize : position.x + width, y: position.y + start * height, width: middleHandlerBackgroundSize, height: (end - start) * height }, (_p = middleHandlerStyle.background) === null || _p === void 0 ? void 0 : _p.style), { pickable: !zoomLock }), 'rect');
|
|
24788
|
+
this._middleHandlerSymbol = group.createOrUpdateChild('middleHandlerSymbol', Object.assign(Object.assign({ x: orient === 'left'
|
|
24722
24789
|
? position.x - middleHandlerBackgroundSize / 2
|
|
24723
|
-
: position.x + width + middleHandlerBackgroundSize / 2, y: position.y + ((start + end) / 2) * height, angle: 90 * (Math.PI / 180), symbolType: (_r = (_q = middleHandlerStyle.icon) === null || _q === void 0 ? void 0 : _q.symbolType) !== null && _r !== void 0 ? _r : 'square', strokeBoundsBuffer: 0 }, middleHandlerStyle.icon), 'symbol');
|
|
24790
|
+
: position.x + width + middleHandlerBackgroundSize / 2, y: position.y + ((start + end) / 2) * height, angle: 90 * (Math.PI / 180), symbolType: (_r = (_q = middleHandlerStyle.icon) === null || _q === void 0 ? void 0 : _q.symbolType) !== null && _r !== void 0 ? _r : 'square', strokeBoundsBuffer: 0 }, middleHandlerStyle.icon), { pickable: !zoomLock }), 'symbol');
|
|
24724
24791
|
}
|
|
24725
|
-
this._startHandler = group.createOrUpdateChild('startHandler', Object.assign(Object.assign({ x: position.x + width / 2, y: position.y + start * height, size: width, symbolType: (_s = startHandlerStyle.symbolType) !== null && _s !== void 0 ? _s : 'square' }, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), 'symbol');
|
|
24726
|
-
this._endHandler = group.createOrUpdateChild('endHandler', Object.assign(Object.assign({ x: position.x + width / 2, y: position.y + end * height, size: width, symbolType: (_t = endHandlerStyle.symbolType) !== null && _t !== void 0 ? _t : 'square' }, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), 'symbol');
|
|
24792
|
+
this._startHandler = group.createOrUpdateChild('startHandler', Object.assign(Object.assign(Object.assign({ x: position.x + width / 2, y: position.y + start * height, size: width, symbolType: (_s = startHandlerStyle.symbolType) !== null && _s !== void 0 ? _s : 'square' }, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), { pickable: !zoomLock }), 'symbol');
|
|
24793
|
+
this._endHandler = group.createOrUpdateChild('endHandler', Object.assign(Object.assign(Object.assign({ x: position.x + width / 2, y: position.y + end * height, size: width, symbolType: (_t = endHandlerStyle.symbolType) !== null && _t !== void 0 ? _t : 'square' }, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), { pickable: !zoomLock }), 'symbol');
|
|
24727
24794
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize);
|
|
24728
24795
|
const startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize);
|
|
24729
24796
|
const endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize);
|
|
24730
24797
|
const endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
|
|
24731
|
-
this._startHandlerMask = group.createOrUpdateChild('startHandlerMask', Object.assign({ x: position.x + width / 2 + startHandlerWidth / 2, y: position.y + start * height - startHandlerHeight / 2, width: endHandlerHeight, height: endHandlerWidth, fill: 'white', fillOpacity: 0, zIndex: 999 }, DEFAULT_HANDLER_ATTR_MAP.vertical), 'rect');
|
|
24732
|
-
this._endHandlerMask = group.createOrUpdateChild('endHandlerMask', Object.assign({ x: position.x + width / 2 + endHandlerWidth / 2, y: position.y + end * height - endHandlerHeight / 2, width: endHandlerHeight, height: endHandlerWidth, fill: 'white', fillOpacity: 0, zIndex: 999 }, DEFAULT_HANDLER_ATTR_MAP.vertical), 'rect');
|
|
24798
|
+
this._startHandlerMask = group.createOrUpdateChild('startHandlerMask', Object.assign(Object.assign({ x: position.x + width / 2 + startHandlerWidth / 2, y: position.y + start * height - startHandlerHeight / 2, width: endHandlerHeight, height: endHandlerWidth, fill: 'white', fillOpacity: 0, zIndex: 999 }, DEFAULT_HANDLER_ATTR_MAP.vertical), { pickable: !zoomLock }), 'rect');
|
|
24799
|
+
this._endHandlerMask = group.createOrUpdateChild('endHandlerMask', Object.assign(Object.assign({ x: position.x + width / 2 + endHandlerWidth / 2, y: position.y + end * height - endHandlerHeight / 2, width: endHandlerHeight, height: endHandlerWidth, fill: 'white', fillOpacity: 0, zIndex: 999 }, DEFAULT_HANDLER_ATTR_MAP.vertical), { pickable: !zoomLock }), 'rect');
|
|
24733
24800
|
}
|
|
24734
24801
|
}
|
|
24735
24802
|
computeBasePoints() {
|
|
@@ -24970,6 +25037,12 @@
|
|
|
24970
25037
|
super(...arguments);
|
|
24971
25038
|
this.name = 'marker';
|
|
24972
25039
|
}
|
|
25040
|
+
setAttribute(key, value, forceUpdateTag) {
|
|
25041
|
+
super.setAttribute(key, value, forceUpdateTag);
|
|
25042
|
+
if (key === 'visible') {
|
|
25043
|
+
this.render();
|
|
25044
|
+
}
|
|
25045
|
+
}
|
|
24973
25046
|
_initContainer() {
|
|
24974
25047
|
var _a, _b;
|
|
24975
25048
|
const { limitRect = {}, clipInRange } = this.attribute;
|
|
@@ -25014,22 +25087,20 @@
|
|
|
25014
25087
|
if (this.attribute.interactive === false) {
|
|
25015
25088
|
this.setAttribute('childrenPickable', false);
|
|
25016
25089
|
}
|
|
25017
|
-
if (markerVisible) {
|
|
25018
|
-
if (!this._container
|
|
25090
|
+
if (markerVisible && this.isValidPoints()) {
|
|
25091
|
+
if (!this._container) {
|
|
25019
25092
|
this._initContainer();
|
|
25020
25093
|
this.initMarker(this._container);
|
|
25021
25094
|
}
|
|
25022
25095
|
else {
|
|
25023
|
-
|
|
25024
|
-
|
|
25025
|
-
this.removeAllChild();
|
|
25026
|
-
}
|
|
25027
|
-
else {
|
|
25028
|
-
this._updateContainer();
|
|
25029
|
-
this.updateMarker();
|
|
25030
|
-
}
|
|
25096
|
+
this._updateContainer();
|
|
25097
|
+
this.updateMarker();
|
|
25031
25098
|
}
|
|
25032
25099
|
}
|
|
25100
|
+
else {
|
|
25101
|
+
this._container = null;
|
|
25102
|
+
this.removeAllChild();
|
|
25103
|
+
}
|
|
25033
25104
|
}
|
|
25034
25105
|
}
|
|
25035
25106
|
|
|
@@ -25398,7 +25469,22 @@
|
|
|
25398
25469
|
if (!points || points.length < 2) {
|
|
25399
25470
|
return false;
|
|
25400
25471
|
}
|
|
25401
|
-
|
|
25472
|
+
let validFlag = true;
|
|
25473
|
+
points.forEach((point) => {
|
|
25474
|
+
if (point.length) {
|
|
25475
|
+
point.forEach((p) => {
|
|
25476
|
+
if (!vutils.isValidNumber(p.x) || !vutils.isValidNumber(p.y)) {
|
|
25477
|
+
validFlag = false;
|
|
25478
|
+
return;
|
|
25479
|
+
}
|
|
25480
|
+
});
|
|
25481
|
+
}
|
|
25482
|
+
else if (!vutils.isValidNumber(point.x) || !vutils.isValidNumber(point.y)) {
|
|
25483
|
+
validFlag = false;
|
|
25484
|
+
return;
|
|
25485
|
+
}
|
|
25486
|
+
});
|
|
25487
|
+
return validFlag;
|
|
25402
25488
|
}
|
|
25403
25489
|
}
|
|
25404
25490
|
MarkLine.defaultAttributes = DEFAULT_MARK_LINE_THEME;
|
|
@@ -25491,7 +25577,14 @@
|
|
|
25491
25577
|
if (!points || points.length < 3) {
|
|
25492
25578
|
return false;
|
|
25493
25579
|
}
|
|
25494
|
-
|
|
25580
|
+
let validFlag = true;
|
|
25581
|
+
points.forEach((point) => {
|
|
25582
|
+
if (!vutils.isValidNumber(point.x) || !vutils.isValidNumber(point.y)) {
|
|
25583
|
+
validFlag = false;
|
|
25584
|
+
return;
|
|
25585
|
+
}
|
|
25586
|
+
});
|
|
25587
|
+
return validFlag;
|
|
25495
25588
|
}
|
|
25496
25589
|
}
|
|
25497
25590
|
MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
|
|
@@ -25698,7 +25791,11 @@
|
|
|
25698
25791
|
this.setItemAttributes(this._item, itemContent, itemPosition, type);
|
|
25699
25792
|
}
|
|
25700
25793
|
isValidPoints() {
|
|
25701
|
-
|
|
25794
|
+
const { position } = this.attribute;
|
|
25795
|
+
if (vutils.isValidNumber(position.x) && vutils.isValidNumber(position.y)) {
|
|
25796
|
+
return true;
|
|
25797
|
+
}
|
|
25798
|
+
return false;
|
|
25702
25799
|
}
|
|
25703
25800
|
}
|
|
25704
25801
|
MarkPoint.defaultAttributes = DEFAULT_MARK_POINT_THEME;
|
|
@@ -29862,7 +29959,7 @@
|
|
|
29862
29959
|
}
|
|
29863
29960
|
};
|
|
29864
29961
|
|
|
29865
|
-
const version = "0.17.11-alpha.
|
|
29962
|
+
const version = "0.17.11-alpha.3";
|
|
29866
29963
|
|
|
29867
29964
|
exports.AbstractComponent = AbstractComponent;
|
|
29868
29965
|
exports.ArcInfo = ArcInfo;
|