Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Ensure crop points are current #50

Closed
wants to merge 2 commits into from

Conversation

marcisme
Copy link
Contributor

@marcisme marcisme commented May 3, 2019

Checklist

Motivation and Context

Previously setting the crop points via the text entry dialog would update the sliders, but moving the sliders would not update the pre-populated values in the text entry dialog. This was due to the text
field being populated with the Trial values, which aren't updated until the crop changes are saved.

Fixes #47

Description

This change uses the crop values from the current playback view controller, which is the same value that the sliders present and modify.

There do not appear to be tests for this part of the app, so I did not add or update any. I tested the change manually by modifying the crop points through both the sliders and the text input dialog and ensuring that the changes were reflected in the corresponding UI.

Previously setting the crop points via the text entry dialog would
update the sliders, but moving the sliders would not update the
pre-populated values in the text entry dialog. This was due to the text
field being populated with the `Trial` values, which aren't updated
until the crop changes are saved. This change uses the crop values from
the current playback view controller, which is the same value that the
sliders present and modify.

Fixes googlearchive#47
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@marcisme
Copy link
Contributor Author

marcisme commented May 3, 2019

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels May 3, 2019
/// - markerType: A crop marker type.
func showTimestampEditAlert(forTrialCropRange trialCropRange: ChartAxis<Int64>,
andCropMarkerType markerType: CropOverlayView.MarkerType) {
self.trialCropRange = trialCropRange
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this here feels a little weird to me, but I can't think of a better way to do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this CL but: CropRangeViewController is very odd. Looking at this again it, it should ideally have one instance per presentation of the crop so you could just initialize and present at once, rather than initializing and calling the show methods repeatedly. It doesn't even have it's own view. Makes me think it should just be a coordinator object or combine with the EditTimestampViewController class which already fits the "one instance per action" pattern.

})

return actions
}

private func showTimestampEditAlert(for cropMarkerType: CropOverlayView.MarkerType) {
guard let trialCropRange = self.currentPlaybackViewController?.1.cropRange else {
return
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should ever be possible. I considered doing a fatalError here, but this seemed safer, given the uncertainty.

/// - trialCropRange: The trial's crop range.
/// - markerType: A crop marker type.
func showTimestampEditAlert(forTrialCropRange trialCropRange: ChartAxis<Int64>,
andCropMarkerType markerType: CropOverlayView.MarkerType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could possibly improve this method per our conversation and align it better with the other change you made:

showTimestampEditAlert(for: .start, trialCropRange: trialCropRange)

/// - markerType: A crop marker type.
func showTimestampEditAlert(forTrialCropRange trialCropRange: ChartAxis<Int64>,
andCropMarkerType markerType: CropOverlayView.MarkerType) {
self.trialCropRange = trialCropRange
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this CL but: CropRangeViewController is very odd. Looking at this again it, it should ideally have one instance per presentation of the crop so you could just initialize and present at once, rather than initializing and calling the show methods repeatedly. It doesn't even have it's own view. Makes me think it should just be a coordinator object or combine with the EditTimestampViewController class which already fits the "one instance per action" pattern.

@marcisme marcisme deleted the marcisme-fix-47 branch August 5, 2019 20:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Edit Crop start-end Times doesn’t show the current times where sliders are placed
4 participants