From c21c8a4633c0d31837ddacdf01f943e3a89de580 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 23 Apr 2019 11:39:18 +0200 Subject: [PATCH] wacom: do not use relative data when exporting we already are keeping a record of the x,y and p. So we are trying to duplicate the effort by using new_rel. The problem is that some reports have relative coordinates but absolute pressure data. Which means we are missing the pressure change as it has a relative value of 0. By trusting the wacom internal state, we can have the json data that matches it completely. --- tuhi/wacom.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index d0e9b73..a1908f2 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -773,8 +773,6 @@ class WacomProtocolBase(WacomProtocolLowLevelComm): drawing = Drawing(self.device.name, (self.width, self.height), timestamp) - have_abs = 0x00 # bitmask 3-bits: pyx - while offset < len(data): packet = WacomPacket(data[offset:]) logger.debug(f'packet: {packet}') @@ -808,24 +806,7 @@ class WacomProtocolBase(WacomProtocolLowLevelComm): if packet.bitmask & 0b00111100 == 0: continue - if not xrel: - have_abs |= 0x1 - if not yrel: - have_abs |= 0x2 - if not prel: - have_abs |= 0x4 - - if xrel or yrel or prel: - if not stroke.points: - if have_abs == 0x7: - logger.info('Forcing first point to be absolute') - stroke.new_abs((x, y), p) - else: - logger.warning('First point in stroke is relative, skipping') - continue - stroke.new_rel((dx, dy), dp) - else: - stroke.new_abs((x, y), p) + stroke.new_abs((x, y), p) drawing.seal() return drawing