More board optimizations

This commit is contained in:
thepaperpilot 2023-05-12 01:39:38 -05:00
parent 16c3b44094
commit 0033b4a7c9
3 changed files with 7 additions and 7 deletions

View file

@ -20,7 +20,6 @@ export const resourceLevelFormula = Formula.variable(0)
.step(100, x => x.pow(1.5)) .step(100, x => x.pow(1.5))
.step(Decimal.pow(900, 1.5).add(100), x => x.pow(1.5)) .step(Decimal.pow(900, 1.5).add(100), x => x.pow(1.5))
.pow(1.5); .pow(1.5);
console.log(resourceLevelFormula);
export const deselectAllAction = { export const deselectAllAction = {
id: "deselect", id: "deselect",

View file

@ -39,9 +39,11 @@
:dragging="unref(draggingNode)" :dragging="unref(draggingNode)"
:dragged="unref(draggingNode) === node ? dragged : undefined" :dragged="unref(draggingNode) === node ? dragged : undefined"
:hasDragged="unref(draggingNode) == null ? false : hasDragged" :hasDragged="unref(draggingNode) == null ? false : hasDragged"
:receivingNode="unref(receivingNode)?.id === node.id" :receivingNode="unref(receivingNode) === node"
:selectedNode="unref(selectedNode)" :isSelected="unref(selectedNode) === node"
:selectedAction="unref(selectedAction)" :selectedAction="
unref(selectedNode) === node ? unref(selectedAction) : null
"
@mouseDown="mouseDown" @mouseDown="mouseDown"
@endDragging="endDragging" @endDragging="endDragging"
@clickAction="(actionId: string) => clickAction(node, actionId)" @clickAction="(actionId: string) => clickAction(node, actionId)"

View file

@ -163,7 +163,7 @@ const _props = defineProps<{
}; };
hasDragged?: boolean; hasDragged?: boolean;
receivingNode?: boolean; receivingNode?: boolean;
selectedNode: BoardNode | null; isSelected: boolean;
selectedAction: GenericBoardNodeAction | null; selectedAction: GenericBoardNodeAction | null;
}>(); }>();
const props = toRefs(_props); const props = toRefs(_props);
@ -173,7 +173,6 @@ const emit = defineEmits<{
(e: "clickAction", actionId: string): void; (e: "clickAction", actionId: string): void;
}>(); }>();
const isSelected = computed(() => unref(props.selectedNode) === unref(props.node));
const isDraggable = computed(() => const isDraggable = computed(() =>
getNodeProperty(props.nodeType.value.draggable, unref(props.node)) getNodeProperty(props.nodeType.value.draggable, unref(props.node))
); );
@ -215,7 +214,7 @@ const title = computed(() => getNodeProperty(props.nodeType.value.title, unref(p
const subtitle = computed(() => getNodeProperty(props.nodeType.value.subtitle, unref(props.node))); const subtitle = computed(() => getNodeProperty(props.nodeType.value.subtitle, unref(props.node)));
const label = computed( const label = computed(
() => () =>
(isSelected.value (props.isSelected.value
? unref(props.selectedAction) && ? unref(props.selectedAction) &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
getNodeProperty(unref(props.selectedAction)!.tooltip, unref(props.node)) getNodeProperty(unref(props.selectedAction)!.tooltip, unref(props.node))