feat: add canvas lock button

This commit is contained in:
dscyrescotti
2024-05-20 01:11:15 +07:00
parent 819c7dc321
commit 6208c5d62e
5 changed files with 81 additions and 31 deletions
@@ -168,6 +168,12 @@ extension CanvasViewController {
}
.store(in: &cancellables)
canvas.$locksCanvas
.sink { [weak self] state in
self?.lockModeChanged(state)
}
.store(in: &cancellables)
tool.$selectedPen
.sink { [weak self] pen in
self?.penChanged(to: pen)
@@ -308,6 +314,11 @@ extension CanvasViewController {
func zoomChanged(_ zoomScale: CGFloat) {
scrollView.setZoomScale(zoomScale, animated: true)
}
func lockModeChanged(_ state: Bool) {
scrollView.isScrollEnabled = !state
scrollView.pinchGestureRecognizer?.isEnabled = !state
}
}
extension CanvasViewController {