From 213bdd6005687c83cb099538ac09832ec6b3d981 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Fri, 12 May 2023 01:39:38 -0500 Subject: [PATCH] More board optimizations --- src/features/boards/Board.vue | 8 +++++--- src/features/boards/BoardNode.vue | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/features/boards/Board.vue b/src/features/boards/Board.vue index 356bca7..3a50ff1 100644 --- a/src/features/boards/Board.vue +++ b/src/features/boards/Board.vue @@ -39,9 +39,11 @@ :dragging="unref(draggingNode)" :dragged="unref(draggingNode) === node ? dragged : undefined" :hasDragged="unref(draggingNode) == null ? false : hasDragged" - :receivingNode="unref(receivingNode)?.id === node.id" - :selectedNode="unref(selectedNode)" - :selectedAction="unref(selectedAction)" + :receivingNode="unref(receivingNode) === node" + :isSelected="unref(selectedNode) === node" + :selectedAction=" + unref(selectedNode) === node ? unref(selectedAction) : null + " @mouseDown="mouseDown" @endDragging="endDragging" @clickAction="(actionId: string) => clickAction(node, actionId)" diff --git a/src/features/boards/BoardNode.vue b/src/features/boards/BoardNode.vue index 1752370..6a32f37 100644 --- a/src/features/boards/BoardNode.vue +++ b/src/features/boards/BoardNode.vue @@ -160,7 +160,7 @@ const _props = defineProps<{ }; hasDragged?: boolean; receivingNode?: boolean; - selectedNode: BoardNode | null; + isSelected: boolean; selectedAction: GenericBoardNodeAction | null; }>(); const props = toRefs(_props); @@ -170,7 +170,6 @@ const emit = defineEmits<{ (e: "clickAction", actionId: string): void; }>(); -const isSelected = computed(() => unref(props.selectedNode) === unref(props.node)); const isDraggable = computed(() => getNodeProperty(props.nodeType.value.draggable, unref(props.node)) ); @@ -211,7 +210,7 @@ const shape = computed(() => getNodeProperty(props.nodeType.value.shape, unref(p const title = computed(() => getNodeProperty(props.nodeType.value.title, unref(props.node))); const label = computed( () => - (isSelected.value + (props.isSelected.value ? unref(props.selectedAction) && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion getNodeProperty(unref(props.selectedAction)!.tooltip, unref(props.node))