mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-17 05:51:18 +00:00
Avoid usage of [event keyCode].
Key codes have platform and browser specific behaviours.
This commit is contained in:
1 parent
9e92947b2c
commit
4445f752f3
2 files changed
+5
-3
No files matched your search
@@ -456,8 +456,8 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
}
|
||||
else if (type === CPKeyDown)
|
||||
{
|
||||
var keyCode = [anEvent keyCode];
|
||||
if (keyCode === CPEscapeKeyCode)
|
||||
var characters = [anEvent characters];
|
||||
if (characters === CPEscapeFunctionKey)
|
||||
{
|
||||
_dragOperation = CPDragOperationNone;
|
||||
[self draggingEndedInPlatformWindow:platformWindow globalLocation:CGPointMakeZero() operation:_dragOperation];
|
||||
|
||||
@@ -672,7 +672,9 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
- (void)keyDown:(CPEvent)anEvent
|
||||
{
|
||||
if ([anEvent keyCode] === CPReturnKeyCode)
|
||||
var characters = [anEvent characters];
|
||||
// Treat \r and \n the same. See issue #710.
|
||||
if (characters === CPNewlineCharacter || characters === CPCarriageReturnCharacter)
|
||||
{
|
||||
// selectText: has a side effect - it can change first responder of the window
|
||||
// we have to prevent such behaviour inside this method because target should be able to change first responder after receiving action.
|
||||
|
||||
Reference in new issue
Block a user