Allow adding to bottom of pile by holding shift
This commit is contained in:
parent
a69bbd4f8d
commit
9dd5a07da8
@ -128,11 +128,19 @@ interact('.card-pile')
|
|||||||
.dropzone({
|
.dropzone({
|
||||||
accept: '.card:not(.in-pile)',
|
accept: '.card:not(.in-pile)',
|
||||||
ondrop: event => {
|
ondrop: event => {
|
||||||
// TODO: fix duped zeros
|
// TODO: fix possible duped zeros
|
||||||
let pileName = event.target.getAttribute('data-pile');
|
let pileName = event.target.getAttribute('data-pile');
|
||||||
let cardNum = event.relatedTarget.getAttribute('data-num');
|
let cardNum = event.relatedTarget.getAttribute('data-num');
|
||||||
|
if (event.dragEvent.shiftKey) {
|
||||||
|
console.log(`Adding ${cardNum} bottom of to ${pileName}`);
|
||||||
|
piles[pileName].unshift(cardNum);
|
||||||
|
}
|
||||||
|
else {
|
||||||
console.log(`Adding ${cardNum} to ${pileName}`);
|
console.log(`Adding ${cardNum} to ${pileName}`);
|
||||||
piles[pileName].push(cardNum);
|
piles[pileName].push(cardNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove from DOM
|
||||||
event.relatedTarget.parentElement.removeChild(event.relatedTarget);
|
event.relatedTarget.parentElement.removeChild(event.relatedTarget);
|
||||||
|
|
||||||
// update deck text
|
// update deck text
|
||||||
|
Loading…
Reference in New Issue
Block a user