Added null checks to token menu state changes
This commit is contained in:
parent
c743901962
commit
b72f6d483f
@ -49,10 +49,14 @@ function TokenMenu({
|
|||||||
|
|
||||||
function handleLabelChange(event) {
|
function handleLabelChange(event) {
|
||||||
const label = event.target.value;
|
const label = event.target.value;
|
||||||
onTokenStateChange({ [tokenState.id]: { ...tokenState, label: label } });
|
tokenState &&
|
||||||
|
onTokenStateChange({ [tokenState.id]: { ...tokenState, label: label } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStatusChange(status) {
|
function handleStatusChange(status) {
|
||||||
|
if (!tokenState) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const statuses = tokenState.statuses;
|
const statuses = tokenState.statuses;
|
||||||
let newStatuses = [];
|
let newStatuses = [];
|
||||||
if (statuses.includes(status)) {
|
if (statuses.includes(status)) {
|
||||||
@ -67,26 +71,30 @@ function TokenMenu({
|
|||||||
|
|
||||||
function handleSizeChange(event) {
|
function handleSizeChange(event) {
|
||||||
const newSize = parseInt(event.target.value);
|
const newSize = parseInt(event.target.value);
|
||||||
onTokenStateChange({ [tokenState.id]: { ...tokenState, size: newSize } });
|
tokenState &&
|
||||||
|
onTokenStateChange({ [tokenState.id]: { ...tokenState, size: newSize } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRotationChange(event) {
|
function handleRotationChange(event) {
|
||||||
const newRotation = parseInt(event.target.value);
|
const newRotation = parseInt(event.target.value);
|
||||||
onTokenStateChange({
|
tokenState &&
|
||||||
[tokenState.id]: { ...tokenState, rotation: newRotation },
|
onTokenStateChange({
|
||||||
});
|
[tokenState.id]: { ...tokenState, rotation: newRotation },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleVisibleChange() {
|
function handleVisibleChange() {
|
||||||
onTokenStateChange({
|
tokenState &&
|
||||||
[tokenState.id]: { ...tokenState, visible: !tokenState.visible },
|
onTokenStateChange({
|
||||||
});
|
[tokenState.id]: { ...tokenState, visible: !tokenState.visible },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLockChange() {
|
function handleLockChange() {
|
||||||
onTokenStateChange({
|
tokenState &&
|
||||||
[tokenState.id]: { ...tokenState, locked: !tokenState.locked },
|
onTokenStateChange({
|
||||||
});
|
[tokenState.id]: { ...tokenState, locked: !tokenState.locked },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleModalContent(node) {
|
function handleModalContent(node) {
|
||||||
|
Loading…
Reference in New Issue
Block a user