/** * Check to see if the touch has moved off of the element. * * <p>NOTE that in iOS the elasticScroll may make the touch/move cancel more difficult. * * @param event */ private void onTouchMove(Event event) { if (!this.touchMoved) { Touch move = null; for (int i = 0; i < event.getChangedTouches().length(); i++) { if (event.getChangedTouches().get(i).getIdentifier() == this.touchId) { move = event.getChangedTouches().get(i); } } // Check to see if we moved off of the original element // Use Page coordinates since we compare with widget's absolute // coordinates if (move != null) { int yCord = move.getPageY(); int xCord = move.getPageX(); // is y above element boolean yTop = this.getAbsoluteTop() > yCord; boolean yBottom = (this.getAbsoluteTop() + this.getOffsetHeight()) < yCord; // y below // is x to the left of element boolean xLeft = this.getAbsoluteLeft() > xCord; boolean xRight = (this.getAbsoluteLeft() + this.getOffsetWidth()) < xCord; // x to the right if (yTop || yBottom || xLeft || xRight) { this.touchMoved = true; onHoldPressOffStyle(); // Go back to normal style } } } }