# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/Extensions/NSScreen+currentScreenForMouseLocation.swift

    Line

    Count

    Source

    1

    //

    2

    //  NSScreen+mouseCoordinates.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 3/5/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Cocoa

    10

    11

    var NSScreenTesting = false

    12

    var NSScreenMockScreen: NSScreen?

    13

    extension NSScreen {

    14

    11

        static func currentScreenForMouseLocation() -> NSScreen? {

    15

    11

            if NSScreenTesting {

    16

    7

                return NSScreenMockScreen

    17

    7

            }

    18

    4

            let mouseLocation = NSEvent.mouseLocation

    19

    7

            return screens.first(where: { NSMouseInRect(mouseLocation, $0.frame, false) })

    20

    11

        }

    21

    }