@visactor/vrender-components 0.21.1-alpha.1 → 0.21.1

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.
Files changed (42) hide show
  1. package/cjs/index.d.ts +1 -1
  2. package/cjs/index.js +1 -1
  3. package/cjs/index.js.map +1 -1
  4. package/cjs/label/base.d.ts +1 -0
  5. package/cjs/label/base.js +26 -19
  6. package/cjs/label/base.js.map +1 -1
  7. package/cjs/label/overlap/place.d.ts +1 -1
  8. package/cjs/label/overlap/place.js +7 -6
  9. package/cjs/label/overlap/place.js.map +1 -1
  10. package/cjs/label/overlap/shiftY.js +3 -3
  11. package/cjs/label/overlap/shiftY.js.map +1 -1
  12. package/cjs/label/type.d.ts +2 -0
  13. package/cjs/label/type.js.map +1 -1
  14. package/cjs/marker/config.js +32 -0
  15. package/cjs/marker/config.js.map +1 -1
  16. package/cjs/marker/type.d.ts +9 -1
  17. package/cjs/marker/type.js +6 -2
  18. package/cjs/marker/type.js.map +1 -1
  19. package/cjs/scrollbar/scrollbar-plugin.js +24 -19
  20. package/cjs/scrollbar/scrollbar-plugin.js.map +1 -1
  21. package/dist/index.es.js +163 -73
  22. package/es/index.d.ts +1 -1
  23. package/es/index.js +1 -1
  24. package/es/index.js.map +1 -1
  25. package/es/label/base.d.ts +1 -0
  26. package/es/label/base.js +26 -19
  27. package/es/label/base.js.map +1 -1
  28. package/es/label/overlap/place.d.ts +1 -1
  29. package/es/label/overlap/place.js +6 -5
  30. package/es/label/overlap/place.js.map +1 -1
  31. package/es/label/overlap/shiftY.js +3 -3
  32. package/es/label/overlap/shiftY.js.map +1 -1
  33. package/es/label/type.d.ts +2 -0
  34. package/es/label/type.js.map +1 -1
  35. package/es/marker/config.js +32 -0
  36. package/es/marker/config.js.map +1 -1
  37. package/es/marker/type.d.ts +9 -1
  38. package/es/marker/type.js +6 -2
  39. package/es/marker/type.js.map +1 -1
  40. package/es/scrollbar/scrollbar-plugin.js +24 -19
  41. package/es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AChB;QAED,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE;YACzB,IAAI,KAAK,EAAE;gBACT,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;aACtC;YAED,IAAI,KAAK,EAAE;gBACT,KAAK,GAAG,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;aACxC;SACF;QAED,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAW,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,CAAC;IAGD,kBAAkB,CAAC,OAAiB;QAClC,IAAI,CAAC,GAAG,OAAO,CAAC;QAChB,OAAO,CAAC,EAAE;YACR,MAAM,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAE1C,IAAI,GAAG,EAAE;gBACP,OAAO,GAAG,CAAC;aACZ;YACD,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,OAAuB;QAChC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QACrC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,MAAa,CAAC,CAAC;IACzD,CAAC;;AA9SM,6BAAa,GAAY;IAC9B,OAAO,EAAE,GAAG;CACb,CAAC;AAZS,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAyT3B;AAzTY,0CAAe","file":"scrollbar-plugin.js","sourcesContent":["import type { IGraphic, IGroup, IPlugin, IPluginService } from '@visactor/vrender-core';\nimport { Generator, injectable } from '@visactor/vrender-core';\nimport { ScrollBar } from './scrollbar';\nimport type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds, abs, Bounds } from '@visactor/vutils';\nimport { SCROLLBAR_EVENT } from '../constant';\nimport type { ScrollBarAttributes } from './type';\n\n// _showPoptip: 0-没有,1-添加,2-删除\n\ntype IParams = {\n timeout?: number; // 消失的timeout\n bufferV?: number; // 判定是否出现滚动条的buffer\n bufferH?: number; // 判定是否出现滚动条的buffer\n};\n\n@injectable()\nexport class ScrollBarPlugin implements IPlugin {\n name: 'scrollbar' = 'scrollbar';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n scrollContainer?: { g: IGroup; showH: boolean; showV: boolean };\n scrollContainerBounds: IAABBBounds;\n childrenBounds: IAABBBounds;\n\n static defaultParams: IParams = {\n timeout: 500\n };\n\n params: IParams;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const { stage } = this.pluginService;\n\n this.childrenBounds = new AABBBounds();\n stage.addEventListener('wheel', this.scroll as any);\n this.params = ScrollBarPlugin.defaultParams;\n }\n scroll = (e: { deltaX: number; deltaY: number; target: IGraphic }) => {\n const graphic = e.target as any;\n const data = this.getScrollContainer(graphic);\n\n if (!data && !this.scrollContainer) {\n return;\n }\n\n if (!data && this.scrollContainer) {\n if (!this.scrollContainer.g.stage || this.scrollContainer.g.stage !== graphic.stage) {\n return;\n }\n const newScrollContainer = this.formatScrollContainer(this.scrollContainer.g);\n\n if (!newScrollContainer) {\n this.clearScrollbar(this.scrollContainer.g, 'all');\n // 删除老的scrollbar\n return;\n }\n if (this.scrollContainer.showH && !newScrollContainer.showH) {\n this.clearScrollbar(this.scrollContainer.g, 'horizontal');\n }\n\n if (this.scrollContainer.showV && !newScrollContainer.showV) {\n this.clearScrollbar(this.scrollContainer.g, 'vertical');\n }\n\n this.scrollContainer = newScrollContainer;\n } else if (data && this.scrollContainer && data.g !== this.scrollContainer.g) {\n this.clearScrollbar(this.scrollContainer.g, 'all');\n }\n\n this.scrollContainer = data ?? this.scrollContainer;\n\n const scrollContainer = data.g;\n const { width, height, scrollX = 0, scrollY = 0 } = scrollContainer.attribute;\n let newScrollX = scrollX;\n let newScrollY = scrollY;\n let { showH, showV } = data;\n this.scrollContainerBounds = new Bounds().set(\n 0,\n 0,\n scrollContainer.attribute.width,\n scrollContainer.attribute.height\n );\n if (showH && showH) {\n if (abs(e.deltaX) > abs(e.deltaY)) {\n showH = showH && true;\n showV = showV && false;\n } else {\n showH = showH && false;\n showV = showV && true;\n }\n }\n\n // 计算子元素的bounds\n const childrenBounds = this.childrenBounds;\n\n childrenBounds.clear();\n childrenBounds.set(0, 0, scrollContainer.AABBBounds.width(), scrollContainer.AABBBounds.height());\n\n const scrollWidth = childrenBounds.width();\n const scrollHeight = childrenBounds.height();\n\n if (showH) {\n newScrollX = Math.max(Math.min((e.deltaX ?? 0) - scrollX, scrollWidth - width), 0);\n } else {\n newScrollX = -scrollX;\n }\n\n if (showV) {\n newScrollY = Math.max(Math.min((e.deltaY ?? 0) - scrollY, scrollHeight - height), 0);\n } else {\n newScrollY = -scrollY;\n }\n\n childrenBounds.translate(-newScrollX, -newScrollY);\n\n this.addOrUpdateScroll(showH, showV, scrollContainer.parent, scrollContainer);\n scrollContainer.setAttributes({\n scrollX: -newScrollX,\n scrollY: -newScrollY\n });\n };\n\n handleScrollBarChange = (params: any) => {\n if (\n !this.scrollContainer ||\n !this.scrollContainerBounds ||\n !this.childrenBounds ||\n !params ||\n !params.target ||\n !params.detail ||\n !params.detail.value\n ) {\n return;\n }\n const scrollbar = params.target;\n const newRange = params.detail.value;\n\n if (scrollbar.attribute.direction === 'horizontal') {\n const scrollWidth = this.childrenBounds.width();\n\n this.scrollContainer.g.setAttributes({ scrollX: -newRange[0] * scrollWidth });\n } else {\n const scrollHeight = this.childrenBounds.height();\n\n this.scrollContainer.g.setAttributes({ scrollY: -newRange[0] * scrollHeight });\n }\n };\n\n initEventOfScrollbar(scrollContainer: IGroup, scrollbar: IGroup, isHorozntal?: boolean) {\n scrollContainer.addEventListener('pointerover', () => {\n scrollbar.setAttribute('visibleAll', true);\n });\n scrollContainer.addEventListener('pointermove', () => {\n scrollbar.setAttribute('visibleAll', true);\n });\n scrollContainer.addEventListener('pointerout', () => {\n scrollbar.setAttribute('visibleAll', false);\n });\n scrollbar.addEventListener('pointerover', () => {\n scrollbar.setAttribute('visibleAll', true);\n });\n scrollbar.addEventListener('pointerout', () => {\n scrollbar.setAttribute('visibleAll', true);\n });\n\n scrollbar.addEventListener('scrollUp', this.handleScrollBarChange);\n scrollbar.addEventListener(SCROLLBAR_EVENT, this.handleScrollBarChange);\n }\n\n addOrUpdateScroll(showH: boolean, showV: boolean, container: IGroup, scrollContainer: IGroup) {\n if (showH) {\n const { scrollBar: hScrollbar, isUpdate } = this.addOrUpdateHScroll(scrollContainer, container, true);\n\n if (!isUpdate) {\n this.initEventOfScrollbar(scrollContainer, hScrollbar, true);\n }\n } else {\n this.clearScrollbar(scrollContainer, 'horizontal');\n }\n if (showV) {\n const { scrollBar: vScrollbar, isUpdate } = this.addOrUpdateHScroll(scrollContainer, container, false);\n\n if (!isUpdate) {\n this.initEventOfScrollbar(scrollContainer, vScrollbar, false);\n }\n } else {\n this.clearScrollbar(scrollContainer, 'vertical');\n }\n }\n\n getDirection(isHorozntal?: boolean) {\n return isHorozntal ? 'horizontal' : 'vertical';\n }\n\n addOrUpdateHScroll(scrollContainer: IGroup, container: IGroup, isHorozntal?: boolean) {\n const direction = this.getDirection(isHorozntal);\n const name = `${scrollContainer.name ?? scrollContainer._uid}_${this.getDirection(isHorozntal)}_${this.name}`;\n const scrollbars = container.children.filter((g: ScrollBar) => g.name === name);\n let isUpdate = true;\n let scrollBar = scrollbars[0] as ScrollBar;\n\n const { y = 0, dy = 0, x = 0, dx = 0, height, width, zIndex = 0 } = this.scrollContainer.g.attribute;\n const attrs: Partial<ScrollBarAttributes> = {\n x: 0,\n y: 0,\n direction,\n zIndex: zIndex + 1,\n visibleAll: true,\n padding: [2, 0],\n railStyle: {\n fill: 'rgba(0, 0, 0, .1)'\n },\n range: [0, 0.05]\n };\n\n if (isHorozntal) {\n attrs.width = this.scrollContainerBounds.width();\n attrs.height = 12;\n } else {\n attrs.height = this.scrollContainerBounds.height();\n attrs.width = 12;\n }\n\n if (!scrollBar) {\n isUpdate = false;\n\n scrollBar = new ScrollBar(attrs as ScrollBarAttributes);\n scrollBar.name = name;\n container.add(scrollBar);\n (scrollBar as any).isScrollBar = true;\n } else if (scrollbars.length > 1) {\n scrollbars.forEach((child: IGraphic, index: number) => {\n if (index) {\n child.parent?.removeChild(child);\n }\n });\n }\n const childrenBounds = this.childrenBounds;\n\n if (isHorozntal) {\n const ratio = Math.min(this.scrollContainerBounds.width() / childrenBounds.width(), 1);\n const start = Math.max(Math.min(this.childrenBounds.x1 / this.childrenBounds.width(), 0), ratio - 1);\n attrs.x = x + dx;\n attrs.y = y + dy + height - this.scrollContainerBounds.height();\n attrs.range = [-start, -start + ratio];\n } else {\n const ratio = Math.min(this.scrollContainerBounds.height() / childrenBounds.height(), 1);\n const start = Math.max(Math.min(this.childrenBounds.y1 / this.childrenBounds.height(), 0), ratio - 1);\n attrs.x = x + dx + width - this.scrollContainerBounds.width();\n attrs.y = y + dy;\n attrs.range = [-start, -start + ratio];\n }\n\n scrollBar.setAttributes(attrs);\n return {\n scrollBar,\n isUpdate\n };\n }\n\n clearScrollbar(scrollContainer: IGroup, type: 'horizontal' | 'vertical' | 'all') {\n if (!scrollContainer.parent) {\n return;\n }\n const scrollbarBars = scrollContainer.parent.children.filter((child: IGroup) => {\n return (child as any).isScrollBar && (type === 'all' || (child.attribute as any).direction === type);\n });\n\n scrollbarBars.forEach((child: IGraphic) => {\n child.parent.removeChild(child);\n });\n }\n\n formatScrollContainer(g: IGraphic) {\n if (!g || g.type !== 'group' || !g.attribute) {\n return null;\n }\n\n const { overflow, width, height } = (g as IGroup).attribute;\n\n if (!overflow || overflow === 'hidden') {\n return null;\n }\n\n let showH = false;\n let showV = false;\n\n if (overflow === 'scroll') {\n showH = true;\n showV = true;\n } else {\n showH = overflow === 'scroll-x';\n showV = !showH;\n }\n\n if (!g.AABBBounds.empty()) {\n if (showH) {\n showH = width < g.AABBBounds.width();\n }\n\n if (showV) {\n showV = height < g.AABBBounds.height();\n }\n }\n\n return showH || showV ? { g: g as IGroup, showH, showV } : null;\n }\n\n // 获取响应滚动的元素\n getScrollContainer(graphic: IGraphic): { g: IGroup; showH: boolean; showV: boolean } | null {\n let g = graphic;\n while (g) {\n const res = this.formatScrollContainer(g);\n\n if (res) {\n return res;\n }\n g = g.parent;\n }\n return null;\n }\n\n deactivate(context: IPluginService): void {\n const { stage } = this.pluginService;\n stage.removeEventListener('wheel', this.scroll as any);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/scrollbar/scrollbar-plugin.ts"],"names":[],"mappings":";;;;;;;;;;AACA,yDAA+D;AAC/D,2CAAwC;AAExC,6CAA2D;AAC3D,0CAA8C;AAYvC,IAAM,eAAe,uBAArB,MAAM,eAAe;IAArB;QACL,SAAI,GAAgB,WAAW,CAAC;QAChC,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,wBAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAmBpC,WAAM,GAAG,CAAC,CAAuD,EAAE,EAAE;;YAEnE,MAAM,OAAO,GAAG,CAAC,CAAC,MAAa,CAAC;YAGhC,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YAE9C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;gBAClC,OAAO;aACR;YAED,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,eAAe,EAAE;gBACjC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,EAAE;oBACnF,OAAO;iBACR;gBACD,MAAM,kBAAkB,GAAG,IAAI,CAAC,qB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OAAO,EAAE,IAAI,CAAC,MAAa,CAAC,CAAC;IACzD,CAAC;;AA5TM,6BAAa,GAAY;IAC9B,OAAO,EAAE,GAAG;CACb,CAAC;AAZS,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAuU3B;AAvUY,0CAAe","file":"scrollbar-plugin.js","sourcesContent":["import type { IGraphic, IGroup, IPlugin, IPluginService } from '@visactor/vrender-core';\nimport { Generator, injectable } from '@visactor/vrender-core';\nimport { ScrollBar } from './scrollbar';\nimport type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds, abs, Bounds } from '@visactor/vutils';\nimport { SCROLLBAR_EVENT } from '../constant';\nimport type { ScrollBarAttributes } from './type';\n\n// _showPoptip: 0-没有,1-添加,2-删除\n\ntype IParams = {\n timeout?: number; // 消失的timeout\n bufferV?: number; // 判定是否出现滚动条的buffer\n bufferH?: number; // 判定是否出现滚动条的buffer\n};\n\n@injectable()\nexport class ScrollBarPlugin implements IPlugin {\n name: 'scrollbar' = 'scrollbar';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n scrollContainer?: { g: IGroup; showH: boolean; showV: boolean };\n scrollContainerBounds: IAABBBounds;\n childrenBounds: IAABBBounds;\n\n static defaultParams: IParams = {\n timeout: 500\n };\n\n params: IParams;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const { stage } = this.pluginService;\n\n this.childrenBounds = new AABBBounds();\n stage.addEventListener('wheel', this.scroll as any);\n this.params = ScrollBarPlugin.defaultParams;\n }\n scroll = (e: { deltaX: number; deltaY: number; target: IGraphic }) => {\n // 计算子元素的bounds\n const graphic = e.target as any;\n // childrenBounds.set(0, 0, scrollContainer.AABBBounds.width(), scrollContainer.AABBBounds.height());\n\n const data = this.getScrollContainer(graphic);\n\n if (!data && !this.scrollContainer) {\n return;\n }\n\n if (!data && this.scrollContainer) {\n if (!this.scrollContainer.g.stage || this.scrollContainer.g.stage !== graphic.stage) {\n return;\n }\n const newScrollContainer = this.formatScrollContainer(this.scrollContainer.g);\n\n if (!newScrollContainer) {\n this.clearScrollbar(this.scrollContainer.g, 'all');\n // 删除老的scrollbar\n return;\n }\n if (this.scrollContainer.showH && !newScrollContainer.showH) {\n this.clearScrollbar(this.scrollContainer.g, 'horizontal');\n }\n\n if (this.scrollContainer.showV && !newScrollContainer.showV) {\n this.clearScrollbar(this.scrollContainer.g, 'vertical');\n }\n\n this.scrollContainer = newScrollContainer;\n } else if (data && this.scrollContainer && data.g !== this.scrollContainer.g) {\n this.clearScrollbar(this.scrollContainer.g, 'all');\n }\n\n this.scrollContainer = data ?? this.scrollContainer;\n if (!data) {\n return;\n }\n const scrollContainer = data.g;\n if (!scrollContainer) {\n return;\n }\n const { width, height, scrollX = 0, scrollY = 0 } = scrollContainer.attribute;\n let newScrollX = scrollX;\n let newScrollY = scrollY;\n let { showH, showV } = data;\n this.scrollContainerBounds = new Bounds().set(\n 0,\n 0,\n scrollContainer.attribute.width,\n scrollContainer.attribute.height\n );\n if (showH && showH) {\n if (abs(e.deltaX) > abs(e.deltaY)) {\n showH = showH && true;\n showV = showV && false;\n } else {\n showH = showH && false;\n showV = showV && true;\n }\n }\n\n const scrollWidth = this.childrenBounds.width();\n const scrollHeight = this.childrenBounds.height();\n\n if (showH) {\n newScrollX = scrollX - (e.deltaX ?? 0);\n if (newScrollX > 0) {\n newScrollX = 0;\n } else if (newScrollX < width - scrollWidth) {\n newScrollX = width - scrollWidth;\n }\n }\n\n if (showV) {\n newScrollY = scrollY - (e.deltaY ?? 0);\n if (newScrollY > 0) {\n newScrollY = 0;\n } else if (newScrollY < height - scrollHeight) {\n newScrollY = height - scrollHeight;\n }\n }\n\n scrollContainer.setAttributes({\n scrollX: newScrollX,\n scrollY: newScrollY\n });\n this.addOrUpdateScroll(showH, showV, scrollContainer.parent, scrollContainer);\n };\n\n handleScrollBarChange = (params: any) => {\n if (\n !this.scrollContainer ||\n !this.scrollContainerBounds ||\n !this.childrenBounds ||\n !params ||\n !params.target ||\n !params.detail ||\n !params.detail.value\n ) {\n return;\n }\n const scrollbar = params.target;\n const newRange = params.detail.value;\n\n if (scrollbar.attribute.direction === 'horizontal') {\n const scrollWidth = this.childrenBounds.width();\n\n this.scrollContainer.g.setAttributes({ scrollX: -newRange[0] * scrollWidth });\n } else {\n const scrollHeight = this.childrenBounds.height();\n\n this.scrollContainer.g.setAttributes({ scrollY: -newRange[0] * scrollHeight });\n }\n };\n\n initEventOfScrollbar(scrollContainer: IGroup, scrollbar: IGroup, isHorozntal?: boolean) {\n scrollContainer.addEventListener('pointerover', () => {\n scrollbar.setAttribute('visibleAll', true);\n });\n scrollContainer.addEventListener('pointermove', () => {\n scrollbar.setAttribute('visibleAll', true);\n });\n scrollContainer.addEventListener('pointerout', () => {\n scrollbar.setAttribute('visibleAll', false);\n });\n scrollbar.addEventListener('pointerover', () => {\n scrollbar.setAttribute('visibleAll', true);\n });\n scrollbar.addEventListener('pointerout', () => {\n scrollbar.setAttribute('visibleAll', true);\n });\n\n scrollbar.addEventListener('scrollUp', this.handleScrollBarChange);\n scrollbar.addEventListener(SCROLLBAR_EVENT, this.handleScrollBarChange);\n }\n\n addOrUpdateScroll(showH: boolean, showV: boolean, container: IGroup, scrollContainer: IGroup) {\n if (showH) {\n const { scrollBar: hScrollbar, isUpdate } = this.addOrUpdateHScroll(scrollContainer, container, true);\n\n if (!isUpdate) {\n this.initEventOfScrollbar(scrollContainer, hScrollbar, true);\n }\n } else {\n this.clearScrollbar(scrollContainer, 'horizontal');\n }\n if (showV) {\n const { scrollBar: vScrollbar, isUpdate } = this.addOrUpdateHScroll(scrollContainer, container, false);\n\n if (!isUpdate) {\n this.initEventOfScrollbar(scrollContainer, vScrollbar, false);\n }\n } else {\n this.clearScrollbar(scrollContainer, 'vertical');\n }\n }\n\n getDirection(isHorozntal?: boolean) {\n return isHorozntal ? 'horizontal' : 'vertical';\n }\n\n addOrUpdateHScroll(scrollContainer: IGroup, container: IGroup, isHorozntal?: boolean) {\n const direction = this.getDirection(isHorozntal);\n const name = `${scrollContainer.name ?? scrollContainer._uid}_${this.getDirection(isHorozntal)}_${this.name}`;\n const scrollbars = container.children.filter((g: ScrollBar) => g.name === name);\n let isUpdate = true;\n let scrollBar = scrollbars[0] as ScrollBar;\n\n const { y = 0, dy = 0, x = 0, dx = 0, height, width, zIndex = 0 } = this.scrollContainer.g.attribute;\n const attrs: Partial<ScrollBarAttributes> = {\n x: 0,\n y: 0,\n direction,\n zIndex: zIndex + 1,\n visibleAll: true,\n padding: [2, 0],\n railStyle: {\n fill: 'rgba(0, 0, 0, .1)'\n },\n range: [0, 0.05]\n };\n\n if (isHorozntal) {\n attrs.width = this.scrollContainerBounds.width();\n attrs.height = 12;\n } else {\n attrs.height = this.scrollContainerBounds.height();\n attrs.width = 12;\n }\n\n if (!scrollBar) {\n isUpdate = false;\n\n scrollBar = new ScrollBar(attrs as ScrollBarAttributes);\n scrollBar.name = name;\n container.add(scrollBar);\n (scrollBar as any).isScrollBar = true;\n } else if (scrollbars.length > 1) {\n scrollbars.forEach((child: IGraphic, index: number) => {\n if (index) {\n child.parent?.removeChild(child);\n }\n });\n }\n const childrenBounds = this.childrenBounds;\n\n const { scrollX, scrollY } = scrollContainer.attribute;\n if (isHorozntal) {\n const ratio = Math.min(this.scrollContainerBounds.width() / childrenBounds.width(), 1);\n const start = Math.max(Math.min(scrollX / this.childrenBounds.width(), 0), ratio - 1);\n attrs.x = x + dx;\n attrs.y = y + dy + height - (attrs.height ?? 0);\n attrs.range = [-start, -start + ratio];\n } else {\n const ratio = Math.min(this.scrollContainerBounds.height() / childrenBounds.height(), 1);\n const start = Math.max(Math.min(scrollY / this.childrenBounds.height(), 0), ratio - 1);\n attrs.x = x + dx + width - this.scrollContainerBounds.width();\n attrs.y = y + dy;\n attrs.range = [-start, -start + ratio];\n }\n\n scrollBar.setAttributes(attrs);\n return {\n scrollBar,\n isUpdate\n };\n }\n\n clearScrollbar(scrollContainer: IGroup, type: 'horizontal' | 'vertical' | 'all') {\n if (!scrollContainer.parent) {\n return;\n }\n const scrollbarBars = scrollContainer.parent.children.filter((child: IGroup) => {\n return (child as any).isScrollBar && (type === 'all' || (child.attribute as any).direction === type);\n });\n\n scrollbarBars.forEach((child: IGraphic) => {\n child.parent.removeChild(child);\n });\n }\n\n formatScrollContainer(g: IGraphic) {\n if (!g || g.type !== 'group' || !g.attribute) {\n return null;\n }\n\n const { overflow, width, height } = (g as IGroup).attribute;\n\n if (!overflow || overflow === 'hidden') {\n return null;\n }\n\n let showH = false;\n let showV = false;\n\n if (overflow === 'scroll') {\n showH = true;\n showV = true;\n } else {\n showH = overflow === 'scroll-x';\n showV = !showH;\n }\n\n const childrenBounds = this.childrenBounds;\n\n childrenBounds.clear();\n g.forEachChildren((g: IGraphic) => {\n childrenBounds.union(g.AABBBounds);\n });\n\n if (!g.AABBBounds.empty()) {\n if (showH) {\n showH = width < childrenBounds.width();\n }\n\n if (showV) {\n showV = height < childrenBounds.height();\n }\n }\n\n return showH || showV ? { g: g as IGroup, showH, showV } : null;\n }\n\n // 获取响应滚动的元素\n getScrollContainer(graphic: IGraphic): { g: IGroup; showH: boolean; showV: boolean } | null {\n let g = graphic;\n while (g) {\n const res = this.formatScrollContainer(g);\n\n if (res) {\n return res;\n }\n g = g.parent;\n }\n return null;\n }\n\n deactivate(context: IPluginService): void {\n const { stage } = this.pluginService;\n stage.removeEventListener('wheel', this.scroll as any);\n }\n}\n"]}
package/dist/index.es.js CHANGED
@@ -572,6 +572,7 @@ class SyncHook extends Hook {
572
572
 
573
573
  const EnvContribution = Symbol.for("EnvContribution");
574
574
  const VGlobal = Symbol.for("VGlobal");
575
+ const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
575
576
 
576
577
  var __decorate$P = undefined && undefined.__decorate || function (decorators, target, key, desc) {
577
578
  var d,
@@ -2547,7 +2548,7 @@ const DIRECTION_KEY = {
2547
2548
  };
2548
2549
  const defaultFormatting = {
2549
2550
  fontSize: 16,
2550
- fontFamily: "sans-serif",
2551
+ fontFamily: DEFAULT_TEXT_FONT_FAMILY$1,
2551
2552
  fill: !0,
2552
2553
  stroke: !1,
2553
2554
  fontWeight: "normal",
@@ -2573,7 +2574,7 @@ const setTextStyle = (ctx, character) => {
2573
2574
  fontStyle: character.fontStyle || "",
2574
2575
  fontWeight: character.fontWeight || "",
2575
2576
  fontSize: fontSize,
2576
- fontFamily: character.fontFamily || "sans-serif"
2577
+ fontFamily: character.fontFamily
2577
2578
  });
2578
2579
  };
2579
2580
  function applyFillStyle(ctx, character, b) {
@@ -3619,19 +3620,19 @@ class Node extends EventEmitter {
3619
3620
  }
3620
3621
  insertBefore(newNode, referenceNode) {
3621
3622
  if (!referenceNode) return this.appendChild(newNode);
3622
- if (this._uid === newNode._uid) return null;
3623
+ if (this === newNode || newNode === referenceNode) return null;
3623
3624
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
3624
3625
  return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, newNode._prev = referenceNode._prev, referenceNode._prev ? referenceNode._prev._next = newNode : this._firstChild = newNode, referenceNode._prev = newNode, newNode._next = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
3625
3626
  }
3626
3627
  insertAfter(newNode, referenceNode) {
3627
3628
  if (!referenceNode) return this.appendChild(newNode);
3628
- if (this._uid === newNode._uid) return null;
3629
+ if (this === newNode || newNode === referenceNode) return null;
3629
3630
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");
3630
3631
  return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, referenceNode._next ? (referenceNode._next._prev = newNode, newNode._next = referenceNode._next) : this._lastChild = newNode, referenceNode._next = newNode, newNode._prev = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
3631
3632
  }
3632
3633
  insertInto(newNode, idx) {
3633
3634
  if (!this._ignoreWarn && this._nodeList && Logger.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"), idx >= this.childrenCount) return this.appendChild(newNode);
3634
- if (this._uid === newNode._uid) return null;
3635
+ if (this === newNode) return null;
3635
3636
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
3636
3637
  if (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, 0 === idx) newNode._next = this._firstChild, this._firstChild && (this._firstChild._prev = newNode), newNode._prev = null, this._firstChild = newNode;else {
3637
3638
  let child = this._firstChild;
@@ -5896,14 +5897,21 @@ class Group extends Graphic {
5896
5897
  width: width,
5897
5898
  height: height,
5898
5899
  path: path,
5899
- clip = groupTheme.clip,
5900
- display: display
5900
+ clip = groupTheme.clip
5901
5901
  } = attribute;
5902
- return path && path.length ? path.forEach(g => {
5902
+ if (path && path.length ? path.forEach(g => {
5903
5903
  aabbBounds.union(g.AABBBounds);
5904
- }) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), clip || this.forEachChildren(node => {
5905
- aabbBounds.union(node.AABBBounds);
5906
- }), application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
5904
+ }) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), !clip) {
5905
+ this.forEachChildren(node => {
5906
+ aabbBounds.union(node.AABBBounds);
5907
+ });
5908
+ const {
5909
+ scrollX = 0,
5910
+ scrollY = 0
5911
+ } = attribute;
5912
+ aabbBounds.translate(scrollX, scrollY);
5913
+ }
5914
+ return application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
5907
5915
  }
5908
5916
  doUpdateAABBBounds() {
5909
5917
  this.updateAABBBoundsStamp++;
@@ -7793,7 +7801,7 @@ function drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offse
7793
7801
  originP2: originP2
7794
7802
  } = curve;
7795
7803
  let validP;
7796
- if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
7804
+ if (originP1 && !1 !== originP1.defined && !lastCurve ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
7797
7805
  newDefined0 = !defined0;
7798
7806
  const x = validP ? validP.x : curve.p0.x,
7799
7807
  y = validP ? validP.y : curve.p0.y;
@@ -11477,7 +11485,7 @@ class Wrapper {
11477
11485
  }
11478
11486
  }
11479
11487
 
11480
- const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
11488
+ const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", "fontFamily", "fontStyle", "fontWeight", "lineWidth", "opacity", "fillOpacity", "strokeOpacity", ...GRAPHIC_UPDATE_TAG_KEY];
11481
11489
  class RichText extends Graphic {
11482
11490
  constructor(params) {
11483
11491
  super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE, this.onBeforeAttributeUpdate = (val, attributes, key) => {
@@ -12700,21 +12708,33 @@ let DefaultDrawContribution = class {
12700
12708
  const renderer = this.getRenderContribution(graphic);
12701
12709
  if (!renderer) return;
12702
12710
  let tempBounds,
12703
- retrans = !1;
12711
+ retrans = this.scrollMatrix && (0 !== this.scrollMatrix.e || 0 !== this.scrollMatrix.f);
12704
12712
  if (graphic.parent) {
12705
12713
  const {
12706
12714
  scrollX = 0,
12707
12715
  scrollY = 0
12708
12716
  } = graphic.parent.attribute;
12709
- if (retrans = !(!scrollX && !scrollY), retrans) {
12710
- tempBounds = this.dirtyBounds.clone();
12711
- const m = graphic.globalTransMatrix.getInverse();
12712
- this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(m), this.dirtyBounds.translate(-scrollX, -scrollY);
12717
+ (scrollX || scrollY) && (retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0)), this.scrollMatrix.translate(-scrollX, -scrollY));
12718
+ }
12719
+ if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)), this.useDirtyBounds && !graphic.isContainer && !isRectIntersect(graphic.AABBBounds, null != tempBounds ? tempBounds : this.dirtyBounds, !1)) {
12720
+ if (retrans && graphic.parent) {
12721
+ const {
12722
+ scrollX = 0,
12723
+ scrollY = 0
12724
+ } = graphic.parent.attribute;
12725
+ this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);
12713
12726
  }
12727
+ return;
12714
12728
  }
12715
- if (this.useDirtyBounds && !graphic.isContainer && !isRectIntersect(graphic.AABBBounds, this.dirtyBounds, !1)) return void (retrans && this.dirtyBounds.copy(tempBounds));
12716
12729
  const skipDraw = null != drawContext.startAtId && graphic._uid !== drawContext.startAtId;
12717
- if (graphic._uid === drawContext.startAtId && (drawContext.startAtId = null), params && (params.skipDraw = skipDraw), skipDraw ? graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params) : renderer.draw(graphic, this.currentRenderService, drawContext, params), retrans && this.dirtyBounds.copy(tempBounds), this.InterceptorContributions.length) for (let i = 0; i < this.InterceptorContributions.length; i++) {
12730
+ if (graphic._uid === drawContext.startAtId && (drawContext.startAtId = null), params && (params.skipDraw = skipDraw), skipDraw ? graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params) : renderer.draw(graphic, this.currentRenderService, drawContext, params), retrans && graphic.parent) {
12731
+ const {
12732
+ scrollX = 0,
12733
+ scrollY = 0
12734
+ } = graphic.parent.attribute;
12735
+ this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);
12736
+ }
12737
+ if (this.InterceptorContributions.length) for (let i = 0; i < this.InterceptorContributions.length; i++) {
12718
12738
  const drawContribution = this.InterceptorContributions[i];
12719
12739
  if (drawContribution.afterDrawItem && drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) return;
12720
12740
  }
@@ -14599,7 +14619,13 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
14599
14619
  this.clearScrollbar(this.scrollContainer.g, 'all');
14600
14620
  }
14601
14621
  this.scrollContainer = data !== null && data !== void 0 ? data : this.scrollContainer;
14622
+ if (!data) {
14623
+ return;
14624
+ }
14602
14625
  const scrollContainer = data.g;
14626
+ if (!scrollContainer) {
14627
+ return;
14628
+ }
14603
14629
  const { width, height, scrollX = 0, scrollY = 0 } = scrollContainer.attribute;
14604
14630
  let newScrollX = scrollX;
14605
14631
  let newScrollY = scrollY;
@@ -14615,29 +14641,31 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
14615
14641
  showV = showV && true;
14616
14642
  }
14617
14643
  }
14618
- const childrenBounds = this.childrenBounds;
14619
- childrenBounds.clear();
14620
- childrenBounds.set(0, 0, scrollContainer.AABBBounds.width(), scrollContainer.AABBBounds.height());
14621
- const scrollWidth = childrenBounds.width();
14622
- const scrollHeight = childrenBounds.height();
14644
+ const scrollWidth = this.childrenBounds.width();
14645
+ const scrollHeight = this.childrenBounds.height();
14623
14646
  if (showH) {
14624
- newScrollX = Math.max(Math.min(((_a = e.deltaX) !== null && _a !== void 0 ? _a : 0) - scrollX, scrollWidth - width), 0);
14625
- }
14626
- else {
14627
- newScrollX = -scrollX;
14647
+ newScrollX = scrollX - ((_a = e.deltaX) !== null && _a !== void 0 ? _a : 0);
14648
+ if (newScrollX > 0) {
14649
+ newScrollX = 0;
14650
+ }
14651
+ else if (newScrollX < width - scrollWidth) {
14652
+ newScrollX = width - scrollWidth;
14653
+ }
14628
14654
  }
14629
14655
  if (showV) {
14630
- newScrollY = Math.max(Math.min(((_b = e.deltaY) !== null && _b !== void 0 ? _b : 0) - scrollY, scrollHeight - height), 0);
14631
- }
14632
- else {
14633
- newScrollY = -scrollY;
14656
+ newScrollY = scrollY - ((_b = e.deltaY) !== null && _b !== void 0 ? _b : 0);
14657
+ if (newScrollY > 0) {
14658
+ newScrollY = 0;
14659
+ }
14660
+ else if (newScrollY < height - scrollHeight) {
14661
+ newScrollY = height - scrollHeight;
14662
+ }
14634
14663
  }
14635
- childrenBounds.translate(-newScrollX, -newScrollY);
14636
- this.addOrUpdateScroll(showH, showV, scrollContainer.parent, scrollContainer);
14637
14664
  scrollContainer.setAttributes({
14638
- scrollX: -newScrollX,
14639
- scrollY: -newScrollY
14665
+ scrollX: newScrollX,
14666
+ scrollY: newScrollY
14640
14667
  });
14668
+ this.addOrUpdateScroll(showH, showV, scrollContainer.parent, scrollContainer);
14641
14669
  };
14642
14670
  this.handleScrollBarChange = (params) => {
14643
14671
  if (!this.scrollContainer ||
@@ -14711,7 +14739,7 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
14711
14739
  return isHorozntal ? 'horizontal' : 'vertical';
14712
14740
  }
14713
14741
  addOrUpdateHScroll(scrollContainer, container, isHorozntal) {
14714
- var _a;
14742
+ var _a, _b;
14715
14743
  const direction = this.getDirection(isHorozntal);
14716
14744
  const name = `${(_a = scrollContainer.name) !== null && _a !== void 0 ? _a : scrollContainer._uid}_${this.getDirection(isHorozntal)}_${this.name}`;
14717
14745
  const scrollbars = container.children.filter((g) => g.name === name);
@@ -14754,16 +14782,17 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
14754
14782
  });
14755
14783
  }
14756
14784
  const childrenBounds = this.childrenBounds;
14785
+ const { scrollX, scrollY } = scrollContainer.attribute;
14757
14786
  if (isHorozntal) {
14758
14787
  const ratio = Math.min(this.scrollContainerBounds.width() / childrenBounds.width(), 1);
14759
- const start = Math.max(Math.min(this.childrenBounds.x1 / this.childrenBounds.width(), 0), ratio - 1);
14788
+ const start = Math.max(Math.min(scrollX / this.childrenBounds.width(), 0), ratio - 1);
14760
14789
  attrs.x = x + dx;
14761
- attrs.y = y + dy + height - this.scrollContainerBounds.height();
14790
+ attrs.y = y + dy + height - ((_b = attrs.height) !== null && _b !== void 0 ? _b : 0);
14762
14791
  attrs.range = [-start, -start + ratio];
14763
14792
  }
14764
14793
  else {
14765
14794
  const ratio = Math.min(this.scrollContainerBounds.height() / childrenBounds.height(), 1);
14766
- const start = Math.max(Math.min(this.childrenBounds.y1 / this.childrenBounds.height(), 0), ratio - 1);
14795
+ const start = Math.max(Math.min(scrollY / this.childrenBounds.height(), 0), ratio - 1);
14767
14796
  attrs.x = x + dx + width - this.scrollContainerBounds.width();
14768
14797
  attrs.y = y + dy;
14769
14798
  attrs.range = [-start, -start + ratio];
@@ -14803,12 +14832,17 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
14803
14832
  showH = overflow === 'scroll-x';
14804
14833
  showV = !showH;
14805
14834
  }
