catch negative values set by out of preview bound press
This commit is contained in:
@@ -198,8 +198,10 @@ class PreviewView(context: Context, callback: SurfaceHolder.Callback) :
|
||||
val viewOrientation = Orientation.PORTRAIT
|
||||
|
||||
val rotated = point.rotatedBy(viewSize, cameraSize, viewOrientation, sensorOrientation)
|
||||
Log.i(TAG, "Converted layer point $point to camera point $rotated! ($sensorOrientation, $cameraSize -> $viewSize)")
|
||||
return rotated
|
||||
// Clamp to valid camera coordinates (must be non-negative for MeteringRectangle)
|
||||
val clamped = Point(maxOf(0, rotated.x), maxOf(0, rotated.y))
|
||||
Log.i(TAG, "Converted layer point $point to camera point $clamped! ($sensorOrientation, $cameraSize -> $viewSize)")
|
||||
return clamped
|
||||
}
|
||||
|
||||
private fun updateLayout() {
|
||||
|
||||
Reference in New Issue
Block a user