Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6f8ea731c | ||
|
|
5f2ece38fc | ||
|
|
4cad2a9db3 | ||
|
|
e4fe3e9d43 |
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.3.6</string>
|
||||
<string>1.4.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>16</string>
|
||||
<string>17</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -110,11 +110,41 @@ class PPOverlayController: NSWindowController {
|
||||
case kVK_RightArrow:
|
||||
PPState.shared.chosenFormat = PPState.shared.chosenFormat.next()
|
||||
updateInfoPanel(lastHighlightedColor, lastHighlightedColor.bestContrastingColor())
|
||||
case kVK_ANSI_K:
|
||||
moveByPixel(dx: 0.0, dy: 1.0)
|
||||
// Move up
|
||||
break
|
||||
case kVK_ANSI_J:
|
||||
moveByPixel(dx: 0.0, dy: -1.0)
|
||||
// Move down
|
||||
break
|
||||
case kVK_ANSI_H:
|
||||
moveByPixel(dx: -1.0, dy: 0.0)
|
||||
// Move left
|
||||
break
|
||||
case kVK_ANSI_L:
|
||||
moveByPixel(dx: 1.0, dy: 0.0)
|
||||
// Move right
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func moveByPixel(dx: CGFloat, dy: CGFloat) {
|
||||
var mouseLoc = lastMouseLocation
|
||||
let currentScreen = getScreenWithMouse()
|
||||
guard let screenFrame = currentScreen?.frame, let screenScale = currentScreen?.backingScaleFactor else {
|
||||
return
|
||||
}
|
||||
mouseLoc.x += dx / screenScale
|
||||
mouseLoc.y += dy / screenScale
|
||||
lastMouseLocation = mouseLoc
|
||||
updatePreview(aroundPoint: mouseLoc)
|
||||
mouseLoc.y = screenFrame.maxY - mouseLoc.y
|
||||
CGDisplayMoveCursorToPoint(0, mouseLoc)
|
||||
}
|
||||
|
||||
// Enable "focusMode" when correct modifier flag is changed.
|
||||
override func flagsChanged(with event: NSEvent) {
|
||||
if isEnabled {
|
||||
@@ -228,6 +258,15 @@ class PPOverlayController: NSWindowController {
|
||||
infoPanel.setFrame(rect, display: false)
|
||||
}
|
||||
|
||||
// Get the screen that current has displayed the mouse.
|
||||
func getScreenWithMouse() -> NSScreen? {
|
||||
let mouseLocation = NSEvent.mouseLocation
|
||||
let screens = NSScreen.screens
|
||||
let screenWithMouse = (screens.first { NSMouseInRect(mouseLocation, $0.frame, false) })
|
||||
|
||||
return screenWithMouse
|
||||
}
|
||||
|
||||
// Updates the info panel with the correct colors and text.
|
||||
func updateInfoPanel(_ color: NSColor, _ contrastingColor: NSColor) {
|
||||
infoWrapper.layer?.backgroundColor = color.cgColor
|
||||
|
||||
@@ -34,6 +34,7 @@ After you've installed Pixel Picker, it will live in your menu bar. You have man
|
||||
* Configure a keyboard shortcut in the dropdown menu and press that to activate the picker
|
||||
* Select the "Pick a Pixel" item in the dropdown menu to activate the picker
|
||||
* Simply right-click the menu item and the picker will activate
|
||||
* _Pro-tip:_ Use the <kbd>H</kbd>, <kbd>J</kbd>, <kbd>K</kbd> and <kbd>L</kbd> keys to move the picker pixel by pixel
|
||||
|
||||
Once you have the picker open, it should be quite straightforward! Move your mouse around the screen and click (or press <kbd>space</kbd> on the pixel you want.
|
||||
You can also hold down the <kbd>control (⌃)</kbd> key (this can be changed to another key) while the picker is open, and the picker will enter "Focus Mode". This will zoom the pixel preview even further, and will slow down the picker's movement to make it easier to pick that hard-to-get pixel!
|
||||
|
||||
Reference in New Issue
Block a user