I'm working on a nokia 5800, which has a very large screen size (360x640). The hardcoded touch sensitivity is set to 5 pixels out of the box, but I need to be able to configure that at runtime, or buildtime without swapping Kuix libraries. 5 pixels is way too easy drag on a 360x640 display, which makes almost all interactions considered "drags" instead of "clicks"
anyways, here's what I have that allows me to change that value per-device.
KuixCanvas PATCH
--- KuixCanvas.java (revision 133) +++ KuixCanvas.java (working copy) @@ -130,6 +130,9 @@ private byte debugInfosKeyCounter = 0; private boolean debugInfosEnabled = false; private long lastFpsTickTime = 0; + + // controls the touchscreen sensitivity, lower is more sensitive, higher is less + private int touchDragThreshold = 5; /** * Construct a {@link KuixCanvas}. By default the canvas is auto created by @@ -929,7 +932,7 @@ * @see javax.microedition.lcdui.Canvas#pointerDragged(int, int) */ protected void pointerDragged(int x, int y) { - if (pointerDragged || Math.abs(x - pointerPressedX) > 5 || Math.abs(y - pointerPressedY) > 5) { + if (pointerDragged || Math.abs(x - pointerPressedX) > touchDragThreshold || Math.abs(y - pointerPressedY) > touchDragThreshold) { pointerDragged = true; processPointerEvent(KuixConstants.POINTER_DRAGGED_EVENT_TYPE, x, y); } @@ -1422,4 +1440,8 @@ return KuixConstants.NOT_DEFINED_KEY; } + public void setTouchDragThreshold(int i) { + touchDragThreshold = i; + } + }
|
Thanks for this. I noticed this as a problem on the N5800 too but never thought to look at the Kuix code. This will come in useful.