mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-28 14:37:04 +00:00
fixed: target index in selection dragging was sometimes wrong
This commit is contained in:
@@ -942,11 +942,11 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
_movingSelection = CPMakeRange(_startTrackingLocation, 0);
|
||||
var dragPlaceholder = [CPTextField new],
|
||||
originPoint = [_layoutManager locationForGlyphAtIndex:[self selectedRange].location];
|
||||
|
||||
originPoint.y -= [_layoutManager _descentAtLocation:_selectionRange.location];
|
||||
|
||||
originPoint.y += [_layoutManager _characterOffsetAtLocation:_selectionRange.location] + _textContainerOrigin.y - 1;
|
||||
originPoint.x += _textContainerOrigin.x;
|
||||
originPoint.y += _textContainerOrigin.y;
|
||||
|
||||
dragPlaceholder._DOMElement.style.opacity = '0.6';
|
||||
[dragPlaceholder setStringValue:[[self stringValue] substringWithRange:_selectionRange]];
|
||||
[dragPlaceholder sizeToFit];
|
||||
|
||||
@@ -2025,6 +2025,9 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
return;
|
||||
}
|
||||
|
||||
if (_movingSelection.location > CPMaxRange(_selectionRange))
|
||||
_movingSelection.location -= _selectionRange.length;
|
||||
|
||||
[self _deleteForRange:_selectionRange];
|
||||
[self setSelectedRange:_movingSelection];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user