onSend method
Called for each message before it is queued.
Return the same message to keep it, a modified message to transform it,
or null to drop it.
Implementation
@override
Msg? onSend(Msg msg) {
if (msg is! ReplayMouseMsg) return msg;
final targetWidth = _targetWidth;
final targetHeight = _targetHeight;
final scaledX = sourceWidth > 0 && targetWidth != null && targetWidth > 0
? _scaleXCoordinate(msg.x, sourceWidth, targetWidth)
: msg.x;
final scaledY = sourceHeight > 0 && targetHeight != null && targetHeight > 0
? _scaleCoordinate(msg.y, sourceHeight, targetHeight)
: msg.y;
return MouseMsg(
action: msg.action,
button: msg.button,
x: scaledX,
y: scaledY,
ctrl: msg.ctrl,
alt: msg.alt,
shift: msg.shift,
);
}