<commit_before>//
//  HLScrollNode.h
//  HLSpriteKit
//
//  Created by <NAME> on 10/20/14.
//  Copyright (c) 2014 Hilo Games. All rights reserved.
//

#import <SpriteKit/SpriteKit.h>

#import "HLComponentNode.h"
#import "HLGestureTarget.h"

/**
 Specifies a mode for enforcing a scaling minimum (zooming out) for content.
*/
typedef NS_ENUM(NSInteger, HLScrollNodeContentScaleMinimumMode)
{
  /**
   Content scale is allowed as small as the configured `contentScaleMinimum`, but is further
   limited by the `contentSize`: The `HLScrollNode` may only zoom out until one dimension of
   the `contentSize` fits exactly in the inset scroll node area.
  */
  HLScrollNodeContentScaleMinimumFitTight,
  /**
   Content scale is allowed as small as the configured `contentScaleMinimum`, but is
   further limited by the `contentSize`: The `HLScrollNode` may only zoom out until one
   dimension of the `contentSize` fits entirely and the other dimension fits exactly in
   the inset scroll node area.  (In the non-limiting dimension, the content is centered.)
  */
  HLScrollNodeContentScaleMinimumFitLoose,
  /**
   Content scale is allowed as small as the configured `contentScaleMinimum`, regardless
   of the `contentSize` of the `HLScrollNode`.  (Note: Specifying a `contentScaleMinimum`
   of `0.0` in this mode allows zooming out infinitely.)
  */
  HLScrollNodeContentScaleMinimumAsConfigured,
};

/**
 An `HLScrollNode` provides support for scrolling and scaling its content (set via the
 `contentNode` property) with pan and pinch gestures.

 The `HLScrollNode` is not completely analogous to `UIScrollView`, but the similarity is
 deliberate.  One notable difference: The `HLScrollNode` does not currently clip the
 contents to its own size.

 ## Common Gesture Handling Configurations

 - Set this node as its own gesture target (via `[SKNode+HLGestureTarget
   hlSetGestureTarget]`) to get one-finger scrolling and two-finger pinch scaling
   behavior.
*/
@interface HLScrollNode : HLComponentNode <HLGestureTarget>

/// @name Creating a Scroll Node

/**
 Initializes an `HLScrollNode` with layout-affecting parameters necessary for basic
 scrolling (though not scaling) behavior.

 Set `contentNode` for a functioning `HLScrollNode`.

 Once the `HLScrollNode`'s `contentNode` has been set, changes to the layout-affecting
 parameters might constrain the `HLScrollNode`'s `contentOffset` and `contentScale`
 values.  A simple example:

     HLScrollNode *scrollNode = [[HLScrollNode alloc] init];
     scrollNode.contentNode = myContentNode;<commit_msg>Documentation update for letting pan and pinch gestures fall through to scroll node.<commit_after>//
//  HLScrollNode.h
//  HLSpriteKit
//
//  Created by <NAME> on 10/20/14.
//  Copyright (c) 2014 Hilo Games. All rights reserved.
//

#import <SpriteKit/SpriteKit.h>

#import "HLComponentNode.h"
#import "HLGestureTarget.h"

/**
 Specifies a mode for enforcing a scaling minimum (zooming out) for content.
*/
typedef NS_ENUM(NSInteger, HLScrollNodeContentScaleMinimumMode)
{
  /**
   Content scale is allowed as small as the configured `contentScaleMinimum`, but is further
   limited by the `contentSize`: The `HLScrollNode` may only zoom out until one dimension of
   the `contentSize` fits exactly in the inset scroll node area.
  */
  HLScrollNodeContentScaleMinimumFitTight,
  /**
   Content scale is allowed as small as the configured `contentScaleMinimum`, but is
   further limited by the `contentSize`: The `HLScrollNode` may only zoom out until one
   dimension of the `contentSize` fits entirely and the other dimension fits exactly in
   the inset scroll node area.  (In the non-limiting dimension, the content is centered.)
  */
  HLScrollNodeContentScaleMinimumFitLoose,
  /**
   Content scale is allowed as small as the configured `contentScaleMinimum`, regardless
   of the `contentSize` of the `HLScrollNode`.  (Note: Specifying a `contentScaleMinimum`
   of `0.0` in this mode allows zooming out infinitely.)
  */
  HLScrollNodeContentScaleMinimumAsConfigured,
};

/**
 An `HLScrollNode` provides support for scrolling and scaling its content (set via the
 `contentNode` property) with pan and pinch gestures.

 The `HLScrollNode` is not completely analogous to `UIScrollView`, but the similarity is
 deliberate.  One notable difference: The `HLScrollNode` does not currently clip the
 contents to its own size.

 ## Common Gesture Handling Configurations

 - Set this node as its own gesture target (via `[SKNode+HLGestureTarget
   hlSetGestureTarget]`) to get one-finger scrolling and two-finger pinch scaling
   behavior.

 Often the content node will want to handle taps (and the like) while letting pan and
 pinch gestures fall through to the scroll node.  It depends a little on the scene
 implementation, but for `HLScene`, the important part is returning `NO` for `isInside`
 for pan and pinch gesture recognizers in the content node's gesture target implementation
 of `addToGestureRecognizer:firstTouch:isInside:`.  See, for instance, the implementation
 of that method in `HLTapGestureTarget`.
*/
@interface HLScrollNode : HLComponentNode <HLGestureTarget>

/// @name Creating a Scroll Node

/**
 Initializes an `HLScrollNode` with layout-affecting parameters necessary for basic
 scrolling (though not scaling) behavior.

 Set `contentNode` for a functioning `HLScrollNode`.

 Once the `HLScrollNode`'s `contentNode` has been set, changes to the layout-affecting
 parameters might constrain the `HLScrollNode`'s `contentOffset` and `contentScale`
 values.  A simple example:

     HLScrollNode *scrollNode = [[HLScrollNode alloc] init];
     scrollNode.contentNode = myContentNode;
{'fraction_non_alphanumeric': 0.07443993649673664, 'fraction_numerical': 0.0042335508908096665, 'mean_word_length': 4.483558994197292, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3680360', 'n_tokens_mistral': 1634, 'n_tokens_neox': 1505, 'n_words': 657}