Ich muss die Cursorgeschwindigkeit für Präzisionsbewegung der Maus verlangsamen, wenn der Benutzer eine bestimmte Taste gedrückt hält. Gibt es dafür eine API? Ich habe versucht, die Mausposition zu bekommen und seine Position auf die Hälfte zu setzen, aber es funktioniert nicht.Mac-Cursor-Geschwindigkeit programmgesteuert ändern
let mouseLoc = NSEvent.mouseLocation
// get the delta
let deltaX = mouseLoc.x - lastX
let deltaY = mouseLoc.y - lastY
lastX = mouseLoc.x; lastY = mouseLoc.y
// add to the current position by half of the real mouse position
var x = currentMousePos.x + (deltaX/2)
var y = currentMousePos.y + (deltaY/2)
// invert the y and set the mouse pos
CGDisplayMoveCursorToPoint(CGMainDisplayID(), carbonPoint(from: currentMousePos))
currentMousePos = NSPoint(x: x, y: y)
Wie ändern Sie die Cursorgeschwindigkeit?
Ich habe mir Mac Mouse/Trackpad Speed Programmatically angesehen, aber die Funktion ist veraltet.
Ich bin mir bewusst von diesem Post, aber sie verwenden eine veraltete API: [Mac Maus/Trackpad Geschwindigkeit Programmatisch] (https://stackoverflow.com/questions/10448843/mac-mouse-trackpad-speed-programmatically) – fuzzyCap