updateFromComponent method
Computes the visual response's interpolation weight based on component state @param {Object} componentValues - The component from which to update @param {number} xAxis - The reported X axis value of the component @param {number} yAxis - The reported Y axis value of the component @param {number} button - The reported value of the component's button @param {string} state - The component's active state
Implementation
void updateFromComponent(Map values) {
final state = values['state'];
final button = values['button'];
final normalized = normalizeAxes(values['xAxis'], values['yAxis']);
final normalizedXAxis = normalized['normalizedXAxis'];
final normalizedYAxis = normalized['normalizedYAxis'];
switch (componentProperty) {
case 'xAxis':
value = (states!.contains(state)) ? normalizedXAxis : 0.5;
break;
case 'yAxis':
value = (states!.contains(state)) ? normalizedYAxis : 0.5;
break;
case 'button':
value = (states!.contains(state)) ? button : 0;
break;
case 'state':
if (valueNodeProperty == constants['VisualResponseProperty']['VISIBILITY']) {
value = states!.contains(state)? 1:0;
}
else {
value = states!.contains(state) ? 1.0 : 0.0;
}
break;
default:
throw('Unexpected visualResponse componentProperty $componentProperty');
}
}