|
3 | 3 | import objc
|
4 | 4 | from GlyphsApp import *
|
5 | 5 | from GlyphsApp.plugins import *
|
6 |
| -from AppKit import NSApplication, NSGraphicsContext, NSColor, NSMakeRect, NSInsetRect, NSMakePoint, NSAlternateKeyMask, NSBeep, NSNumberFormatter, NSValueTransformer, NSEventTypeLeftMouseDown, NSEventTypeLeftMouseDragged, NSEventTypeMouseMoved, NSEventTypeLeftMouseUp, NSEventTypePressure, NSEventTypeTabletPoint |
| 6 | +from AppKit import NSApplication, NSGraphicsContext, NSColor, NSMakeRect, NSInsetRect, NSMakePoint, NSAlternateKeyMask, NSBeep, NSNumberFormatter, NSValueTransformer, NSLeftMouseDown, NSLeftMouseUp, NSMouseMoved, NSLeftMouseDragged |
| 7 | + |
7 | 8 | from Foundation import NSNotFound, NSNumber, NSMutableDictionary
|
8 | 9 | import math
|
9 | 10 | import collections
|
10 | 11 | import contextlib
|
11 | 12 |
|
| 13 | +VALID_EVENT_TYPES = (NSLeftMouseDown, NSLeftMouseUp, NSMouseMoved, NSLeftMouseDragged) |
| 14 | + |
12 | 15 | @contextlib.contextmanager
|
13 | 16 | def currentGraphicsContext(context=None):
|
14 | 17 | context = context or NSGraphicsContext.currentContext()
|
@@ -321,10 +324,9 @@ def background(self, layer):
|
321 | 324 | font = layer.parent.parent
|
322 | 325 | master = font.masters[layer.associatedMasterId or layer.layerId]
|
323 | 326 | event = NSApplication.sharedApplication().currentEvent()
|
324 |
| - valid_event_types = (NSEventTypeLeftMouseDragged, NSEventTypeMouseMoved, NSEventTypeLeftMouseUp, NSEventTypePressure, NSEventTypeTabletPoint) |
325 | 327 | arrange_anchors(font, master, layer)
|
326 | 328 | self.update_grid_subdivision(event)
|
327 |
| - self.sync_values(font, master, layer, needs_round=event.type() in valid_event_types if event else False) |
| 329 | + self.sync_values(font, master, layer, needs_round=event.type() in VALID_EVENT_TYPES if event else False) |
328 | 330 | with currentGraphicsContext() as ctx:
|
329 | 331 | dotted = False
|
330 | 332 | has_unbalanced_palt = sum((1 if value is None else 0 for value in (self.LSBValue, self.RSBValue))) == 1
|
|
0 commit comments