AsyncDisplayKit+Debug.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // AsyncDisplayKit+Debug.h
  3. // AsyncDisplayKit
  4. //
  5. // Created by Hannah Troisi on 3/7/16.
  6. //
  7. // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  8. // This source code is licensed under the BSD-style license found in the
  9. // LICENSE file in the root directory of this source tree. An additional grant
  10. // of patent rights can be found in the PATENTS file in the same directory.
  11. //
  12. #import "ASDisplayNode.h"
  13. #import "ASControlNode.h"
  14. #import "ASImageNode.h"
  15. #import "ASRangeController.h"
  16. NS_ASSUME_NONNULL_BEGIN
  17. @interface ASDisplayNode (Visualization)
  18. @property (nonatomic, assign) BOOL shouldVisualizeLayoutSpecs;
  19. @property (nonatomic, assign) BOOL shouldCacheLayoutSpec;
  20. @end
  21. @interface ASImageNode (Debugging)
  22. /**
  23. * Enables an ASImageNode debug label that shows the ratio of pixels in the source image to those in
  24. * the displayed bounds (including cropRect). This helps detect excessive image fetching / downscaling,
  25. * as well as upscaling (such as providing a URL not suitable for a Retina device). For dev purposes only.
  26. * @param enabled Specify YES to show the label on all ASImageNodes with non-1.0x source-to-bounds pixel ratio.
  27. */
  28. + (void)setShouldShowImageScalingOverlay:(BOOL)show;
  29. + (BOOL)shouldShowImageScalingOverlay;
  30. @end
  31. @interface ASControlNode (Debugging)
  32. /**
  33. * Class method to enable a visualization overlay of the tappable area on the ASControlNode. For app debugging purposes only.
  34. * NOTE: GESTURE RECOGNIZERS, (including tap gesture recognizers on a control node) WILL NOT BE VISUALIZED!!!
  35. * Overlay = translucent GREEN color,
  36. * edges that are clipped by the tappable area of any parent (their bounds + hitTestSlop) in the hierarchy = DARK GREEN BORDERED EDGE,
  37. * edges that are clipped by clipToBounds = YES of any parent in the hierarchy = ORANGE BORDERED EDGE (may still receive touches beyond
  38. * overlay rect, but can't be visualized).
  39. * @param enable Specify YES to make this debug feature enabled when messaging the ASControlNode class.
  40. */
  41. + (void)setEnableHitTestDebug:(BOOL)enable;
  42. + (BOOL)enableHitTestDebug;
  43. @end
  44. @interface ASRangeController (Debugging)
  45. /**
  46. * Class method to enable a visualization overlay of the all ASRangeController's tuning parameters. For dev purposes only.
  47. * To use, message ASRangeController in the AppDelegate --> [ASRangeController setShouldShowRangeDebugOverlay:YES];
  48. * @param enable Specify YES to make this debug feature enabled when messaging the ASRangeController class.
  49. */
  50. + (void)setShouldShowRangeDebugOverlay:(BOOL)show;
  51. + (BOOL)shouldShowRangeDebugOverlay;
  52. + (void)layoutDebugOverlayIfNeeded;
  53. - (void)addRangeControllerToRangeDebugOverlay;
  54. - (void)updateRangeController:(ASRangeController *)controller
  55. withScrollableDirections:(ASScrollDirection)scrollableDirections
  56. scrollDirection:(ASScrollDirection)direction
  57. rangeMode:(ASLayoutRangeMode)mode
  58. displayTuningParameters:(ASRangeTuningParameters)displayTuningParameters
  59. preloadTuningParameters:(ASRangeTuningParameters)preloadTuningParameters
  60. interfaceState:(ASInterfaceState)interfaceState;
  61. @end
  62. NS_ASSUME_NONNULL_END