diff options
Diffstat (limited to 'pixelmappers')
-rw-r--r-- | pixelmappers/SimpleMapper.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pixelmappers/SimpleMapper.py b/pixelmappers/SimpleMapper.py index 5d4dceb..5df1032 100644 --- a/pixelmappers/SimpleMapper.py +++ b/pixelmappers/SimpleMapper.py @@ -1,11 +1,14 @@ from operationscore.PixelMapper import * import util.Geo as Geo +import sys class SimpleMapper(PixelMapper): def mappingFunction(self, eventLocation, screen): if type(eventLocation) == type(tuple()): - bestDist = 10**10 #don't kill me, I'm lazy + bestDist = sys.maxint bestPixel = None - for pixel in screen: + [x,y] = eventLocation + for (x,pixel) in screen.pixelsInRange(x-self['CutoffDist'], \ + x+self['CutoffDist']): pixelDist = Geo.dist(pixel.location, eventLocation) if pixelDist < bestDist: bestPixel = pixel |