The Hierarchy panel is the primary navigator for your scene. It maintains a live list of every object currently inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/OmarMtya/engine.js/llms.txt
Use this file to discover all available pages before exploring further.
$g.figuras and lets you select, inspect, and reorder them without ever touching the canvas directly. Understanding how the Hierarchy works — especially how render order relates to array position — is essential for building well-layered scenes.
Panel Structure
The Hierarchy panel is the<aside id="jerarquia"> element. It renders inside a scrollable container with its own padding so long object lists stay readable. Internally it contains a single <div class="objetos"> node whose children are rebuilt from scratch every time actualizarLista() is called.
Each object appears as a <p> element whose id matches the object’s unique id field:
Object type icons
The colored icon at the right of each row makes it easy to identify an object’s type at a glance. The icon color is driven by the object’stransform.relleno fill property so it always matches what you see on the canvas.
| Type value | Icon class | Color source |
|---|---|---|
cuadrado | fas fa-square | obj.transform.relleno |
circulo | fas fa-circle | obj.transform.relleno |
imagen / sprite | far fa-images | (no color applied) |
Auto-hide Behavior
The Hierarchy panel is invisible (display: none) by default. The validarJerarquia() function runs every time the object list changes and shows or hides the panel based on whether $g.figuras contains any entries:
Selecting Objects
Click any row in the Hierarchy to select the corresponding scene object. Selecting an object does three things:- Adds the
seleccionadoCSS class to the clicked row — a blue highlight (background-color: #3481E3, white text) that clearly marks the active selection. - Sets the global
objetoSeleccionadovariable to the matchingFigurainstance from$g.figuras. - Shows the Attributes panel (
#atributos) and populates it with all of the object’s current property values.
$g.clickListener callback (registered via $g.DetectarClick()) calls actualizarLista() and then seleccionarObjeto(false) so the Hierarchy highlights the correct row even when the selection originates from the canvas.
During Play mode the
actualizarLista(true) call is made with removerListeners = true. This strips the onclick handler and the objeto-seleccionable cursor class from every row, making the Hierarchy display-only while the scene is running. Click listeners are restored automatically when you press Pause.Render Order and Layers
Objects in$g.figuras are drawn in array order: index 0 is the bottommost layer and the last index is the topmost. The Hierarchy list mirrors this order top-to-bottom, so the first item in the panel is drawn first (behind everything else) and the last item is drawn on top.
You can change an object’s layer position using the up (↑) and down (↓) arrow buttons in the Attributes panel header. These perform an in-place splice on $g.figuras:
Deleting Objects
To remove an object from the scene, select it and click the trash icon (far fa-trash-alt) in the Attributes panel header. The handler splices the object out of $g.figuras by its id, hides the Attributes panel, clears objetoSeleccionado, and triggers a full redraw:
validarJerarquia() will automatically hide the Hierarchy panel.
Adding New Objects
New objects are added from the configuration bar at the bottom of the editor. Each button creates aFigura with sensible defaults and places it at canvas position (100, 100):
| Button | Default properties |
|---|---|
fas fa-square (Add square) | tipo: "cuadrado", 20×20, fill #000000 |
fas fa-circle (Add circle) | tipo: "circulo", radius 10, fill #000000 |
far fa-images (Add image) | tipo: "imagen", 100×100, fill #000000 |
$g.AgregarFigura() registers the object, $g.Dibujar() renders it, and actualizarLista() refreshes the Hierarchy so the new row appears immediately.