# AbstractMoveableScreen

## AbstractMoveableScreen

The [`AbstractMoveableScreen`](https://github.com/V-Fast/DynamicHUD/blob/master/src/main/java/com/tanishisherewith/dynamichud/huds/AbstractMoveableScreen.java) class extends the `Screen` class and provides additional functionality for creating moveable screens in Minecraft Fabric.

### Fields

* `dynamicutil`: The `DynamicUtil` instance used by this screen.
* `mc`: The `MinecraftClient` instance.
* `selectedWidget`: The currently selected widget.
* `dragStartX`, `dragStartY`: The starting position of a drag operation.
* `List<contextMenu>`: The List of context menu that are currently being displayed.
* `colorPicker`: The color picker that is currently displayed.
* `sliderWigdet`: The widget that is currently being edited by the slider.
* `List<Slider>`: The List of sliders.
* `mouseHandler`: The mouse handler for this screen.
* `dragHandler`: The drag handler for this screen.
* `gridSize`: The size of each grid cell in pixels.
* `ShouldPause`: Whether to pause if the screen is opened or not.
* `ShouldBeAffectedByResize`: Whether the stuff drawn on screen should be affected by screen resize or not.
* `WidgetX`: X position of the selected widget.
* `WidgetY`: Y position of the selected widget.

### Constructors

#### AbstractMoveableScreen(Text title, DynamicUtil dynamicutil)

Constructs an `AbstractMoveableScreen` object with the given title and dynamicutil instance.

### Methods

#### mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)

Handles mouse dragging on this screen. This method updates the position of the selected widget while dragging.

#### mouseReleased(double mouseX, double mouseY, int button)

Handles mouse release events on this screen. This method stops dragging or scaling the selected widget.

#### mouseClicked(double mouseX, double mouseY, int button)

Handles mouse clicks on this screen. This method starts dragging a widget if it was clicked.

#### render(MatrixStack matrices, int mouseX, int mouseY, float delta)

Renders this screen and its widgets on the screen.

#### setGridSize(int gridSize)

Sets the size of each grid cell in pixels.

#### setShouldPause(boolean shouldpause)

Sets whether to pause if the screen is opened or not.

#### setShouldBeAffectedByResize(boolean shouldBeAffectedByResize)

Sets whether the stuff drawn on screen should be affected by screen resize or not.

#### resize(MinecraftClient client, int width, int height)

Resizes this screen. If `ShouldBeAffectedByResize` is true, this method calls the superclass's implementation of this method.

#### shouldPause()

Returns whether to pause if the screen is opened or not.

#### handleRightClickOnWidget(Widget widget)

An abstract method that must be implemented by subclasses to handle right-clicks on widgets.

#### menu(Widget widget, int x, int y)

An abstract method that must be implemented by subclasses to display a context menu for a widget at the given position.


---

# 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/archived-legacy-dynamichud/moveable-screen/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.
