Using the Rectangle nodes

Use the Rectangle nodes to draw rectangles.

Creating a rectangle

To create a rectangle:

  1. In the Node Tree or Prefabs press Alt and right-click the node where you want to create a Rectangle node and select either Rectangle 3D, or Rectangle 2D.

    Note that you can create a 3D node only inside 3D nodes, and a 2D node only inside 2D nodes.

    ../_images/create-rectangle-2d1.png ../_images/rectangle-2d-in-node-tree1.png
  2. Set the fill and stroke of the rectangle. See Filling a shape and Using stroke.

    ../_images/rectangle-2d-with-fill-and-stroke.png
  3. In the Properties add and set:

    • Rectangle Width and Rectangle Height to set the size of the rectangle

    • Rectangle Top-Left Corner to the position along the x and y axis where you want to set the top-left corner of the rectangle

    • Corner Radius to the amount of roundness that you want for the corners of the rectangle along the x and y axis

    ../_images/rectangle-2d-size-corners.png

Setting the input area for a Rectangle 2D node

When you enable hit testing for a node with the Input > Hit Testable property, the entire area of that node receives input by default.

To make only the area formed by the composited geometry of the shapes in a 2D shape node receive input, in the Node Tree or Prefabs select that node and in the Properties add and enable the Shape > Exact Hit Test property.

../_images/hit-testable-enabled.png ../_images/exact-hit-test-enabled.png

To learn about handling user input in Kanzi, in the Kanzi framework documentation see Working with > Input.