mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-17 16:11:28 +00:00
Merge pull request #1696 from slevenbits/slevenbits-tokenfield-autocomplete-position
Fixed: token field autocomplete menu placed incorrectly.
This commit is contained in:
@@ -163,7 +163,7 @@ var _CPAutocompleteMenuMaximumHeight = 307;
|
||||
// TODO Track down why mystery constant is needed to allocate enough width. Scroll view insets?
|
||||
}
|
||||
|
||||
var frameOrigin = [textField convertPoint:origin toView:nil],
|
||||
var frameOrigin = [[textField window] convertBaseToGlobal:[textField convertPointToBase:origin]],
|
||||
screenSize = [([CPPlatform isBrowser] ? [_menuWindow platformWindow] : [_menuWindow screen]) visibleFrame].size,
|
||||
availableWidth = screenSize.width - frameOrigin.x,
|
||||
availableHeight = screenSize.height - frameOrigin.y,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -994,6 +994,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
||||
</object>
|
||||
<int key="connectionID">33</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="393836098"/>
|
||||
<reference key="destination" ref="1001"/>
|
||||
</object>
|
||||
<int key="connectionID">226</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
@@ -1439,7 +1447,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">225</int>
|
||||
<int key="maxID">226</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
||||
@@ -481,4 +481,20 @@
|
||||
[[_parentWindow contentView] setBackgroundColor:_savedColor];
|
||||
}
|
||||
|
||||
- (CPArray)tokenField:(CPTokenField)aTokenField completionsForSubstring:(CPString)substring indexOfToken:(int)tokenIndex indexOfSelectedItem:(int)selectedIndex
|
||||
{
|
||||
var choices = ["aardvark", "baa", "caaing whale"],
|
||||
r = [];
|
||||
|
||||
// Don't complete 'blank' - this would show all available matches which is excessive.
|
||||
if (!substring)
|
||||
return r;
|
||||
|
||||
for (var i = 0; i < choices.length; i++)
|
||||
if (choices[i].toLowerCase().indexOf(substring.toLowerCase()) == 0)
|
||||
r.push(choices[i]);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user