-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '255-fix-redaction-overlay-size' into 'release/22.7'
Resolve "Fix redaction overlay size" Closes #255 See merge request highlighter/app!225
- Loading branch information
Showing
29 changed files
with
459 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Editing/Editing View/PhotoEditingObservationDebugView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Created by Geoff Pado on 7/8/22. | ||
// Copyright © 2022 Cocoatype, LLC. All rights reserved. | ||
|
||
import UIKit | ||
|
||
class PhotoEditingObservationDebugView: PhotoEditingRedactionView { | ||
override init() { | ||
super.init() | ||
isUserInteractionEnabled = false | ||
} | ||
|
||
// MARK: Text Observations | ||
|
||
var textObservations: [TextRectangleObservation]? { | ||
didSet { | ||
updateDebugLayers() | ||
setNeedsDisplay() | ||
} | ||
} | ||
|
||
private func updateDebugLayers() { | ||
layer.sublayers = debugLayers | ||
} | ||
|
||
private var debugLayers: [CALayer] { | ||
guard FeatureFlag.shouldShowDebugOverlay, let textObservations = textObservations else { return [] } | ||
return textObservations.flatMap { textObservation -> [CALayer] in | ||
guard let characterObservations = textObservation.characterObservations else { return [] } | ||
let characterLayers = characterObservations.map { observation -> CALayer in | ||
let layer = CALayer() | ||
layer.backgroundColor = UIColor.systemBlue.withAlphaComponent(0.3).cgColor | ||
layer.frame = observation.bounds | ||
return layer | ||
} | ||
|
||
let textLayer = CALayer() | ||
textLayer.backgroundColor = UIColor.systemRed.withAlphaComponent(0.3).cgColor | ||
textLayer.frame = textObservation.bounds | ||
|
||
return characterLayers + [textLayer] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Created by Geoff Pado on 7/18/22. | ||
// Copyright © 2022 Cocoatype, LLC. All rights reserved. | ||
|
||
enum PhotoExportError: Error { | ||
case imageGenerationFailed | ||
case operationReturnedNoResult | ||
} |
Oops, something went wrong.