mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix drawing color picker crash
This commit is contained in:
parent
6a9ce9ab6e
commit
c8c5b55f82
@ -591,11 +591,15 @@ final class ColorGridComponent: Component {
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
let row = Int(point.y / size.height * 10.0)
|
||||
let col = Int(point.x / size.width * 12.0)
|
||||
let row = max(0, min(10, Int(point.y / size.height * 10.0)))
|
||||
let col = max(0, min(12, Int(point.x / size.width * 12.0)))
|
||||
|
||||
let index = row * 12 + col
|
||||
return DrawingColor(rgb: palleteColors[index])
|
||||
if index < palleteColors.count {
|
||||
return DrawingColor(rgb: palleteColors[index])
|
||||
} else {
|
||||
return DrawingColor(rgb: 0x000000)
|
||||
}
|
||||
}
|
||||
|
||||
@objc func handlePress(_ gestureRecognizer: UILongPressGestureRecognizer) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user