refreshchips
This commit is contained in:
parent
578344f784
commit
a8ae3f6a9a
@ -191,11 +191,9 @@ function moveChips() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshChips() {
|
function refreshChip(position) {
|
||||||
let positions = distinct(board.chips.filter((c) => c.uid != 0).map(({ x, y }) => ({ x, y })));
|
let a = board.chips.filter((c) => c.x == position.x && c.y == position.y && c.uid != 0);
|
||||||
for( let i = 0; i < positions.length; i++ ) {
|
if( includes(position) ) {
|
||||||
let a = board.chips.filter((c) => c.x == positions[i].x && c.y == positions[i].y && c.uid != 0);
|
|
||||||
if( includes(positions[i]) ) {
|
|
||||||
switch(a.length) {
|
switch(a.length) {
|
||||||
case 1:
|
case 1:
|
||||||
$(a[0].dom).animate({marginTop: "+=40", marginLeft: "+=40"}, 500);
|
$(a[0].dom).animate({marginTop: "+=40", marginLeft: "+=40"}, 500);
|
||||||
@ -224,7 +222,7 @@ function refreshChips() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( positions[i].x > 0 && positions[i].x < 10 ) {
|
if( position.x > 0 && position.x < 10 ) {
|
||||||
for(let u = 0; u < a.length; u++) {
|
for(let u = 0; u < a.length; u++) {
|
||||||
$(a[u].dom).animate({marginTop: "+=" + chips_margins[a.length][u].top, marginLeft: "+=" + chips_margins[a.length][u].left}, 500);
|
$(a[u].dom).animate({marginTop: "+=" + chips_margins[a.length][u].top, marginLeft: "+=" + chips_margins[a.length][u].left}, 500);
|
||||||
}
|
}
|
||||||
@ -234,6 +232,12 @@ function refreshChips() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshChips() {
|
||||||
|
let positions = distinct(board.chips.filter((c) => c.uid != 0).map(({ x, y }) => ({ x, y })));
|
||||||
|
for( let i = 0; i < positions.length; i++ ) {
|
||||||
|
refreshChip(positions[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user