forked from profectus/Profectus
Fix error about pinnable tooltips
This commit is contained in:
parent
210c2290f0
commit
d6c9f95851
2 changed files with 2 additions and 13 deletions
|
@ -37,7 +37,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
color,
|
color,
|
||||||
reset
|
reset
|
||||||
}));
|
}));
|
||||||
addTooltip(treeNode, {
|
const tooltip = addTooltip(treeNode, {
|
||||||
display: createResourceTooltip(points),
|
display: createResourceTooltip(points),
|
||||||
pinnable: true
|
pinnable: true
|
||||||
});
|
});
|
||||||
|
@ -58,6 +58,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
name,
|
name,
|
||||||
color,
|
color,
|
||||||
points,
|
points,
|
||||||
|
tooltip,
|
||||||
display: jsx(() => (
|
display: jsx(() => (
|
||||||
<>
|
<>
|
||||||
<MainDisplay resource={points} color={color} />
|
<MainDisplay resource={points} color={color} />
|
||||||
|
|
|
@ -95,18 +95,6 @@ export function addTooltip<T extends TooltipOptions>(
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (options.pinnable) {
|
|
||||||
if ("pinned" in element) {
|
|
||||||
console.error(
|
|
||||||
"Cannot add pinnable tooltip to element that already has a property called 'pinned'"
|
|
||||||
);
|
|
||||||
options.pinnable = false;
|
|
||||||
deletePersistent(options.pinned as Persistent<boolean>);
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
(element as any).pinned = options.pinned;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const elementComponent = element[Component];
|
const elementComponent = element[Component];
|
||||||
element[Component] = TooltipComponent as GenericComponent;
|
element[Component] = TooltipComponent as GenericComponent;
|
||||||
const elementGatherProps = element[GatherProps].bind(element);
|
const elementGatherProps = element[GatherProps].bind(element);
|
||||||
|
|
Loading…
Reference in a new issue