Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix dropdown icon display error #766

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vtable",
"comment": "fix: fix dropdown icon display error",
"type": "none"
}
],
"packageName": "@visactor/vtable"
}
31 changes: 31 additions & 0 deletions packages/vtable/src/scenegraph/icon/icon-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,34 @@ export function updateCellRangeIcon(
updateCellGroupIcon(cellGroup, filter, dealer);
}
}

export function residentHoverIcon(col: number, row: number, scene: Scenegraph) {
updateCellRangeIcon(
col,
row,
// filter
(icon: Icon) => icon.attribute.funcType === IconFuncTypeEnum.dropDown,
// dealer
(icon: Icon) => {
(icon as any).oldVisibleTime = icon.attribute.visibleTime;
icon.setAttribute('visibleTime', 'always');
icon.setAttribute('opacity', 1);
},
scene
);
}

export function resetResidentHoverIcon(col: number, row: number, scene: Scenegraph) {
updateCellRangeIcon(
col,
row,
// filter
(icon: Icon) => icon.attribute.funcType === IconFuncTypeEnum.dropDown,
// dealer
(icon: Icon) => {
icon.setAttribute('visibleTime', (icon as any).oldVisibleTime);
icon.setAttribute('opacity', icon.attribute.visibleTime === 'always' ? 1 : 0);
},
scene
);
}
9 changes: 9 additions & 0 deletions packages/vtable/src/scenegraph/scenegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import {
getIconByXY,
hideClickIcon,
hideHoverIcon,
resetResidentHoverIcon,
residentHoverIcon,
setIconHoverStyle,
setIconNormalStyle,
showClickIcon,
Expand Down Expand Up @@ -608,6 +610,13 @@ export class Scenegraph {
setIconNormalStyle(icon, col, row, this);
}

residentHoverIcon(col: number, row: number) {
residentHoverIcon(col, row, this);
}
resetResidentHoverIcon(col: number, row: number) {
resetResidentHoverIcon(col, row, this);
}

/**
* 单元格失焦 失效该单元格对应的图表实例
* @param col
Expand Down
19 changes: 8 additions & 11 deletions packages/vtable/src/state/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,10 +833,10 @@ export class StateManager {
this.residentHoverIcon.row,
cellGroup
);
(icon as any).oldVisibleTime = icon.attribute.visibleTime;
icon.setAttribute('visibleTime', 'always');
// icon.setAttribute('visible', true);
icon.setAttribute('opacity', 1);
// (icon as any).oldVisibleTime = icon.attribute.visibleTime;
// icon.setAttribute('visibleTime', 'always');
// icon.setAttribute('opacity', 1);
this.table.scenegraph.residentHoverIcon(col, row);
}
}

Expand All @@ -851,15 +851,12 @@ export class StateManager {
this.residentHoverIcon.col,
this.residentHoverIcon.row
);
this.residentHoverIcon.icon.setAttribute('visibleTime', (this.residentHoverIcon.icon as any).oldVisibleTime);
// this.residentHoverIcon.icon.setAttribute('visibleTime', (this.residentHoverIcon.icon as any).oldVisibleTime);
// this.residentHoverIcon.icon.setAttribute(
// 'visible',
// this.residentHoverIcon.icon.attribute.visibleTime === 'always'
// 'opacity',
// this.residentHoverIcon.icon.attribute.visibleTime === 'always' ? 1 : 0
// );
this.residentHoverIcon.icon.setAttribute(
'opacity',
this.residentHoverIcon.icon.attribute.visibleTime === 'always' ? 1 : 0
);
this.table.scenegraph.resetResidentHoverIcon(this.residentHoverIcon.col, this.residentHoverIcon.row);
this.residentHoverIcon = null;
}
}
Expand Down
Loading