@visactor/vrender-components 0.17.12-alpha.1 → 0.17.12-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/axis/type.js +1 -2
- package/cjs/brush/type.js +2 -1
- package/cjs/data-zoom/data-zoom.d.ts +5 -1
- package/cjs/data-zoom/data-zoom.js +135 -77
- 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/indicator/indicator.d.ts +3 -1
- package/cjs/indicator/indicator.js +54 -15
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/indicator/type.d.ts +1 -0
- package/cjs/indicator/type.js.map +1 -1
- package/cjs/label/arc.js +1 -1
- package/cjs/label/arc.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.d.ts +1 -0
- package/cjs/marker/point.js +24 -11
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +1 -0
- package/cjs/marker/type.js.map +1 -1
- package/cjs/util/limit-shape.d.ts +4 -0
- package/cjs/util/limit-shape.js +13 -4
- package/cjs/util/limit-shape.js.map +1 -1
- package/es/axis/type.js +1 -2
- package/es/brush/type.js +2 -1
- package/es/data-zoom/data-zoom.d.ts +5 -1
- package/es/data-zoom/data-zoom.js +134 -73
- 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/indicator/indicator.d.ts +3 -1
- package/es/indicator/indicator.js +53 -14
- package/es/indicator/indicator.js.map +1 -1
- package/es/indicator/type.d.ts +1 -0
- package/es/indicator/type.js.map +1 -1
- package/es/label/arc.js +1 -1
- package/es/label/arc.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.d.ts +1 -0
- package/es/marker/point.js +25 -11
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +1 -0
- package/es/marker/type.js.map +1 -1
- package/es/util/limit-shape.d.ts +4 -0
- package/es/util/limit-shape.js +11 -3
- package/es/util/limit-shape.js.map +1 -1
- package/package.json +5 -5
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;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,GA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E,YAAY,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,SAAS,CAAC,GAAG,CAAC,IAAwB,CAAC,CAAC;IAC1C,CAAC;IAES,YAAY;;QACpB,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,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,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;AAGrC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAuF;AAGvF,iCAAgD;AAGhD,yCAAoD;AACpD,qDAA4D;AAE5D,IAAA,iCAAsB,GAAE,CAAC;AACzB,MAAa,SAAU,SAAQ,aA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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';\n// eslint-disable-next-line no-duplicate-imports\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';\nimport { computeOffsetForlimit } from '../util/limit-shape';\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\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 setAllOfItemsAttr(itemPosition: Point) {\n const { position, itemLine = {}, itemContent = {}, limitRect } = this.attribute as MarkPointAttrs;\n const { type = 'text', confine } = itemContent;\n if (limitRect && confine) {\n const { x, y, width, height } = limitRect;\n const { dx, dy } = computeOffsetForlimit(this._item, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n itemPosition.x = itemPosition.x + dx;\n itemPosition.y = itemPosition.y + dy;\n }\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine.decorativeLine?.visible);\n }\n\n protected initMarker(container: IGroup) {\n const { position, 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 // 为了强制将itemContent限制在limitRect内, 所以需要先绘制item, 然后根据item bounds 动态调整位置\n const item = this.initItem(itemContent as any, itemPosition);\n this._item = item;\n\n // 由于itemLine的指向也要变化, 所以需要对所有的内容进行渲染\n this.setAllOfItemsAttr(itemPosition);\n container.add(item as unknown as INode);\n }\n\n protected updateMarker() {\n const { position, itemContent = {} } = this.attribute as MarkPointAttrs;\n const { type = 'text' } = itemContent;\n\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n\n // 为了强制将itemContent限制在limitRect内, 所以需要先绘制item, 然后根据item bounds 动态调整位置\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n // 由于itemLine的指向也要变化, 所以需要对所有的内容进行渲染\n this.setAllOfItemsAttr(itemPosition);\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/cjs/marker/type.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ export type IItemContent = IMarkRef & {
|
|
|
85
85
|
textStyle?: IMarkLabel;
|
|
86
86
|
richTextStyle?: IRichTextGraphicAttribute;
|
|
87
87
|
renderCustomCallback?: () => IGroup;
|
|
88
|
+
confine?: boolean;
|
|
88
89
|
};
|
|
89
90
|
export type IItemLine = {
|
|
90
91
|
type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';
|
package/cjs/marker/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAYA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n IPolygonAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { SegmentAttributes, SymbolAttributes } from '../segment';\nimport type { TagAttributes } from '../tag';\nimport type { Point } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs = IGroupGraphicAttribute & {\n type?: 'line' | 'area' | 'point';\n /**\n * 是否支持交互\n * @default false\n */\n interactive?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n};\n\nexport type MarkLineAttrs = MarkerAttrs &\n SegmentAttributes & {\n type?: 'line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof IMarkLineLabelPosition;\n /**\n * 当 mark 配置了
|
|
1
|
+
{"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAYA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n IPolygonAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { SegmentAttributes, SymbolAttributes } from '../segment';\nimport type { TagAttributes } from '../tag';\nimport type { Point } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs = IGroupGraphicAttribute & {\n type?: 'line' | 'area' | 'point';\n /**\n * 是否支持交互\n * @default false\n */\n interactive?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n};\n\nexport type MarkLineAttrs = MarkerAttrs &\n SegmentAttributes & {\n type?: 'line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof IMarkLineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n };\n\nexport type MarkAreaAttrs = MarkerAttrs & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n};\n"]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { IGraphic } from '@visactor/vrender-core';
|
|
2
2
|
import type { IBoundsLike } from '@visactor/vutils';
|
|
3
|
+
export declare function computeOffsetForlimit(shape: IGraphic, bounds: IBoundsLike): {
|
|
4
|
+
dx: number;
|
|
5
|
+
dy: number;
|
|
6
|
+
};
|
|
3
7
|
export declare function limitShapeInBounds(shape: IGraphic, bounds: IBoundsLike): void;
|
package/cjs/util/limit-shape.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
const {x1: regionMinX, y1: regionMinY, x2: regionMaxX, y2: regionMaxY} = bounds, {x1: x1, y1: y1, x2: x2, y2: y2} = shape.AABBBounds
|
|
3
|
+
function computeOffsetForlimit(shape, bounds) {
|
|
4
|
+
const {x1: regionMinX, y1: regionMinY, x2: regionMaxX, y2: regionMaxY} = bounds, {x1: x1, y1: y1, x2: x2, y2: y2} = shape.AABBBounds;
|
|
5
5
|
let dx = 0, dy = 0;
|
|
6
|
-
x1 < regionMinX && (dx = regionMinX - x1), y1 < regionMinY && (dy = regionMinY - y1),
|
|
6
|
+
return x1 < regionMinX && (dx = regionMinX - x1), y1 < regionMinY && (dy = regionMinY - y1),
|
|
7
7
|
x2 > regionMaxX && (dx = regionMaxX - x2), y2 > regionMaxY && (dy = regionMaxY - y2),
|
|
8
|
+
{
|
|
9
|
+
dx: dx,
|
|
10
|
+
dy: dy
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function limitShapeInBounds(shape, bounds) {
|
|
15
|
+
const {dx: dx, dy: dy} = computeOffsetForlimit(shape, bounds), {dx: originDx = 0, dy: originDy = 0} = shape.attribute;
|
|
8
16
|
dx && shape.setAttribute("dx", dx + originDx), dy && shape.setAttribute("dy", dy + originDy);
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
Object.defineProperty(exports, "__esModule", {
|
|
12
20
|
value: !0
|
|
13
|
-
}), exports.limitShapeInBounds = void 0, exports.
|
|
21
|
+
}), exports.limitShapeInBounds = exports.computeOffsetForlimit = void 0, exports.computeOffsetForlimit = computeOffsetForlimit,
|
|
22
|
+
exports.limitShapeInBounds = limitShapeInBounds;
|
|
14
23
|
//# sourceMappingURL=limit-shape.js.map
|
|
@@ -1 +1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G,QAAQ,CAAC,CAAC;KACzC;IACD,IAAI,EAAE,EAAE;QACN,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC;KACzC;AACH,CAAC;AATD,gDASC","file":"limit-shape.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport type { IBoundsLike } from '@visactor/vutils';\n\nexport function computeOffsetForlimit(shape: IGraphic, bounds: IBoundsLike) {\n const { x1: regionMinX, y1: regionMinY, x2: regionMaxX, y2: regionMaxY } = bounds;\n const { x1, y1, x2, y2 } = shape.AABBBounds;\n\n let dx = 0;\n let dy = 0;\n if (x1 < regionMinX) {\n // 超出左侧\n dx = regionMinX - x1;\n }\n if (y1 < regionMinY) {\n // 超出顶部\n dy = regionMinY - y1;\n }\n\n if (x2 > regionMaxX) {\n // 超出右侧\n dx = regionMaxX - x2;\n }\n\n if (y2 > regionMaxY) {\n // 整体超出顶部\n dy = regionMaxY - y2;\n }\n return {\n dx,\n dy\n };\n}\nexport function limitShapeInBounds(shape: IGraphic, bounds: IBoundsLike) {\n const { dx, dy } = computeOffsetForlimit(shape, bounds);\n const { dx: originDx = 0, dy: originDy = 0 } = shape.attribute;\n if (dx) {\n shape.setAttribute('dx', dx + originDx);\n }\n if (dy) {\n shape.setAttribute('dy', dy + originDy);\n }\n}\n"]}
|
package/es/axis/type.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { };
|
|
2
|
-
//# sourceMappingURL=type.js.map
|
|
1
|
+
export { };
|
package/es/brush/type.js
CHANGED
|
@@ -4,4 +4,5 @@ export var IOperateType;
|
|
|
4
4
|
IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing",
|
|
5
5
|
IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd",
|
|
6
6
|
IOperateType.brushClear = "brushClear";
|
|
7
|
-
}(IOperateType || (IOperateType = {}));
|
|
7
|
+
}(IOperateType || (IOperateType = {}));
|
|
8
|
+
//# sourceMappingURL=type.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FederatedPointerEvent, IGroup } from '@visactor/vrender-core';
|
|
2
|
-
import type { IPointLike } from '@visactor/vutils';
|
|
2
|
+
import type { IBoundsLike, IPointLike } from '@visactor/vutils';
|
|
3
3
|
import { AbstractComponent } from '../core/base';
|
|
4
4
|
import type { TagAttributes } from '../tag';
|
|
5
5
|
import { Tag } from '../tag';
|
|
@@ -154,7 +154,9 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
|
|
|
154
154
|
private _previewPointsY1;
|
|
155
155
|
private _statePointToData;
|
|
156
156
|
private _layoutAttrFromConfig;
|
|
157
|
+
setPropsFromAttrs(): void;
|
|
157
158
|
constructor(attributes: DataZoomAttributes, options?: ComponentOptions);
|
|
159
|
+
setAttributes(params: Partial<Required<DataZoomAttributes>>, forceUpdateTag?: boolean): void;
|
|
158
160
|
protected bindEvents(): void;
|
|
159
161
|
protected dragMaskSize(): number;
|
|
160
162
|
protected setStateAttr(start: number, end: number, shouldRender: boolean): void;
|
|
@@ -170,6 +172,8 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
|
|
|
170
172
|
protected backgroundDragZoom(startPos: IPointLike, endPos: IPointLike): void;
|
|
171
173
|
protected moveZoomWithMiddle(middle: number): void;
|
|
172
174
|
protected renderDragMask(): void;
|
|
175
|
+
protected isTextOverflow(componentBoundsLike: IBoundsLike, textBounds: IBoundsLike | null, layout: 'start' | 'end'): boolean;
|
|
176
|
+
protected setTextAttr(startTextBounds: IBoundsLike, endTextBounds: IBoundsLike): void;
|
|
173
177
|
protected renderText(): void;
|
|
174
178
|
protected getLayoutAttrFromConfig(): any;
|
|
175
179
|
protected render(): void;
|
|
@@ -10,7 +10,7 @@ var __rest = this && this.__rest || function(s, e) {
|
|
|
10
10
|
|
|
11
11
|
import { vglobal } from "@visactor/vrender-core";
|
|
12
12
|
|
|
13
|
-
import { array, clamp, debounce, isFunction, isValid, merge, throttle } from "@visactor/vutils";
|
|
13
|
+
import { Bounds, array, clamp, debounce, isFunction, isValid, merge, throttle } from "@visactor/vutils";
|
|
14
14
|
|
|
15
15
|
import { AbstractComponent } from "../core/base";
|
|
16
16
|
|
|
@@ -30,6 +30,16 @@ const delayMap = {
|
|
|
30
30
|
loadDataZoomComponent();
|
|
31
31
|
|
|
32
32
|
export class DataZoom extends AbstractComponent {
|
|
33
|
+
setPropsFromAttrs() {
|
|
34
|
+
const {start: start, end: end, orient: orient, previewData: previewData, previewPointsX: previewPointsX, previewPointsY: previewPointsY, previewPointsX1: previewPointsX1, previewPointsY1: previewPointsY1} = this.attribute;
|
|
35
|
+
start && (this.state.start = start), end && (this.state.end = end);
|
|
36
|
+
const {width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
37
|
+
this._spanCache = this.state.end - this.state.start, this._isHorizontal = "top" === orient || "bottom" === orient,
|
|
38
|
+
this._layoutCache.max = this._isHorizontal ? width : height, this._layoutCache.attPos = this._isHorizontal ? "x" : "y",
|
|
39
|
+
this._layoutCache.attSize = this._isHorizontal ? "width" : "height", previewData && (this._previewData = previewData),
|
|
40
|
+
isFunction(previewPointsX) && (this._previewPointsX = previewPointsX), isFunction(previewPointsY) && (this._previewPointsY = previewPointsY),
|
|
41
|
+
isFunction(previewPointsX1) && (this._previewPointsX1 = previewPointsX1), isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
|
|
42
|
+
}
|
|
33
43
|
constructor(attributes, options) {
|
|
34
44
|
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, DataZoom.defaultAttributes, attributes)),
|
|
35
45
|
this.name = "dataZoom", this._previewData = [], this._activeState = !1, this._activeCache = {
|
|
@@ -76,14 +86,12 @@ export class DataZoom extends AbstractComponent {
|
|
|
76
86
|
tag: this._activeTag
|
|
77
87
|
}));
|
|
78
88
|
}), this.attribute.delayTime);
|
|
79
|
-
const {
|
|
80
|
-
start && (this.state.start = start), end && (this.state.end = end), this._spanCache = this.state.end - this.state.start,
|
|
81
|
-
this._isHorizontal = "top" === orient || "bottom" === orient, this._layoutCache.max = this._isHorizontal ? width : height,
|
|
82
|
-
this._layoutCache.attPos = this._isHorizontal ? "x" : "y", this._layoutCache.attSize = this._isHorizontal ? "width" : "height",
|
|
89
|
+
const {position: position, showDetail: showDetail} = attributes;
|
|
83
90
|
this._activeCache.startPos = position, this._activeCache.lastPos = position, this._showText = "auto" !== showDetail && showDetail,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
this.setPropsFromAttrs();
|
|
92
|
+
}
|
|
93
|
+
setAttributes(params, forceUpdateTag) {
|
|
94
|
+
super.setAttributes(params, forceUpdateTag), this.setPropsFromAttrs();
|
|
87
95
|
}
|
|
88
96
|
bindEvents() {
|
|
89
97
|
if (this.attribute.disableTriggerEvent) return;
|
|
@@ -169,55 +177,79 @@ export class DataZoom extends AbstractComponent {
|
|
|
169
177
|
height: this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0
|
|
170
178
|
}, dragMaskStyle), "rect");
|
|
171
179
|
}
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
isTextOverflow(componentBoundsLike, textBounds, layout) {
|
|
181
|
+
if (!textBounds) return !1;
|
|
182
|
+
if (this._isHorizontal) {
|
|
183
|
+
if ("start" === layout) {
|
|
184
|
+
if (textBounds.x1 < componentBoundsLike.x1) return !0;
|
|
185
|
+
} else if (textBounds.x2 > componentBoundsLike.x2) return !0;
|
|
186
|
+
} else if ("start" === layout) {
|
|
187
|
+
if (textBounds.y1 < componentBoundsLike.y1) return !0;
|
|
188
|
+
} else if (textBounds.y2 > componentBoundsLike.y2) return !0;
|
|
189
|
+
return !1;
|
|
190
|
+
}
|
|
191
|
+
setTextAttr(startTextBounds, endTextBounds) {
|
|
192
|
+
const {startTextStyle: startTextStyle, endTextStyle: endTextStyle} = this.attribute, {formatMethod: startTextFormat} = startTextStyle, restStartTextStyle = __rest(startTextStyle, [ "formatMethod" ]), {formatMethod: endTextFormat} = endTextStyle, restEndTextStyle = __rest(endTextStyle, [ "formatMethod" ]), {start: start, end: end} = this.state;
|
|
174
193
|
this._startValue = this._statePointToData(start), this._endValue = this._statePointToData(end);
|
|
175
|
-
const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig()
|
|
176
|
-
|
|
177
|
-
|
|
194
|
+
const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startTextValue = startTextFormat ? startTextFormat(this._startValue) : this._startValue, endTextValue = endTextFormat ? endTextFormat(this._endValue) : this._endValue, componentBoundsLike = {
|
|
195
|
+
x1: position.x,
|
|
196
|
+
y1: position.y,
|
|
197
|
+
x2: position.x + width,
|
|
198
|
+
y2: position.y + height
|
|
199
|
+
};
|
|
200
|
+
let startTextPosition, endTextPosition, startTextAlignStyle, endTextAlignStyle;
|
|
201
|
+
this._isHorizontal ? (startTextPosition = {
|
|
178
202
|
x: position.x + start * width,
|
|
179
|
-
y: position.y + height / 2
|
|
180
|
-
|
|
181
|
-
pickable: !1,
|
|
182
|
-
childrenPickable: !1,
|
|
183
|
-
textStyle: {
|
|
184
|
-
textAlign: "right",
|
|
185
|
-
textBaseline: "middle"
|
|
186
|
-
}
|
|
187
|
-
}), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, merge({}, restEndTextStyle, {
|
|
188
|
-
text: endTextFormat ? endTextFormat(this._endValue) : this._endValue,
|
|
203
|
+
y: position.y + height / 2
|
|
204
|
+
}, endTextPosition = {
|
|
189
205
|
x: position.x + end * width,
|
|
190
|
-
y: position.y + height / 2
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}), `data-zoom-end-text-${position}`)) : (this._startText = this.maybeAddLabel(this._container, merge({}, restStartStyle, {
|
|
199
|
-
text: startTextFormat ? startTextFormat(this._startValue) : this._startValue,
|
|
206
|
+
y: position.y + height / 2
|
|
207
|
+
}, startTextAlignStyle = {
|
|
208
|
+
textAlign: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "left" : "right",
|
|
209
|
+
textBaseline: "middle"
|
|
210
|
+
}, endTextAlignStyle = {
|
|
211
|
+
textAlign: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "right" : "left",
|
|
212
|
+
textBaseline: "middle"
|
|
213
|
+
}) : (startTextPosition = {
|
|
200
214
|
x: position.x + width / 2,
|
|
201
|
-
y: position.y + start * height
|
|
215
|
+
y: position.y + start * height
|
|
216
|
+
}, endTextPosition = {
|
|
217
|
+
x: position.x + width / 2,
|
|
218
|
+
y: position.y + end * height
|
|
219
|
+
}, startTextAlignStyle = {
|
|
220
|
+
textAlign: "center",
|
|
221
|
+
textBaseline: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "top" : "bottom"
|
|
222
|
+
}, endTextAlignStyle = {
|
|
223
|
+
textAlign: "center",
|
|
224
|
+
textBaseline: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "bottom" : "top"
|
|
225
|
+
}), this._startText = this.maybeAddLabel(this._container, merge({}, restStartTextStyle, {
|
|
226
|
+
text: startTextValue,
|
|
227
|
+
x: startTextPosition.x,
|
|
228
|
+
y: startTextPosition.y,
|
|
202
229
|
visible: this._showText,
|
|
203
230
|
pickable: !1,
|
|
204
231
|
childrenPickable: !1,
|
|
205
|
-
textStyle:
|
|
206
|
-
textAlign: "center",
|
|
207
|
-
textBaseline: "bottom"
|
|
208
|
-
}
|
|
232
|
+
textStyle: startTextAlignStyle
|
|
209
233
|
}), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, merge({}, restEndTextStyle, {
|
|
210
|
-
text:
|
|
211
|
-
x:
|
|
212
|
-
y:
|
|
234
|
+
text: endTextValue,
|
|
235
|
+
x: endTextPosition.x,
|
|
236
|
+
y: endTextPosition.y,
|
|
213
237
|
visible: this._showText,
|
|
214
238
|
pickable: !1,
|
|
215
239
|
childrenPickable: !1,
|
|
216
|
-
textStyle:
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
240
|
+
textStyle: endTextAlignStyle
|
|
241
|
+
}), `data-zoom-end-text-${position}`);
|
|
242
|
+
}
|
|
243
|
+
renderText() {
|
|
244
|
+
let startTextBounds = null, endTextBounds = null;
|
|
245
|
+
this.setTextAttr(startTextBounds, endTextBounds), startTextBounds = this._startText.AABBBounds,
|
|
246
|
+
endTextBounds = this._endText.AABBBounds, this.setTextAttr(startTextBounds, endTextBounds),
|
|
247
|
+
startTextBounds = this._startText.AABBBounds, endTextBounds = this._endText.AABBBounds;
|
|
248
|
+
const {x1: x1, x2: x2, y1: y1, y2: y2} = startTextBounds, {dx: startTextDx = 0, dy: startTextDy = 0} = this.attribute.startTextStyle;
|
|
249
|
+
if ((new Bounds).set(x1, y1, x2, y2).intersects(endTextBounds)) {
|
|
250
|
+
const direction = "bottom" === this.attribute.orient || "right" === this.attribute.orient ? -1 : 1;
|
|
251
|
+
this._isHorizontal ? this._startText.setAttribute("dy", startTextDy + direction * Math.abs(endTextBounds.y1 - endTextBounds.y2)) : this._startText.setAttribute("dx", startTextDx + direction * Math.abs(endTextBounds.x1 - endTextBounds.x2));
|
|
252
|
+
} else this._isHorizontal ? this._startText.setAttribute("dy", startTextDy) : this._startText.setAttribute("dx", startTextDx);
|
|
221
253
|
}
|
|
222
254
|
getLayoutAttrFromConfig() {
|
|
223
255
|
var _a, _b, _c, _d;
|
|
@@ -249,59 +281,72 @@ export class DataZoom extends AbstractComponent {
|
|
|
249
281
|
render() {
|
|
250
282
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
251
283
|
this._layoutAttrFromConfig = null;
|
|
252
|
-
const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle = {}, selectedBackgroundStyle: selectedBackgroundStyle = {}, selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, brushSelect: brushSelect} = this.attribute, {start: start, end: end} = this.state, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startHandlerMinSize = null !== (_a = startHandlerStyle.triggerMinSize) && void 0 !== _a ? _a : 40, endHandlerMinSize = null !== (_b = endHandlerStyle.triggerMinSize) && void 0 !== _b ? _b : 40, group = this.createOrUpdateChild("dataZoom-container", {}, "group");
|
|
253
|
-
if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign({
|
|
284
|
+
const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle = {}, selectedBackgroundStyle: selectedBackgroundStyle = {}, selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, brushSelect: brushSelect, zoomLock: zoomLock} = this.attribute, {start: start, end: end} = this.state, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startHandlerMinSize = null !== (_a = startHandlerStyle.triggerMinSize) && void 0 !== _a ? _a : 40, endHandlerMinSize = null !== (_b = endHandlerStyle.triggerMinSize) && void 0 !== _b ? _b : 40, group = this.createOrUpdateChild("dataZoom-container", {}, "group");
|
|
285
|
+
if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign(Object.assign({
|
|
254
286
|
x: position.x,
|
|
255
287
|
y: position.y,
|
|
256
288
|
width: width,
|
|
257
289
|
height: height,
|
|
258
290
|
cursor: brushSelect ? "crosshair" : "auto"
|
|
259
|
-
}, backgroundStyle),
|
|
291
|
+
}, backgroundStyle), {
|
|
292
|
+
pickable: !zoomLock
|
|
293
|
+
}), "rect"), (null === (_c = backgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this.setPreviewAttributes("line", group),
|
|
260
294
|
(null === (_d = backgroundChartStyle.area) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("area", group),
|
|
261
|
-
brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign({
|
|
295
|
+
brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
262
296
|
x: position.x + start * width,
|
|
263
297
|
y: position.y,
|
|
264
298
|
width: (end - start) * width,
|
|
265
299
|
height: height,
|
|
266
300
|
cursor: brushSelect ? "crosshair" : "move"
|
|
267
|
-
}, selectedBackgroundStyle),
|
|
301
|
+
}, selectedBackgroundStyle), {
|
|
302
|
+
pickable: !zoomLock
|
|
303
|
+
}), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
268
304
|
x: position.x,
|
|
269
305
|
y: position.y + start * height,
|
|
270
306
|
width: width,
|
|
271
307
|
height: (end - start) * height,
|
|
272
308
|
cursor: brushSelect ? "crosshair" : "move"
|
|
273
|
-
}, selectedBackgroundStyle),
|
|
309
|
+
}, selectedBackgroundStyle), {
|
|
310
|
+
pickable: !zoomLock
|
|
311
|
+
}), "rect"), (null === (_e = selectedBackgroundChartStyle.line) || void 0 === _e ? void 0 : _e.visible) && this.setSelectedPreviewAttributes("line", group),
|
|
274
312
|
(null === (_f = selectedBackgroundChartStyle.area) || void 0 === _f ? void 0 : _f.visible) && this.setSelectedPreviewAttributes("area", group),
|
|
275
|
-
this.
|
|
313
|
+
this._isHorizontal) {
|
|
276
314
|
if (middleHandlerStyle.visible) {
|
|
277
315
|
const middleHandlerBackgroundSize = (null === (_g = middleHandlerStyle.background) || void 0 === _g ? void 0 : _g.size) || 10;
|
|
278
|
-
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
|
|
316
|
+
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
279
317
|
x: position.x + start * width,
|
|
280
318
|
y: position.y - middleHandlerBackgroundSize,
|
|
281
319
|
width: (end - start) * width,
|
|
282
320
|
height: middleHandlerBackgroundSize
|
|
283
|
-
}, null === (_h = middleHandlerStyle.background) || void 0 === _h ? void 0 : _h.style),
|
|
284
|
-
|
|
321
|
+
}, null === (_h = middleHandlerStyle.background) || void 0 === _h ? void 0 : _h.style), {
|
|
322
|
+
pickable: !zoomLock
|
|
323
|
+
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
285
324
|
x: position.x + (start + end) / 2 * width,
|
|
286
325
|
y: position.y - middleHandlerBackgroundSize / 2,
|
|
287
326
|
strokeBoundsBuffer: 0,
|
|
288
327
|
angle: 0,
|
|
289
328
|
symbolType: null !== (_k = null === (_j = middleHandlerStyle.icon) || void 0 === _j ? void 0 : _j.symbolType) && void 0 !== _k ? _k : "square"
|
|
290
|
-
}, middleHandlerStyle.icon),
|
|
329
|
+
}, middleHandlerStyle.icon), {
|
|
330
|
+
pickable: !zoomLock
|
|
331
|
+
}), "symbol");
|
|
291
332
|
}
|
|
292
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
|
|
333
|
+
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
293
334
|
x: position.x + start * width,
|
|
294
335
|
y: position.y + height / 2,
|
|
295
336
|
size: height,
|
|
296
337
|
symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
|
|
297
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle),
|
|
338
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
|
|
339
|
+
pickable: !zoomLock
|
|
340
|
+
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
298
341
|
x: position.x + end * width,
|
|
299
342
|
y: position.y + height / 2,
|
|
300
343
|
size: height,
|
|
301
344
|
symbolType: null !== (_m = endHandlerStyle.symbolType) && void 0 !== _m ? _m : "square"
|
|
302
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle),
|
|
345
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
|
|
346
|
+
pickable: !zoomLock
|
|
347
|
+
}), "symbol");
|
|
303
348
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize), startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize), endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize), endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
|
|
304
|
-
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
|
|
349
|
+
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
|
|
305
350
|
x: position.x + start * width - startHandlerWidth / 2,
|
|
306
351
|
y: position.y + height / 2 - startHandlerHeight / 2,
|
|
307
352
|
width: startHandlerWidth,
|
|
@@ -309,7 +354,9 @@ export class DataZoom extends AbstractComponent {
|
|
|
309
354
|
fill: "white",
|
|
310
355
|
fillOpacity: 0,
|
|
311
356
|
zIndex: 999
|
|
312
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal),
|
|
357
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
358
|
+
pickable: !zoomLock
|
|
359
|
+
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
313
360
|
x: position.x + end * width - endHandlerWidth / 2,
|
|
314
361
|
y: position.y + height / 2 - endHandlerHeight / 2,
|
|
315
362
|
width: endHandlerWidth,
|
|
@@ -317,37 +364,46 @@ export class DataZoom extends AbstractComponent {
|
|
|
317
364
|
fill: "white",
|
|
318
365
|
fillOpacity: 0,
|
|
319
366
|
zIndex: 999
|
|
320
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal),
|
|
367
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
368
|
+
pickable: !zoomLock
|
|
369
|
+
}), "rect");
|
|
321
370
|
} else {
|
|
322
371
|
if (middleHandlerStyle.visible) {
|
|
323
372
|
const middleHandlerBackgroundSize = (null === (_o = middleHandlerStyle.background) || void 0 === _o ? void 0 : _o.size) || 10;
|
|
324
|
-
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
|
|
373
|
+
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
325
374
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
|
|
326
375
|
y: position.y + start * height,
|
|
327
376
|
width: middleHandlerBackgroundSize,
|
|
328
377
|
height: (end - start) * height
|
|
329
|
-
}, null === (_p = middleHandlerStyle.background) || void 0 === _p ? void 0 : _p.style),
|
|
330
|
-
|
|
378
|
+
}, null === (_p = middleHandlerStyle.background) || void 0 === _p ? void 0 : _p.style), {
|
|
379
|
+
pickable: !zoomLock
|
|
380
|
+
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
331
381
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
|
|
332
382
|
y: position.y + (start + end) / 2 * height,
|
|
333
383
|
angle: Math.PI / 180 * 90,
|
|
334
384
|
symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square",
|
|
335
385
|
strokeBoundsBuffer: 0
|
|
336
|
-
}, middleHandlerStyle.icon),
|
|
386
|
+
}, middleHandlerStyle.icon), {
|
|
387
|
+
pickable: !zoomLock
|
|
388
|
+
}), "symbol");
|
|
337
389
|
}
|
|
338
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
|
|
390
|
+
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
339
391
|
x: position.x + width / 2,
|
|
340
392
|
y: position.y + start * height,
|
|
341
393
|
size: width,
|
|
342
394
|
symbolType: null !== (_s = startHandlerStyle.symbolType) && void 0 !== _s ? _s : "square"
|
|
343
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle),
|
|
395
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
|
|
396
|
+
pickable: !zoomLock
|
|
397
|
+
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
344
398
|
x: position.x + width / 2,
|
|
345
399
|
y: position.y + end * height,
|
|
346
400
|
size: width,
|
|
347
401
|
symbolType: null !== (_t = endHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
|
|
348
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle),
|
|
402
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
|
|
403
|
+
pickable: !zoomLock
|
|
404
|
+
}), "symbol");
|
|
349
405
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize), startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize), endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize), endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
|
|
350
|
-
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
|
|
406
|
+
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
|
|
351
407
|
x: position.x + width / 2 + startHandlerWidth / 2,
|
|
352
408
|
y: position.y + start * height - startHandlerHeight / 2,
|
|
353
409
|
width: endHandlerHeight,
|
|
@@ -355,7 +411,9 @@ export class DataZoom extends AbstractComponent {
|
|
|
355
411
|
fill: "white",
|
|
356
412
|
fillOpacity: 0,
|
|
357
413
|
zIndex: 999
|
|
358
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical),
|
|
414
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
415
|
+
pickable: !zoomLock
|
|
416
|
+
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
359
417
|
x: position.x + width / 2 + endHandlerWidth / 2,
|
|
360
418
|
y: position.y + end * height - endHandlerHeight / 2,
|
|
361
419
|
width: endHandlerHeight,
|
|
@@ -363,8 +421,11 @@ export class DataZoom extends AbstractComponent {
|
|
|
363
421
|
fill: "white",
|
|
364
422
|
fillOpacity: 0,
|
|
365
423
|
zIndex: 999
|
|
366
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical),
|
|
424
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
425
|
+
pickable: !zoomLock
|
|
426
|
+
}), "rect");
|
|
367
427
|
}
|
|
428
|
+
this._showText && this.renderText();
|
|
368
429
|
}
|
|
369
430
|
computeBasePoints() {
|
|
370
431
|
const {orient: orient} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
|