mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
CIB-fix
For some (yet unknown) reason, when declaring a view with tracking area in a CIB, there’s some weird things happening that try to use the _trackingAreas array when it’s not yet initialized… So, replacing _trackingAreas.length by [_trackingAreas count] resolves the problem.
This commit is contained in:
+10
-9
@@ -23,16 +23,17 @@
|
||||
@import <Foundation/Foundation.j>
|
||||
@import "CPView.j"
|
||||
|
||||
/* @group CPTrackingAreaOptions */
|
||||
@typedef CPTrackingAreaOptions
|
||||
CPTrackingMouseEnteredAndExited = 1 << 1,
|
||||
CPTrackingMouseMoved = 1 << 2,
|
||||
CPTrackingCursorUpdate = 1 << 3,
|
||||
CPTrackingActiveWhenFirstResponder = 1 << 4,
|
||||
CPTrackingActiveInKeyWindow = 1 << 5,
|
||||
CPTrackingActiveInActiveApp = 1 << 6,
|
||||
CPTrackingActiveAlways = 1 << 7,
|
||||
CPTrackingAssumeInside = 1 << 8,
|
||||
CPTrackingInVisibleRect = 1 << 9,
|
||||
CPTrackingMouseEnteredAndExited = 1 << 1;
|
||||
CPTrackingMouseMoved = 1 << 2;
|
||||
CPTrackingCursorUpdate = 1 << 3;
|
||||
CPTrackingActiveWhenFirstResponder = 1 << 4;
|
||||
CPTrackingActiveInKeyWindow = 1 << 5;
|
||||
CPTrackingActiveInActiveApp = 1 << 6;
|
||||
CPTrackingActiveAlways = 1 << 7;
|
||||
CPTrackingAssumeInside = 1 << 8;
|
||||
CPTrackingInVisibleRect = 1 << 9;
|
||||
CPTrackingEnabledDuringMouseDrag = 1 << 10;
|
||||
|
||||
var CPTrackingAreaRectKey = @"CPTrackinkAreaRectKey",
|
||||
|
||||
+7
-7
@@ -3535,7 +3535,7 @@ setBoundsOrigin:
|
||||
// We also do special treatment and notify the view itself if it has no tracking area to
|
||||
// enable the use of updateTrackingAreas as a mean to install tracking areas.
|
||||
|
||||
if (_trackingAreas.length > 0)
|
||||
if ([_trackingAreas count] > 0)
|
||||
var ownersToNotify = [self _prepareOwnersToNotify];
|
||||
else
|
||||
var ownersToNotify = @[ self ];
|
||||
@@ -3551,7 +3551,7 @@ setBoundsOrigin:
|
||||
|
||||
var ownersToNotify = [];
|
||||
|
||||
for (var i = 0; i < _trackingAreas.length; i++)
|
||||
for (var i = 0, count = [_trackingAreas count]; i < count; i++)
|
||||
{
|
||||
var trackingArea = _trackingAreas[i];
|
||||
|
||||
@@ -3626,6 +3626,11 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
|
||||
if (self)
|
||||
{
|
||||
_trackingAreas = [aCoder decodeObjectForKey:CPViewTrackingAreasKey];
|
||||
|
||||
if (!_trackingAreas)
|
||||
_trackingAreas = [];
|
||||
|
||||
// We have to manually check because it may be 0, so we can't use ||
|
||||
_tag = [aCoder containsValueForKey:CPViewTagKey] ? [aCoder decodeIntForKey:CPViewTagKey] : -1;
|
||||
_identifier = [aCoder decodeObjectForKey:CPReuseIdentifierKey];
|
||||
@@ -3699,11 +3704,6 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
|
||||
[self setAppearance:[aCoder decodeObjectForKey:CPViewAppearanceKey]];
|
||||
|
||||
_trackingAreas = [aCoder decodeObjectForKey:CPViewTrackingAreasKey];
|
||||
|
||||
if (!_trackingAreas)
|
||||
_trackingAreas = [];
|
||||
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user