mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-27 00:45:52 +00:00
Fixed: multiple rows of tokens in token fields wouldn't scroll right.
In recent versions, moving the cursor to a new row of tokens would place the scroll point somewhere halfway between the two rows of tokens.
This commit is contained in:
1 parent
26c26914da
commit
9768ea4af9
2 files changed
+12
-9
No files matched your search
+10
-7
@@ -1008,8 +1008,9 @@ var CPScrollDestinationNone = 0,
|
||||
r.origin.y = offset.y;
|
||||
|
||||
// Make sure the frame fits.
|
||||
if (_CGRectGetHeight([contentView bounds]) < offset.y + height)
|
||||
[contentView setFrame:_CGRectMake(0, 0, _CGRectGetWidth([_tokenScrollView bounds]), offset.y + height)];
|
||||
var scrollHeight = offset.y + tokenHeight + CEIL(spaceBetweenTokens.height / 2.0);
|
||||
if (_CGRectGetHeight([contentView bounds]) < scrollHeight)
|
||||
[contentView setFrameSize:_CGSizeMake(_CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)];
|
||||
|
||||
offset.x += width + spaceBetweenTokens.width;
|
||||
|
||||
@@ -1033,6 +1034,7 @@ var CPScrollDestinationNone = 0,
|
||||
}
|
||||
|
||||
_inputFrame = fitAndFrame(textWidth, tokenHeight);
|
||||
|
||||
_inputFrame.size.height = lineHeight;
|
||||
|
||||
element.style.left = (_inputFrame.origin.x + editorInset.left) + "px";
|
||||
@@ -1042,7 +1044,7 @@ var CPScrollDestinationNone = 0,
|
||||
|
||||
// When editing, always scroll to the cursor.
|
||||
if (_selectedRange.length == 0)
|
||||
[[_tokenScrollView documentView] scrollRectToVisible:_inputFrame];
|
||||
[[_tokenScrollView documentView] scrollPoint:_CGPointMake(0, _inputFrame.origin.y)];
|
||||
};
|
||||
|
||||
for (var i = 0, count = [tokens count]; i < count; i++)
|
||||
@@ -1085,9 +1087,10 @@ var CPScrollDestinationNone = 0,
|
||||
inputElement.focus();
|
||||
}
|
||||
|
||||
// Trim off any excess height downwards.
|
||||
if (_CGRectGetHeight([contentView bounds]) > offset.y + tokenHeight)
|
||||
[contentView setFrame:_CGRectMake(0, 0, _CGRectGetWidth([_tokenScrollView bounds]), offset.y + tokenHeight)];
|
||||
// Trim off any excess height downwards (in case we shrank).
|
||||
var scrollHeight = offset.y + tokenHeight + CEIL(spaceBetweenTokens.height / 2.0);
|
||||
if (_CGRectGetHeight([contentView bounds]) > scrollHeight)
|
||||
[contentView setFrameSize:_CGSizeMake(_CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)];
|
||||
|
||||
if (_shouldScrollTo !== CPScrollDestinationNone)
|
||||
{
|
||||
@@ -1112,7 +1115,7 @@ var CPScrollDestinationNone = 0,
|
||||
if (!aToken)
|
||||
return;
|
||||
|
||||
return [[_tokenScrollView documentView] scrollRectToVisible:[aToken frame]];
|
||||
return [[_tokenScrollView documentView] scrollPoint:_CGPointMake(0, [aToken frameOrigin].y)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -1031,13 +1031,13 @@ var themedButtonValues = nil,
|
||||
[@"editor-inset", CGInsetMake(2.0, 0.0, 0.0, 0.0)],
|
||||
|
||||
// Non-bezeled token field with tokens
|
||||
[@"content-inset", CGInsetMake(5.0, 8.0, 4.0, 8.0)],
|
||||
[@"content-inset", CGInsetMake(6.0, 8.0, 4.0, 8.0)],
|
||||
|
||||
// Non-bezeled token field with no tokens
|
||||
[@"content-inset", CGInsetMake(7.0, 8.0, 6.0, 8.0), CPTextFieldStatePlaceholder],
|
||||
|
||||
// Bezeled token field with tokens
|
||||
[@"content-inset", CGInsetMake(6.0, 8.0, 2.0, 8.0), CPThemeStateBezeled],
|
||||
[@"content-inset", CGInsetMake(6.0, 5.0, 4.0, 5.0), CPThemeStateBezeled],
|
||||
|
||||
// Bezeled token field with no tokens
|
||||
[@"content-inset", CGInsetMake(8.0, 8.0, 7.0, 8.0), CPThemeStateBezeled | CPTextFieldStatePlaceholder]
|
||||
|
||||
Reference in new issue
Block a user