combiner fixes
This commit is contained in:
parent
b3ba8825e4
commit
4cc42e305c
@ -296,29 +296,30 @@ class Vbox extends preact.Component {
|
|||||||
} return false;
|
} return false;
|
||||||
}) ? 'combo-border' : '';
|
}) ? 'combo-border' : '';
|
||||||
|
|
||||||
function onClick(e) {
|
function onClick(type) {
|
||||||
if (vboxSelecting) clearVboxSelected();
|
if (vboxSelecting) clearVboxSelected();
|
||||||
if (reclaiming) return sendVboxReclaim(i);
|
if (reclaiming) return sendVboxReclaim(i);
|
||||||
|
|
||||||
|
const combinerContainsIndex = combiner.indexOf(i) > -1;
|
||||||
// 4 things selected
|
// 4 things selected
|
||||||
if (combiner.length > 2) {
|
if (combiner.length > 2 && !combinerContainsIndex) {
|
||||||
setInfo(vbox.bound[i]);
|
setInfo(vbox.bound[i]);
|
||||||
return combinerChange([i]);
|
return combinerChange([i]);
|
||||||
}
|
}
|
||||||
// removing
|
// removing
|
||||||
const combinerIndex = combiner.indexOf(i);
|
if (combinerContainsIndex) {
|
||||||
if (combinerIndex > -1) {
|
if (type === 'click') {
|
||||||
|
return combinerChange(without(combiner, i));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
// return combinerChange(without(combiner, i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
combiner.push(i);
|
if (!comboHighlight && !combinerContainsIndex) {
|
||||||
|
|
||||||
if (!comboHighlight) {
|
|
||||||
setInfo(vbox.bound[i]);
|
setInfo(vbox.bound[i]);
|
||||||
return combinerChange([i]);
|
return combinerChange([i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
combiner.push(i);
|
||||||
return combinerChange(combiner);
|
return combinerChange(combiner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,17 +333,14 @@ class Vbox extends preact.Component {
|
|||||||
<label
|
<label
|
||||||
draggable='true'
|
draggable='true'
|
||||||
onDragStart={ev => {
|
onDragStart={ev => {
|
||||||
onClick(ev);
|
onClick('drag');
|
||||||
ev.dataTransfer.setData('text', '');
|
ev.dataTransfer.setData('text', '');
|
||||||
}}
|
|
||||||
onDragEnd={() => {
|
|
||||||
if (combiner.length === 1) combinerChange([]);
|
|
||||||
}}>
|
}}>
|
||||||
<button
|
<button
|
||||||
class={classes}
|
class={classes}
|
||||||
onMouseOver={e => vboxHover(e, v)}
|
onMouseOver={e => vboxHover(e, v)}
|
||||||
onClick={e => e.stopPropagation()}
|
onClick={e => e.stopPropagation()}
|
||||||
onMouseDown={onClick}>
|
onMouseDown={() => onClick('click')}>
|
||||||
{invObject}
|
{invObject}
|
||||||
</button>
|
</button>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user