-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
7 changed files
with
131 additions
and
5 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@visactor/vtable/feat-custom-select_2024-11-19-09-29.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@visactor/vtable", | ||
"comment": "feat: add setCustomSelectRanges in stateManager #2750 #2845", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@visactor/vtable" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/vtable/src/scenegraph/select/update-select-style.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { IRect, IRectGraphicAttribute } from '@src/vrender'; | ||
import type { Scenegraph } from '../scenegraph'; | ||
|
||
// for fs big screen | ||
export function temporarilyUpdateSelectRectStyle(rectAttribute: IRectGraphicAttribute, scene: Scenegraph) { | ||
const { selectedRangeComponents } = scene; | ||
selectedRangeComponents.forEach((selectComp: { rect: IRect }, key: string) => { | ||
selectComp.rect.setAttributes(rectAttribute); | ||
}); | ||
scene.updateNextFrame(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { CustomSelectionStyle, StateManager } from '../state'; | ||
import type { CellRange } from '../../ts-types'; | ||
import type { IRect, IRectGraphicAttribute } from '@visactor/vrender-core'; | ||
import { createRect } from '@visactor/vrender-core'; | ||
import { updateAllSelectComponent } from '../../scenegraph/select/update-select-border'; | ||
import type { Scenegraph } from '../../scenegraph/scenegraph'; | ||
|
||
export function deletaCustomSelectRanges(state: StateManager) { | ||
const { customSelectedRangeComponents } = state.table.scenegraph; | ||
// delete graphic | ||
customSelectedRangeComponents.forEach((selectComp: { rect: IRect }, key: string) => { | ||
selectComp.rect.delete(); | ||
}); | ||
customSelectedRangeComponents.clear(); | ||
state.select.customSelectRanges = []; | ||
} | ||
|
||
export function addCustomSelectRanges( | ||
customSelectRanges: { | ||
range: CellRange; | ||
style: CustomSelectionStyle; | ||
}[], | ||
state: StateManager | ||
) { | ||
const { customSelectedRangeComponents } = state.table.scenegraph; | ||
customSelectRanges.forEach((customRange: { range: CellRange; style: CustomSelectionStyle }) => { | ||
const { range, style } = customRange; | ||
const rect = createRect({ | ||
fill: style.cellBgColor ?? false, | ||
stroke: style.cellBorderColor ?? false, | ||
lineWidth: style.cellBorderLineWidth ?? 0, | ||
lineDash: style.cellBorderLineDash ?? [], | ||
pickable: false | ||
}); | ||
customSelectedRangeComponents.set(`${range.start.col}-${range.start.row}-${range.end.col}-${range.end.row}`, { | ||
rect, | ||
role: 'body' | ||
}); | ||
}); | ||
state.select.customSelectRanges = customSelectRanges; | ||
updateAllSelectComponent(state.table.scenegraph); | ||
state.table.scenegraph.updateNextFrame(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters