LogicalPosition (Point p) { final Point pp; if (p.x >= 0 && p.y >= 0) { pp = p; } else { pp = new Point(Math.max(p.x, 0), Math.max(p.y, 0)); } return visualToLogicalPosition(xyToVisualPosition(pp)); }