14835
+ const childrenBounds = this.childrenBounds;
14836
+ childrenBounds.clear();
14837
+ g.forEachChildren((g) => {
14838
+ childrenBounds.union(g.AABBBounds);
14839
+ });
14806
14840
  if (!g.AABBBounds.empty()) {
14807
14841
  if (showH) {
14808
- showH = width < g.AABBBounds.width();
14842
+ showH = width < childrenBounds.width();
14809
14843
  }
14810
14844
  if (showV) {
14811
- showV = height < g.AABBBounds.height();
14845
+ showV = height < childrenBounds.height();
14812
14846
  }
14813
14847
  }
14814
14848
  return showH || showV ? { g: g, showH, showV } : null;
@@ -16242,14 +16276,19 @@ function canPlace($, bitmap, bound, checkBound = true, pad = 0) {
16242
16276
  }
16243
16277
  return !bitmap.getRange(range);
16244
16278
  }
16245
- function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0) {
16279
+ function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0, changePosition = false) {
16246
16280
  const validCandidates = candidates.filter(candidate => isValid(candidate));
16247
16281
  for (let i = 0; i < validCandidates.length; i++) {
16248
- const tempText = text.clone();
16249
- tempText.setAttributes(validCandidates[i]);
16250
- tempText.update();
16251
- if (canPlace($, bitmap, tempText.AABBBounds, clampForce, pad)) {
16252
- bitmap.setRange(boundToRange($, tempText.AABBBounds, true));
16282
+ let measureText;
16283
+ if (changePosition) {
16284
+ measureText = text;
16285
+ }
16286
+ else {
16287
+ measureText = text.clone();
16288
+ }
16289
+ measureText.setAttributes(validCandidates[i]);
16290
+ if (canPlace($, bitmap, measureText.AABBBounds, clampForce, pad)) {
16291
+ bitmap.setRange(boundToRange($, measureText.AABBBounds, true));
16253
16292
  return validCandidates[i];
16254
16293
  }
16255
16294
  }
@@ -16264,7 +16303,8 @@ function place($, bitmap, s, attrs, text, bounds, labeling) {
16264
16303
  const userPosition = isFunction(s.position) ? s.position(text.attribute) : s.position;
16265
16304
  const positions = (userPosition || defaultLabelPosition(attrs.type));
16266
16305
  const candidates = positions.map(p => labeling(text.AABBBounds, bounds, p, attrs.offset));
16267
- return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding);
16306
+ const shouldClone = s.restorePosition === false;
16307
+ return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding, shouldClone);
16268
16308
  }
