scaleToStandard method
Scales the current Offset to a standard canvas size.
This method scales the current offset coordinates (dx, dy) from the current device canvas size to a predefined standard canvas size. This is useful for maintaining consistency of coordinates across different devices.
The scaling is based on the ratio of the standard canvas size to the actual size of the device canvas.
deviceCanvasSize is the size of the canvas on the current device.
Returns a new Offset that is scaled to the standard canvas size.
Implementation
Offset scaleToStandard(Size deviceCanvasSize) {
final scaleX = standardWidth / deviceCanvasSize.width;
final scaleY = standardHeight / deviceCanvasSize.height;
return Offset(dx * scaleX, dy * scaleY);
}