# AbstractMoveableScreen

The `AbstractMoveableScreen` class extends `Screen` to provide a framework for creating editor screens with movable widgets. It handles widget rendering, input (dragging, clicking, scrolling), and context menus, enabling users to position and configure widgets interactively.

### Class Variables

* **WidgetRenderer widgetRenderer**: Manages rendering and interaction for widgets on this screen.
* **GlobalConfig.get().getSnapSize()**: Defines grid divisions for widget snapping during dragging (default: 100; higher values create smaller grids).

### Constructor

```java
public AbstractMoveableScreen(Text title, WidgetRenderer renderer)
```

* **Parameters**: `title` sets the screen title; `renderer` provides the widget renderer.

### Key Methods

* **onDisplayed()**: Sets `widgetRenderer.isInEditor` to `true` when the screen opens.
* **render(DrawContext, int, int, float)**: Renders the screen title, background (if no world), widgets via `widgetRenderer.renderWidgets`, and tooltips if enabled in `GlobalConfig`. Also renders context menus via `ContextMenuManager`.
* **close()**: Resets `widgetRenderer.isInEditor` to `false`, calls `widgetRenderer.onCloseScreen`, and closes context menus.
* **mouseDragged(double, double, int, double, double)**: Handles widget dragging with snapping based on `GlobalConfig.get().getSnapSize()`.
* **handleClickOnWidget(Widget, double, double, int)**: Customizable method for handling widget clicks (e.g., toggling visibility).
* **shouldPause()**: Returns `false` by default, preventing game pause.

### Input Handling

Overrides input methods (`mouseClicked`, `mouseReleased`, `keyPressed`, etc.) to delegate to `widgetRenderer` and `ContextMenuManager`, supporting widget dragging, context menu interactions, and keyboard controls (e.g., Delete/Backspace for widget actions).

Ensure `widgetRenderer` is initialized with widgets, or the screen will be empty.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tanishisherewith.gitbook.io/dynamic-hud/screens/abstractmoveablescreen.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
