Fixed visual glitch with filling 1 space slot with 0 cost filler

This commit is contained in:
Stefan Zermatten
2023-06-07 11:55:31 +02:00
parent 6291071e0d
commit d4e5a2a529

View File

@@ -43,7 +43,7 @@
{{ node.name }} {{ node.name }}
</span> </span>
<fill-slot-button <fill-slot-button
v-if="(node.quantityExpected && node.quantityExpected.value === 1) && node.spaceLeft === 1" v-if="canFillWithOne"
:model="node" :model="node"
/> />
</div> </div>
@@ -175,7 +175,8 @@ export default {
this.children.length === 1 && this.children.length === 1 &&
this.children[0].node.type !== 'propertySlot' && this.children[0].node.type !== 'propertySlot' &&
this.node.quantityExpected && this.node.quantityExpected &&
this.node.quantityExpected.value === 1; this.node.quantityExpected.value === 1 &&
!this.canFill;
}, },
isSlot(){ isSlot(){
return this.node.type === 'propertySlot'; return this.node.type === 'propertySlot';
@@ -185,15 +186,18 @@ export default {
}, },
canFillWithOne(){ canFillWithOne(){
return this.isSlot && return this.isSlot &&
this.node.quantityExpected && this.canFill &&
this.node.quantityExpected &&
this.node.quantityExpected.value === 1 && this.node.quantityExpected.value === 1 &&
this.node.spaceLeft === 1 this.node.spaceLeft === 1 &&
!this.children?.length;
}, },
canFillWithMany(){ canFillWithMany(){
return this.isSlot && ( return this.isSlot && this.canFill && (
!this.node.quantityExpected || !this.node.quantityExpected ||
this.node.quantityExpected.value === 0 || this.node.quantityExpected.value === 0 ||
(this.node.quantityExpected.value > 1 && this.node.spaceLeft > 0) (this.node.quantityExpected.value > 1 && this.node.spaceLeft > 0) ||
(this.node.quantityExpected.value === 1 && this.children?.length)
); );
}, },
hasChildren(){ hasChildren(){