The buttons should move a few arrows to the right and left I choose in the check box which arrow I want and then it should move each time + or - 20 degrees so that the breasts rotate. The buttons work but they get stuck and the arrows do not move smoothly.
curretnAngle is a new angle that I compare to each arrow and its angles and then in the second function I change it to 20 degrees each time
const handleChange=(e)=>{
let curretnAngle;
if (props.selectedButton=='turret') {
console.log(props.selectedButton);
curretnAngle = props.angleTurret
console.log(props.angleTurret, curretnAngle);
}
else if (props.selectedButton=='lazer') {
curretnAngle= props.angleLazer
}
else{
curretnAngle = props.radanglee
}
switch (e.target.name){
case 'minus':
console.log(curretnAngle,props.selectedButton);
props.handlerotat(curretnAngle-20)
console.log('minus')
break;
case 'plus':
console.log(curretnAngle,props.selectedButton);
props.handlerotate(curretnAngle+20)
console.log('plus')
break;
}
const handlerotate=(newAngle)=>{
switch (selectedButton) {
case 'turret':
setAngleTurret(newAngle)
break;
case 'lazer':
setAngleLazer(newAngle)
break;
case 'lezerr':
setAnglerad(newAngle)
break;
}
}