fix combo highlighting (some rare case like 2 green)
This commit is contained in:
parent
f167ff82bb
commit
935d1d47ee
@ -249,13 +249,14 @@ function Vbox(args) {
|
|||||||
|
|
||||||
const combinerItems = combiner.map(j => vbox.bound[j]);
|
const combinerItems = combiner.map(j => vbox.bound[j]);
|
||||||
const comboHighlight = combinerItems.length > 0 && itemInfo.combos.some(combo => {
|
const comboHighlight = combinerItems.length > 0 && itemInfo.combos.some(combo => {
|
||||||
if (combo.components.includes(v) && combinerItems.every(c => combo.components.includes(c))) {
|
if (combo.components.includes(v)) {
|
||||||
return combinerItems.every(c => {
|
return combinerItems.every(c => {
|
||||||
if (c !== v) return true;
|
if (!combo.components.includes(c)) return false;
|
||||||
const comboCount = countBy(combo.components, co => co);
|
const comboCount = countBy(combo.components, co => co);
|
||||||
const combinerCounts = countBy(combinerItems, co => co);
|
const combinerCount = countBy(combinerItems, co => co);
|
||||||
if (comboCount[c] > combinerCounts[c]) return true;
|
if (combinerCount[c] > comboCount[c]) return false;
|
||||||
return false;
|
if (c === v && combinerCount[c] + 1 > comboCount[c]) return false;
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
} return false;
|
} return false;
|
||||||
}) ? 'combo-border' : '';
|
}) ? 'combo-border' : '';
|
||||||
@ -275,10 +276,6 @@ function Vbox(args) {
|
|||||||
|
|
||||||
combiner.push(i);
|
combiner.push(i);
|
||||||
|
|
||||||
// invalid combo
|
|
||||||
const combinerItems = combiner.map(j => vbox.bound[j]);
|
|
||||||
const combinerCounts = countBy(combinerItems, c => c);
|
|
||||||
|
|
||||||
if (!comboHighlight) {
|
if (!comboHighlight) {
|
||||||
return combinerChange([i]);
|
return combinerChange([i]);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user