Fixed createLayerTreeNode not using display option correctly

This commit is contained in:
thepaperpilot 2022-04-23 23:54:23 -05:00
parent 8520017bbd
commit 76c81dc5b5

View file

@ -133,7 +133,7 @@ export function createResetButton<T extends ClickableOptions & ResetButtonOption
export interface LayerTreeNodeOptions extends TreeNodeOptions { export interface LayerTreeNodeOptions extends TreeNodeOptions {
layerID: string; layerID: string;
color: Computable<string>; // marking as required color: Computable<string>; // marking as required
display?: Computable<string>; display?: Computable<CoercableComponent>;
append?: Computable<boolean>; append?: Computable<boolean>;
} }
export type LayerTreeNode<T extends LayerTreeNodeOptions> = Replace< export type LayerTreeNode<T extends LayerTreeNodeOptions> = Replace<
@ -146,7 +146,7 @@ export type LayerTreeNode<T extends LayerTreeNodeOptions> = Replace<
export type GenericLayerTreeNode = Replace< export type GenericLayerTreeNode = Replace<
LayerTreeNode<LayerTreeNodeOptions>, LayerTreeNode<LayerTreeNodeOptions>,
{ {
display: ProcessedComputable<string>; display: ProcessedComputable<CoercableComponent>;
append?: ProcessedComputable<boolean>; append?: ProcessedComputable<boolean>;
} }
>; >;
@ -161,7 +161,7 @@ export function createLayerTreeNode<T extends LayerTreeNodeOptions>(
processComputable(options as T, "append"); processComputable(options as T, "append");
return { return {
...options, ...options,
display: options.layerID, display: options.display,
onClick: unref((options as unknown as GenericLayerTreeNode).append) onClick: unref((options as unknown as GenericLayerTreeNode).append)
? function () { ? function () {
if (player.tabs.includes(options.layerID)) { if (player.tabs.includes(options.layerID)) {