16269
16309
  return false;
16270
16310
  }
@@ -16661,14 +16701,12 @@ function shiftY(texts, option) {
16661
16701
  textInformation.get(text).attempts = attempts;
16662
16702
  };
16663
16703
  function adjustPositionInOneGroup(texts) {
16664
- if (texts.length === 1) {
16665
- return;
16666
- }
16667
- for (let i = texts.length - 1; i > 0; i--) {
16704
+ for (let i = texts.length - 1; i >= 0; i--) {
16668
16705
  const curText = texts[i];
16669
16706
  const upperText = texts[i - 1];
16670
16707
  const lowerText = texts[i + 1];
16671
- if (isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText))) {
16708
+ if ((upperText && isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText))) ||
16709
+ (getY1(curText) === 0 && curText._isClamped)) {
16672
16710
  const { y } = labelling(curText);
16673
16711
  if (!lowerText || !isIntersect(y + getHeight(curText) / 2, getY1(lowerText))) {
16674
16712
  if (y + getHeight(curText) / 2 <= maxY) {
@@ -17159,10 +17197,16 @@ class LabelBase extends AbstractComponent {
17159
17197
  const text = result[i];
17160
17198
  const bounds = text.AABBBounds;
17161
17199
  const range = boundToRange(bmpTool, bounds, true);
17162
- if (canPlace(bmpTool, bitmap, bounds, clampForce, text._isClamped ? 0 : overlapPadding)) {
17200
+ if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {
17163
17201
  bitmap.setRange(range);
17164
17202
  }
17165
17203
  else {
17204
+ if (clampForce) {
17205
+ const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap);
17206
+ if (placedAfterClampForce) {
17207
+ continue;
17208
+ }
17209
+ }
17166
17210
  if (hideOnHit) {
17167
17211
  text.setAttributes({ visible: false });
17168
17212
  }
@@ -17173,6 +17217,26 @@ class LabelBase extends AbstractComponent {
17173
17217
  }
17174
17218
  return result;
17175
17219
  }
17220
+ _processClampForce(text, bmpTool, bitmap) {
17221
+ const { dy = 0, dx = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
17222
+ if (dx === 0 && dy === 0) {
17223
+ if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
17224
+ bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
17225
+ return true;
17226
+ }
17227
+ }
17228
+ else if (canPlace(bmpTool, bitmap, {
17229
+ x1: text.AABBBounds.x1 + dx,
17230
+ x2: text.AABBBounds.x2 + dx,
17231
+ y1: text.AABBBounds.y1 + dy,
17232
+ y2: text.AABBBounds.y2 + dy
17233
+ })) {
17234
+ text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
17235
+ bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
17236
+ return true;
17237
+ }
17238
+ return false;
17239
+ }
17176
17240
  _overlapByStrategy(labels, option, bmpTool, bitmap) {
17177
17241
  var _a;
17178
17242
  const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding } = option;
@@ -17232,22 +17296,8 @@ class LabelBase extends AbstractComponent {
17232
17296
  }
17233
17297
  }
17234
17298
  if (!hasPlace && clampForce) {
17235
- const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
17236
- if (dx === 0 && dy === 0) {
17237
- if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
17238
- bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
17239
- result.push(text);
17240
- continue;
17241
- }
17242
- }
17243
- else if (canPlace(bmpTool, bitmap, {
17244
- x1: text.AABBBounds.x1 + dx,
17245
- x2: text.AABBBounds.x2 + dx,
17246
- y1: text.AABBBounds.y1 + dy,
17247
- y2: text.AABBBounds.y2 + dy
17248
- })) {
17249
- text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
17250
- bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
17299
+ const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap);
17300
+ if (placedAfterClampForce) {
17251
17301
  result.push(text);
17252
17302
  continue;
17253
17303
  }
@@ -22796,11 +22846,19 @@ var IMarkAreaLabelPosition;
22796
22846
  IMarkAreaLabelPosition["right"] = "right";
22797
22847
  IMarkAreaLabelPosition["top"] = "top";
22798
22848
  IMarkAreaLabelPosition["bottom"] = "bottom";
22849
+ IMarkAreaLabelPosition["topLeft"] = "topLeft";
22850
+ IMarkAreaLabelPosition["topRight"] = "topRight";
22851
+ IMarkAreaLabelPosition["bottomLeft"] = "bottomLeft";
22852
+ IMarkAreaLabelPosition["bottomRight"] = "bottomRight";
22799
22853
  IMarkAreaLabelPosition["middle"] = "middle";
22800
22854
  IMarkAreaLabelPosition["insideLeft"] = "insideLeft";
22801
22855
  IMarkAreaLabelPosition["insideRight"] = "insideRight";
22802
22856
  IMarkAreaLabelPosition["insideTop"] = "insideTop";
22803
22857
  IMarkAreaLabelPosition["insideBottom"] = "insideBottom";
22858
+ IMarkAreaLabelPosition["insideTopLeft"] = "insideTopLeft";
22859
+ IMarkAreaLabelPosition["insideTopRight"] = "insideTopRight";
22860
+ IMarkAreaLabelPosition["insideBottomLeft"] = "insideBottomLeft";
22861
+ IMarkAreaLabelPosition["insideBottomRight"] = "insideBottomRight";
22804
22862
  })(IMarkAreaLabelPosition || (IMarkAreaLabelPosition = {}));
22805
22863
  var IMarkCommonArcLabelPosition;
22806
22864
  (function (IMarkCommonArcLabelPosition) {
@@ -23630,6 +23688,38 @@ const DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP = {
23630
23688
  middle: {
23631
23689
  textAlign: 'center',
23632
23690
  textBaseline: 'middle'
23691
+ },
23692
+ topLeft: {
23693
+ textAlign: 'right',
23694
+ textBaseline: 'top'
23695
+ },
23696
+ insideTopLeft: {
23697
+ textAlign: 'left',
23698
+ textBaseline: 'top'
23699
+ },
23700
+ topRight: {
23701
+ textAlign: 'left',
23702
+ textBaseline: 'top'
23703
+ },
23704
+ insideTopRight: {
23705
+ textAlign: 'right',
23706
+ textBaseline: 'top'
23707
+ },
23708
+ bottomLeft: {
23709
+ textAlign: 'right',
23710
+ textBaseline: 'bottom'
23711
+ },
23712
+ insideBottomLeft: {
23713
+ textAlign: 'left',
23714
+ textBaseline: 'bottom'
23715
+ },
23716
+ bottomRight: {
23717
+ textAlign: 'left',
23718
+ textBaseline: 'bottom'
23719
+ },
23720
+ insideBottomRight: {
23721
+ textAlign: 'right',
23722
+ textBaseline: 'bottom'
23633
23723
  }
23634
23724
  };
23635
23725
  const DEFAULT_MARK_POINT_THEME = {
@@ -30001,6 +30091,6 @@ EmptyTip.defaultAttributes = {
30001
30091
  }
30002
30092
  };
30003
30093
 
30004
- const version = "0.21.1-alpha.1";
30094
+ const version = "0.21.1";
30005
30095
 
30006
30096
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.21.1-alpha.1";
1
+ export declare const version = "0.21.1";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.21.1-alpha.1";
1
+ export const version = "0.21.1";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.21.1-alpha.1\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.21.1\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
@@ -50,6 +50,7 @@ export declare class LabelBase<T extends BaseLabelAttrs> extends AbstractCompone
50
50
  protected _layout(texts: (IText | IRichText)[]): (IText | IRichText)[];
51
51
  protected _overlapping(labels: (IText | IRichText)[]): (IRichText | IText)[];
52
52
  protected _overlapGlobal(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
53
+ protected _processClampForce(text: IText, bmpTool: BitmapTool, bitmap: Bitmap): boolean;
53
54
  protected _overlapByStrategy(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
54
55
  protected getBaseMarkGroup(): IGroup;
55
56
  protected getGraphicBounds(graphic?: IGraphic, point?: Partial<PointLocationCfg>, position?: string): IBoundsLike;
package/es/label/base.js CHANGED
@@ -236,12 +236,33 @@ export class LabelBase extends AbstractComponent {
236
236
  }));
237
237
  for (let i = 0; i < result.length; i++) {
238
238
  const text = result[i], bounds = text.AABBBounds, range = boundToRange(bmpTool, bounds, !0);
239
- canPlace(bmpTool, bitmap, bounds, clampForce, text._isClamped ? 0 : overlapPadding) ? bitmap.setRange(range) : hideOnHit ? text.setAttributes({
240
- visible: !1
241
- }) : bitmap.setRange(range);
239
+ if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) bitmap.setRange(range); else {
240
+ if (clampForce) {
241
+ if (this._processClampForce(text, bmpTool, bitmap)) continue;
242
+ }
243
+ hideOnHit ? text.setAttributes({
244
+ visible: !1
245
+ }) : bitmap.setRange(range);
246
+ }
242
247
  }
243
248
  return result;
244
249
  }
250
+ _processClampForce(text, bmpTool, bitmap) {
251
+ const {dy: dy = 0, dx: dx = 0} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
252
+ if (0 === dx && 0 === dy) {
253
+ if (canPlace(bmpTool, bitmap, text.AABBBounds)) return bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)),
254
+ !0;
255
+ } else if (canPlace(bmpTool, bitmap, {
256
+ x1: text.AABBBounds.x1 + dx,
257
+ x2: text.AABBBounds.x2 + dx,
258
+ y1: text.AABBBounds.y1 + dy,
259
+ y2: text.AABBBounds.y2 + dy
260
+ })) return text.setAttributes({
261
+ x: text.attribute.x + dx,
262
+ y: text.attribute.y + dy
263
+ }), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), !0;
264
+ return !1;
265
+ }
245
266
  _overlapByStrategy(labels, option, bmpTool, bitmap) {
246
267
  var _a;
247
268
  const {avoidBaseMark: avoidBaseMark, strategy: strategy = [], hideOnHit: hideOnHit = !0, clampForce: clampForce = !0, avoidMarks: avoidMarks = [], overlapPadding: overlapPadding} = option, result = [], checkBounds = strategy.some((s => "bound" === s.type));
@@ -281,22 +302,8 @@ export class LabelBase extends AbstractComponent {
281
302
  break;
282
303
  }
283
304
  if (!hasPlace && clampForce) {
284
- const {dx: dx = 0, dy: dy = 0} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
285
- if (0 === dx && 0 === dy) {
286
- if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
287
- bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
288
- continue;
289
- }
290
- } else if (canPlace(bmpTool, bitmap, {
291
- x1: text.AABBBounds.x1 + dx,
292
- x2: text.AABBBounds.x2 + dx,
293
- y1: text.AABBBounds.y1 + dy,
294
- y2: text.AABBBounds.y2 + dy
295
- })) {
296
- text.setAttributes({
297
- x: text.attribute.x + dx,
298
- y: text.attribute.y + dy
299
- }), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
305
+ if (this._processClampForce(text, bmpTool, bitmap)) {
306
+ result.push(text);
300
307
  continue;
301
308
  }
302
309
  }