2021-04-28 09:02:34 +02:00
|
|
|
//
|
|
|
|
// MediaPreviewableViewController.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by MainasuK Cirno on 2021-4-28.
|
|
|
|
//
|
|
|
|
|
2021-04-28 13:06:45 +02:00
|
|
|
import UIKit
|
2021-04-28 09:02:34 +02:00
|
|
|
|
2021-04-28 13:06:45 +02:00
|
|
|
protocol MediaPreviewableViewController: AnyObject {
|
2021-04-28 09:02:34 +02:00
|
|
|
var mediaPreviewTransitionController: MediaPreviewTransitionController { get }
|
2021-04-28 13:06:45 +02:00
|
|
|
func sourceFrame(transitionItem: MediaPreviewTransitionItem, index: Int) -> CGRect?
|
|
|
|
}
|
|
|
|
|
|
|
|
extension MediaPreviewableViewController {
|
|
|
|
func sourceFrame(transitionItem: MediaPreviewTransitionItem, index: Int) -> CGRect? {
|
|
|
|
switch transitionItem.source {
|
|
|
|
case .mosaic(let mosaicImageViewContainer):
|
|
|
|
guard index < mosaicImageViewContainer.imageViews.count else { return nil }
|
|
|
|
let imageView = mosaicImageViewContainer.imageViews[index]
|
|
|
|
return imageView.superview!.convert(imageView.frame, to: nil)
|
|
|
|
}
|
|
|
|
}
|
2021-04-28 09:02:34 +02:00
|
|
|
}
|