YYTextMagnifier.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // YYTextMagnifier.h
  3. // YYKit <https://github.com/ibireme/YYKit>
  4. //
  5. // Created by ibireme on 15/2/25.
  6. // Copyright (c) 2015 ibireme.
  7. //
  8. // This source code is licensed under the MIT-style license found in the
  9. // LICENSE file in the root directory of this source tree.
  10. //
  11. #import <UIKit/UIKit.h>
  12. #if __has_include(<YYKit/YYKit.h>)
  13. #import <YYKit/YYTextAttribute.h>
  14. #else
  15. #import "YYTextAttribute.h"
  16. #endif
  17. NS_ASSUME_NONNULL_BEGIN
  18. /// Magnifier type
  19. typedef NS_ENUM(NSInteger, YYTextMagnifierType) {
  20. YYTextMagnifierTypeCaret, ///< Circular magnifier
  21. YYTextMagnifierTypeRanged, ///< Round rectangle magnifier
  22. };
  23. /**
  24. A magnifier view which can be displayed in `YYTextEffectWindow`.
  25. @discussion Use `magnifierWithType:` to create instance.
  26. Typically, you should not use this class directly.
  27. */
  28. @interface YYTextMagnifier : UIView
  29. /// Create a mangifier with the specified type. @param type The magnifier type.
  30. + (id)magnifierWithType:(YYTextMagnifierType)type;
  31. @property (nonatomic, readonly) YYTextMagnifierType type; ///< Type of magnifier
  32. @property (nonatomic, readonly) CGSize fitSize; ///< The 'best' size for magnifier view.
  33. @property (nonatomic, readonly) CGSize snapshotSize; ///< The 'best' snapshot image size for magnifier.
  34. @property (nullable, nonatomic, strong) UIImage *snapshot; ///< The image in magnifier (readwrite).
  35. @property (nullable, nonatomic, weak) UIView *hostView; ///< The coordinate based view.
  36. @property (nonatomic) CGPoint hostCaptureCenter; ///< The snapshot capture center in `hostView`.
  37. @property (nonatomic) CGPoint hostPopoverCenter; ///< The popover center in `hostView`.
  38. @property (nonatomic) BOOL hostVerticalForm; ///< The host view is vertical form.
  39. @property (nonatomic) BOOL captureDisabled; ///< A hint for `YYTextEffectWindow` to disable capture.
  40. @property (nonatomic) BOOL captureFadeAnimation; ///< Show fade animation when the snapshot image changed.
  41. @end
  42. NS_ASSUME_NONNULL_END