Skip to content

Commit

Permalink
fix: 修复行头圈选复制时部分场景下数据重复 close #2975
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Dec 11, 2024
1 parent 0a7977c commit cfc3036
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ export class BaseBrushSelection

let newX = this.endBrushPoint?.x + x;
let newY = this.endBrushPoint?.y + y;
let needScrollForX = true;
let needScrollForY = true;
// 有滚动条才需要滚动
let needScrollForX = isRowHeader
? !!facet.hRowScrollBar
: !!facet.hScrollBar;
let needScrollForY = !!facet.vScrollBar;
const vScrollBarWidth = facet.vScrollBar?.getBBox()?.width;
// 额外加缩进,保证 getShape 在 panelBox 内
const extraPixel = 2;
Expand Down Expand Up @@ -769,18 +772,18 @@ export class BaseBrushSelection
};

public autoBrushScroll(point: PointLike, isRowHeader = false) {
if (this.isPointInCanvas(point)) {
return false;
}

this.clearAutoScroll();

if (!this.isPointInCanvas(point)) {
const deltaX = point?.x - this.endBrushPoint?.x;
const deltaY = point?.y - this.endBrushPoint?.y;
const deltaX = point?.x - this.endBrushPoint?.x;
const deltaY = point?.y - this.endBrushPoint?.y;

this.handleScroll(deltaX, deltaY, isRowHeader);
this.handleScroll(deltaX, deltaY, isRowHeader);

return true;
}

return false;
return true;
}

public emitBrushSelectionEvent(
Expand Down
13 changes: 13 additions & 0 deletions s2-site/docs/manual/migration-v2.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,19 @@ splitLine: {
}
```

#### 自定义 hook 变更

1.`layoutDataPosition` 废弃,新增 `layoutCellMeta` 用于自定义单元格元数据。

```diff
const s2Options = {
- layoutDataPosition: (s2, getCellData) => {}
+ layoutCellMeta: (cellMeta) => {}
}
```

具体请查看 [自定义单元格元数据](/examples/custom/custom-layout/#custom-layout-cell-meta) 相关示例。

### 组件层 (s2-react) <Badge>@antv/s2-react</Badge>

#### 移除 Ant Design 组件库依赖
Expand Down
10 changes: 7 additions & 3 deletions s2-site/examples/basic/pivot/demo/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ fetch(
width: 600,
height: 480,
hierarchyType: 'grid',
// 数值挂行头时, 自定义角头虚拟数值字段文本, 默认 "数值"
cornerExtraFieldText: '自定义',
interaction: {
copy: { enable: true },
withFormat: true,
withHeader: true,
copy: {
enable: true,
withFormat: true,
withHeader: true,
},
},
// 显示序号
// seriesNumber: {
Expand Down

0 comments on commit cfc3036

Please sign in to comment.