File tree 2 files changed +17
-4
lines changed
2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 212
212
213
213
// Opacity/Color propagates into children that conform to if cascadeOpacity/cascadeColor is enabled.
214
214
BOOL _cascadeColorEnabled, _cascadeOpacityEnabled;
215
+
216
+ // contentSize changes don't propogate to children unless cascadeContentSize is enabled.
217
+ BOOL _cascadeContentSizeEnabled;
215
218
216
219
@private
217
220
// Physics Body.
386
389
// / -----------------------------------------------------------------------
387
390
388
391
/* * 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.
390
394
@see contentSizeInPoints
391
- @see contentSizeType */
395
+ @see contentSizeType
396
+ @see cascadeContentSizeEnabled
397
+ */
392
398
@property (nonatomic ,readwrite ,assign ) CGSize contentSize;
393
399
394
400
/* * The untransformed size of the node in Points. The contentSize remains the same regardless of whether the node is scaled or rotated.
404
410
@see contentSizeInPoints */
405
411
@property (nonatomic ,readwrite ,assign ) CCSizeType contentSizeType;
406
412
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
+
407
419
/* *
408
420
* Invoked automatically when the OS view has been resized.
409
421
*
Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ -(id) init
187
187
_displayColor = _color = [CCColor whiteColor ].ccColor4f ;
188
188
_cascadeOpacityEnabled = NO ;
189
189
_cascadeColorEnabled = NO ;
190
+ _cascadeContentSizeEnabled = NO ;
190
191
}
191
192
192
193
return self;
@@ -399,12 +400,11 @@ - (void) contentSizeChanged
399
400
{
400
401
[child parentsContentSizeChanged ];
401
402
}
402
-
403
403
}
404
404
405
405
- (void ) parentsContentSizeChanged
406
406
{
407
- if (!CCSizeTypeIsBasicPoints (_contentSizeType))
407
+ if (!CCSizeTypeIsBasicPoints (_contentSizeType) && (_cascadeContentSizeEnabled == YES ) )
408
408
{
409
409
[self contentSizeChanged ];
410
410
}
@@ -1679,6 +1679,7 @@ - (BOOL)hitTestWithWorldPos:(CGPoint)pos
1679
1679
1680
1680
@synthesize cascadeColorEnabled=_cascadeColorEnabled;
1681
1681
@synthesize cascadeOpacityEnabled=_cascadeOpacityEnabled;
1682
+ @synthesize cascadeContentSizeEnabled=_cascadeContentSizeEnabled;
1682
1683
1683
1684
-(CGFloat ) opacity
1684
1685
{
You can’t perform that action at this time.
0 commit comments