Skip to content

Commit

Permalink
Remove unused CanvasScrollViewProtocol
Browse files Browse the repository at this point in the history
  • Loading branch information
akaDuality committed Jan 2, 2024
1 parent 68c0bca commit b9b1396
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
7 changes: 0 additions & 7 deletions Shared/Sources/Canvas/CanvasPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,17 @@ import TextRecognition
import Foundation
import QuartzCore

public protocol CanvasScrollViewProtocol: AnyObject {
func fitToWindow(animated: Bool)
}

public class CanvasPresenter: DocumentPresenter {

public weak var uiContent: DrawingView!
public weak var uiScroll: CanvasScrollViewProtocol!
var drawingController: DrawingController!

public func didLoad(
uiContent: DrawingView,
uiScroll: CanvasScrollViewProtocol,
initialScale: CGFloat,
previewSource: PreviewSourceProtocol
) {
self.uiContent = uiContent
self.uiScroll = uiScroll
self.scale = initialScale
self.drawingController = DrawingController(view: uiContent)
self.document.previewSource = previewSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ extension CanvasView {
}
}

extension CanvasView: CanvasScrollViewProtocol {

func fitToWindow(animated: Bool) {
scrollView.fitToWindow(animated: animated)
}
}

extension CGSize {
static func /(_ lhs: Self, _ divider: CGFloat) -> Self {
precondition(divider != 0, "Can't divide by zero")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class CanvasViewController: NSViewController {
view.window?.delegate = self

presenter.didLoad(uiContent: view().documentView,
uiScroll: view(),
initialScale: 1,
previewSource: view())

Expand All @@ -52,7 +51,7 @@ public class CanvasViewController: NSViewController {
observe()

// Zoom after layout of scrollView
view().fitToWindow(animated: false)
view().scrollView.fitToWindow(animated: false)
}

public override func viewWillDisappear() {
Expand Down Expand Up @@ -251,7 +250,7 @@ extension CanvasViewController: DragNDropDelegate {
presenter.add(image: image,
name: name,
origin: locationInCanvas)
view().fitToWindow(animated: shouldAnimate)
view().scrollView.fitToWindow(animated: shouldAnimate)
}

public func didDrag(path: URL) -> Bool {
Expand Down

0 comments on commit b9b1396

Please sign in to comment.