mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-20 16:49:52 +00:00
Remeasure the offset when whe change selection state.
This commit is contained in:
parent
912a570101
commit
95db2d08b6
1 changed files with 7 additions and 5 deletions
|
|
@ -48,13 +48,15 @@ function ContextMenuTarget(props: Props) {
|
|||
return () => {
|
||||
document.removeEventListener("click", handleGlobalClick);
|
||||
};
|
||||
// eslint-disable-next-line
|
||||
}, [selected, handleNode.current]);
|
||||
}, [selected]);
|
||||
|
||||
const offset = useMemo(() => {
|
||||
return getNodeOffset(handleNode.current);
|
||||
// eslint-disable-next-line
|
||||
}, [handleNode.current]);
|
||||
return selected
|
||||
? getNodeOffset(handleNode.current)
|
||||
: // Kinda awkward. This is a nonsense return value since we only use
|
||||
//this value when we are selected.
|
||||
{ top: 0, left: 0 };
|
||||
}, [selected]);
|
||||
|
||||
const { handle, children, top, bottom, ...passThroughProps } = props;
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue