Add implied border
This commit is contained in:
parent
b7a321cff5
commit
42e4af46e9
2 changed files with 36 additions and 4 deletions
|
@ -84,7 +84,12 @@ function useGameEvent(count: number) {
|
||||||
y > count,
|
y > count,
|
||||||
].reduce((prev, curr) => prev || curr, false)
|
].reduce((prev, curr) => prev || curr, false)
|
||||||
// console.log(!isHit(hits, x, y).length, !borders)
|
// console.log(!isHit(hits, x, y).length, !borders)
|
||||||
return !isHit(hits, x, y).length && !border
|
return !border
|
||||||
|
}).map(field => {
|
||||||
|
const { x, y } = field
|
||||||
|
if (isHit(hits, x, y).length)
|
||||||
|
return { ...field, edges: [...field.edges, 'imply'] }
|
||||||
|
return field
|
||||||
})
|
})
|
||||||
setTargetList(e => {
|
setTargetList(e => {
|
||||||
if (JSON.stringify(e) === JSON.stringify(result))
|
if (JSON.stringify(e) === JSON.stringify(result))
|
||||||
|
@ -104,14 +109,21 @@ function useGameEvent(count: number) {
|
||||||
y > count + 1,
|
y > count + 1,
|
||||||
].reduce((prev, curr) => prev || curr, false)
|
].reduce((prev, curr) => prev || curr, false)
|
||||||
// console.log(!isHit(hits, x, y).length, !isSet(x, y), !borders)
|
// console.log(!isHit(hits, x, y).length, !isSet(x, y), !borders)
|
||||||
return !isHit(hits, x, y).length && !isSet(x, y) && !border
|
return !border
|
||||||
|
}).map(field => {
|
||||||
|
const { x, y } = field
|
||||||
|
if (isHit(hits, x, y).length || isSet(x, y))
|
||||||
|
return { ...field, edges: [...field.edges, 'imply'] }
|
||||||
|
return field
|
||||||
})
|
})
|
||||||
|
if (!targetPreviewPos.shouldShow)
|
||||||
|
return
|
||||||
setTargetPreviewList(e => {
|
setTargetPreviewList(e => {
|
||||||
if (JSON.stringify(e) === JSON.stringify(result))
|
if (JSON.stringify(e) === JSON.stringify(result))
|
||||||
return e
|
return e
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
}, [scopeGrid, targetPreview, count, hits, isSet]);
|
}, [scopeGrid, targetPreview, count, hits, isSet, targetPreviewPos.shouldShow]);
|
||||||
|
|
||||||
// handle visibility and position change of targetPreview
|
// handle visibility and position change of targetPreview
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -154,7 +154,7 @@ body {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.target {
|
&.target {
|
||||||
--color: red;
|
--color: red;
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
|
@ -172,6 +172,10 @@ body {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.imply>svg {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
&.left {
|
&.left {
|
||||||
border-left: 2px solid var(--color);
|
border-left: 2px solid var(--color);
|
||||||
}
|
}
|
||||||
|
@ -188,6 +192,22 @@ body {
|
||||||
border-bottom: 2px solid var(--color);
|
border-bottom: 2px solid var(--color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.imply.left {
|
||||||
|
border-left: 2px dashed white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.imply.right {
|
||||||
|
border-right: 2px dashed white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.imply.top {
|
||||||
|
border-top: 2px dashed white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.imply.bottom {
|
||||||
|
border-bottom: 2px dashed white;
|
||||||
|
}
|
||||||
|
|
||||||
&.left.top {
|
&.left.top {
|
||||||
border-top-left-radius: 8px;
|
border-top-left-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue