File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 212212
213213 // Opacity/Color propagates into children that conform to if cascadeOpacity/cascadeColor is enabled.
214214 BOOL _cascadeColorEnabled, _cascadeOpacityEnabled;
215+
216+ // contentSize changes don't propogate to children unless cascadeContentSize is enabled.
217+ BOOL _cascadeContentSizeEnabled;
215218
216219@private
217220 // Physics Body.
386389// / -----------------------------------------------------------------------
387390
388391/* * The untransformed size of the node in the unit specified by contentSizeType property.
389- The contentSize remains the same regardless of whether the node is scaled or rotated.
392+ The contentSize remains the same regardless of whether the node is scaled or rotated. Changes to contentSize will not affect
393+ children unless the property cascadeContentSize is enabled.
390394 @see contentSizeInPoints
391- @see contentSizeType */
395+ @see contentSizeType
396+ @see cascadeContentSizeEnabled
397+ */
392398@property (nonatomic ,readwrite ,assign ) CGSize contentSize;
393399
394400/* * The untransformed size of the node in Points. The contentSize remains the same regardless of whether the node is scaled or rotated.
404410 @see contentSizeInPoints */
405411@property (nonatomic ,readwrite ,assign ) CCSizeType contentSizeType;
406412
413+ /* *
414+ cascadeContentSizeEnabled causes changes to this node's contentSize to cascade down to it's children.
415+ @see contentSize
416+ */
417+ @property (nonatomic , getter = isCascadeContentSizeEnabled) BOOL cascadeContentSizeEnabled;
418+
407419/* *
408420 * Invoked automatically when the OS view has been resized.
409421 *
Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ -(id) init
187187 _displayColor = _color = [CCColor whiteColor ].ccColor4f ;
188188 _cascadeOpacityEnabled = NO ;
189189 _cascadeColorEnabled = NO ;
190+ _cascadeContentSizeEnabled = NO ;
190191 }
191192
192193 return self;
@@ -399,12 +400,11 @@ - (void) contentSizeChanged
399400 {
400401 [child parentsContentSizeChanged ];
401402 }
402-
403403}
404404
405405- (void ) parentsContentSizeChanged
406406 {
407- if (!CCSizeTypeIsBasicPoints (_contentSizeType))
407+ if (!CCSizeTypeIsBasicPoints (_contentSizeType) && (_cascadeContentSizeEnabled == YES ) )
408408 {
409409 [self contentSizeChanged ];
410410 }
@@ -1679,6 +1679,7 @@ - (BOOL)hitTestWithWorldPos:(CGPoint)pos
16791679
16801680@synthesize cascadeColorEnabled=_cascadeColorEnabled;
16811681@synthesize cascadeOpacityEnabled=_cascadeOpacityEnabled;
1682+ @synthesize cascadeContentSizeEnabled=_cascadeContentSizeEnabled;
16821683
16831684-(CGFloat) opacity
16841685{
You can’t perform that action at this time.
0 commit comments