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.
This commit is contained in:
Benjamin Tissoires 2019-04-23 11:39:18 +02:00
parent 6d74615085
commit c21c8a4633
1 changed files with 1 additions and 20 deletions

View File

@ -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