/** Draws selection, icons, and expand icons. */ private void draw (Batch batch, Array<Node> nodes, float indent, float plusMinusWidth) { Drawable plus = style.plus, minus = style.minus; float x = getX(), y = getY(), expandX = x + indent, iconX = expandX + plusMinusWidth + iconSpacingLeft; for (int i = 0, n = nodes.size; i < n; i++) { Node node = nodes.get(i); float height = node.height; Actor actor = node.actor; if (selection.contains(node) && style.selection != null) { style.selection.draw(batch, x, y + actor.getY() - ySpacing / 2, getWidth(), height + ySpacing); } else if (node == overNode && style.over != null) { style.over.draw(batch, x, y + actor.getY() - ySpacing / 2, getWidth(), height + ySpacing); } if (node.icon != null) { float iconY = y + actor.getY() + Math.round((height - node.icon.getMinHeight()) / 2); batch.setColor(actor.getColor()); node.icon.draw(batch, iconX, iconY, node.icon.getMinWidth(), node.icon.getMinHeight()); batch.setColor(Color.WHITE); } if (node.children.size == 0) continue; Drawable expandIcon = node.expanded ? minus : plus; float iconY = y + actor.getY() + Math.round((height - expandIcon.getMinHeight()) / 2); expandIcon.draw(batch, expandX, iconY, expandIcon.getMinWidth(), expandIcon.getMinHeight()); if (node.expanded) draw(batch, node.children, indent + indentSpacing, plusMinusWidth); } }
/** Draws selection, icons, and expand icons. */ private void draw (Batch batch, Array<Node> nodes, float indent, float plusMinusWidth) { Drawable plus = style.plus, minus = style.minus; float x = getX(), y = getY(), expandX = x + indent, iconX = expandX + plusMinusWidth + iconSpacingLeft; for (int i = 0, n = nodes.size; i < n; i++) { Node node = nodes.get(i); float height = node.height; Actor actor = node.actor; if (selection.contains(node) && style.selection != null) { style.selection.draw(batch, x, y + actor.getY() - ySpacing / 2, getWidth(), height + ySpacing); } else if (node == overNode && style.over != null) { style.over.draw(batch, x, y + actor.getY() - ySpacing / 2, getWidth(), height + ySpacing); } if (node.icon != null) { float iconY = y + actor.getY() + Math.round((height - node.icon.getMinHeight()) / 2); batch.setColor(actor.getColor()); node.icon.draw(batch, iconX, iconY, node.icon.getMinWidth(), node.icon.getMinHeight()); batch.setColor(Color.WHITE); } if (node.children.size == 0) continue; Drawable expandIcon = node.expanded ? minus : plus; float iconY = y + actor.getY() + Math.round((height - expandIcon.getMinHeight()) / 2); expandIcon.draw(batch, expandX, iconY, expandIcon.getMinWidth(), expandIcon.getMinHeight()); if (node.expanded) draw(batch, node.children, indent + indentSpacing, plusMinusWidth); } }
/** Draws selection, icons, and expand icons. */ private void draw (Batch batch, Array<Node> nodes, float indent, float plusMinusWidth) { Drawable plus = style.plus, minus = style.minus; float x = getX(), y = getY(), expandX = x + indent, iconX = expandX + plusMinusWidth + iconSpacingLeft; for (int i = 0, n = nodes.size; i < n; i++) { Node node = nodes.get(i); float height = node.height; Actor actor = node.actor; if (selection.contains(node) && style.selection != null) { style.selection.draw(batch, x, y + actor.getY() - ySpacing / 2, getWidth(), height + ySpacing); } else if (node == overNode && style.over != null) { style.over.draw(batch, x, y + actor.getY() - ySpacing / 2, getWidth(), height + ySpacing); } if (node.icon != null) { float iconY = y + actor.getY() + Math.round((height - node.icon.getMinHeight()) / 2); batch.setColor(actor.getColor()); node.icon.draw(batch, iconX, iconY, node.icon.getMinWidth(), node.icon.getMinHeight()); batch.setColor(Color.WHITE); } if (node.children.size == 0) continue; Drawable expandIcon = node.expanded ? minus : plus; float iconY = y + actor.getY() + Math.round((height - expandIcon.getMinHeight()) / 2); expandIcon.draw(batch, expandX, iconY, expandIcon.getMinWidth(), expandIcon.getMinHeight()); if (node.expanded) draw(batch, node.children, indent + indentSpacing, plusMinusWidth); } }