mirror of
https://github.com/rfc2822/GfxTablet
synced 2025-10-04 18:19:16 +02:00
update Android client to use [0,UINT16_MAX) as its range of values
This commit is contained in:
parent
2ae8c7f213
commit
5865d3c81e
2 changed files with 6 additions and 5 deletions
|
@ -124,17 +124,18 @@ public class CanvasView extends View implements SharedPreferences.OnSharedPrefer
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
// these overflow and wrap around to negative short values, but thankfully Java will continue
|
||||
// on regardless, so we can just ignore Java's interpretation of them and send them anyway.
|
||||
short normalizeX(float x) {
|
||||
return (short)(Math.min(Math.max(0, x), maxX) * Short.MAX_VALUE/maxX);
|
||||
return (short)(Math.min(Math.max(0, x), maxX) * 2*Short.MAX_VALUE/maxX);
|
||||
}
|
||||
|
||||
short normalizeY(float x) {
|
||||
return (short)(Math.min(Math.max(0, x), maxY) * Short.MAX_VALUE/maxY);
|
||||
return (short)(Math.min(Math.max(0, x), maxY) * 2*Short.MAX_VALUE/maxY);
|
||||
}
|
||||
|
||||
short normalizePressure(float x) {
|
||||
return (short)(Math.min(Math.max(0, x), 2.0) * Short.MAX_VALUE/2.0);
|
||||
return (short)(Math.min(Math.max(0, x), 2.0) * Short.MAX_VALUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue