From 8c3fda47779d49649776a16e55829f20793004f9 Mon Sep 17 00:00:00 2001 From: dxq613 Date: Thu, 19 Mar 2020 15:15:22 +0800 Subject: [PATCH] feat(tooltip): auto tooltip, update g version --- package.json | 6 +++--- src/geometry/label/interface.ts | 4 ++-- src/index.ts | 2 +- src/theme/default.ts | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 011a43abcd..34c022c623 100644 --- a/package.json +++ b/package.json @@ -40,9 +40,9 @@ "@antv/component": "^0.5.0", "@antv/coord": "^0.2.1", "@antv/event-emitter": "~0.1.0", - "@antv/g-base": "^0.3.1", - "@antv/g-canvas": "^0.3.1", - "@antv/g-svg": "^0.3.1", + "@antv/g-base": "^0.4.0", + "@antv/g-canvas": "^0.4.0", + "@antv/g-svg": "^0.4.0", "@antv/matrix-util": "^2.0.4", "@antv/path-util": "^2.0.3", "@antv/scale": "^0.3.1", diff --git a/src/geometry/label/interface.ts b/src/geometry/label/interface.ts index 98b4661168..6efec0a937 100644 --- a/src/geometry/label/interface.ts +++ b/src/geometry/label/interface.ts @@ -16,7 +16,7 @@ export interface LabelPointCfg { start?: Point; color?: string; content?: any; - textAlign?: string; + textAlign?: 'start' | 'center' | 'end' | 'left' | 'right'; rotate?: number; angle?: number; r?: number; @@ -32,7 +32,7 @@ export interface LabelItem extends GeometryLabelCfg { start?: Point; color?: string; content?: any; - textAlign?: string; + textAlign?: 'start' | 'center' | 'end' | 'left' | 'right'; rotate?: number; angle?: number; r?: number; diff --git a/src/index.ts b/src/index.ts index bf01425919..39842e67c7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -264,7 +264,7 @@ function isPointInView(context: IInteractionContext) { // 注册 tooltip 的 interaction registerInteraction('tooltip', { - start: [{ trigger: 'plot:mousemove', action: 'tooltip:show' }], + start: [{ trigger: 'plot:mousemove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } }], end: [{ trigger: 'plot:mouseleave', action: 'tooltip:hide' }], }); diff --git a/src/theme/default.ts b/src/theme/default.ts index dc74eb6e88..836f6e5c63 100644 --- a/src/theme/default.ts +++ b/src/theme/default.ts @@ -1041,6 +1041,7 @@ export function getThemeByStylesheet(styleSheet: StyleSheet) { showMarkers: true, shared: false, enterable: false, + position: 'auto', marker: { symbol: 'circle', stroke: '#fff',