When developing pocketed input method,I met such a thing,That is, as a candidate bar window will go beyond the screen when the edge of the screen! and so,In the display window when I do extra check the coordinates:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
if visiableCandidateCells.isEmpty { if let screenframe = NSScreen.main?.visibleFrame { if screenframe.width < location.x + size.width { location.x -= location.x + size.width - screenframe.width } } } else { if let screenframe = NSScreen.main?.visibleFrame { if screenframe.width < location.x + self.window!.frame.size.width { location.x -= location.x + self.window!.frame.size.width - screenframe.width } } } if location.y < 50 { location.y += 35 + 35 } |
In short,That is, if you count the coordinates of their width exceeds the width of the screen,Norway put it back。
but,Such[……]
Click link to continue reading...