Change token fade hover to only be on drawing

This commit is contained in:
Mitchell McCaffrey 2020-07-31 14:50:01 +10:00
parent 6aef95c78c
commit e1733bb504
2 changed files with 7 additions and 5 deletions

View File

@ -241,6 +241,7 @@ function Map({
selectedToolId === "pan" && !(tokenState.id in disabledTokens)
}
mapState={mapState}
fadeOnHover={selectedToolId === "drawing"}
/>
))}
</Group>

View File

@ -25,6 +25,7 @@ function MapToken({
onTokenDragEnd,
draggable,
mapState,
fadeOnHover,
}) {
const { userId } = useContext(AuthContext);
const {
@ -127,13 +128,13 @@ function MapToken({
}
}
function handlePointerOver() {
if (!draggable) {
function handlePointerEnter() {
if (fadeOnHover) {
setTokenOpacity(0.5);
}
}
function handlePointerOut() {
function handlePointerLeave() {
if (tokenOpacity !== 1.0) {
setTokenOpacity(1.0);
}
@ -183,8 +184,8 @@ function MapToken({
draggable={draggable}
onMouseDown={handlePointerDown}
onMouseUp={handlePointerUp}
onMouseOver={handlePointerOver}
onMouseOut={handlePointerOut}
onMouseEnter={handlePointerEnter}
onMouseLeave={handlePointerLeave}
onTouchStart={handlePointerDown}
onTouchEnd={handlePointerUp}
onClick={handleClick}