Improve loads of fancy things in relation to the mouse pointer
This commit is contained in:
@@ -4,8 +4,6 @@ import AppKit
|
||||
final class CodeTextView: PointerBoundTextView {
|
||||
weak var controller: CodeEditorController?
|
||||
|
||||
/// Pointer travel that still counts as a click and not as a text selection.
|
||||
private static let dragSlop: CGFloat = 4
|
||||
private var pointerTracking: NSTrackingArea?
|
||||
|
||||
override func drawBackground(in rect: NSRect) {
|
||||
@@ -20,14 +18,7 @@ final class CodeTextView: PointerBoundTextView {
|
||||
|
||||
override func mouseDown(with event: NSEvent) {
|
||||
if event.modifierFlags.contains(.command), controller?.followSymbol(at: event) == true { return }
|
||||
let hadSelection = selectedRange().length > 0
|
||||
let down = event.locationInWindow
|
||||
super.mouseDown(with: event)
|
||||
guard event.clickCount == 1, !hadSelection, selectedRange().length == 0,
|
||||
event.modifierFlags.isDisjoint(with: [.shift, .option, .command, .control]),
|
||||
let up = window?.mouseLocationOutsideOfEventStream,
|
||||
abs(up.x - down.x) + abs(up.y - down.y) <= Self.dragSlop else { return }
|
||||
controller?.plainClick(atWindowPoint: down)
|
||||
}
|
||||
|
||||
override func menu(for event: NSEvent) -> NSMenu? {
|
||||
|
||||
Reference in New Issue
Block a user