Files
Basalt2/docs/.vitepress/dist/assets/references_elements_VisualElement.md.Db7-ADNI.js
2025-09-16 17:41:40 +02:00

2 lines
7.7 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as t,a,b as o,ag as i}from"./chunks/framework.BcrMLAmg.js";const m=JSON.parse('{"title":"VisualElement","description":"","frontmatter":{},"headers":[],"relativePath":"references/elements/VisualElement.md","filePath":"references/elements/VisualElement.md","lastUpdated":1757844696000}'),r={name:"references/elements/VisualElement.md"};function n(d,e,l,s,h,u){return o(),a("div",null,e[0]||(e[0]=[i('<h1 id="visualelement" tabindex="-1">VisualElement <a class="header-anchor" href="#visualelement" aria-label="Permalink to &quot;VisualElement&quot;"></a></h1><p><em>This is the visual element class. It serves as the base class for all visual UI elements</em><em>and provides core functionality for positioning, sizing, colors, and rendering.</em></p><p>Extends: <code>BaseElement</code></p><h2 id="properties" tabindex="-1">Properties <a class="header-anchor" href="#properties" aria-label="Permalink to &quot;Properties&quot;"></a></h2><table tabindex="0"><thead><tr><th>Property</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>x</td><td>number</td><td>1</td><td>The horizontal position relative to parent</td></tr><tr><td>y</td><td>number</td><td>1</td><td>The vertical position relative to parent</td></tr><tr><td>z</td><td>number</td><td>1</td><td>The z-index for layering elements</td></tr><tr><td>width</td><td>number</td><td>1</td><td>The width of the element</td></tr><tr><td>height</td><td>number</td><td>1</td><td>The height of the element</td></tr><tr><td>background</td><td>color</td><td>black</td><td>The background color</td></tr><tr><td>foreground</td><td>color</td><td>white</td><td>The text/foreground color</td></tr><tr><td>clicked</td><td>boolean</td><td>false</td><td>Whether the element is currently clicked</td></tr><tr><td>hover</td><td>boolean</td><td>false</td><td>Whether the mouse is currently hover over the element (Craftos-PC only)</td></tr><tr><td>backgroundEnabled</td><td>boolean</td><td>true</td><td>Whether to render the background</td></tr><tr><td>focused</td><td>boolean</td><td>false</td><td>Whether the element has input focus</td></tr><tr><td>visible</td><td>boolean</td><td>true</td><td>Whether the element is visible</td></tr><tr><td>ignoreOffset</td><td>boolean</td><td>false</td><td>Whether to ignore the parent&#39;s offset</td></tr></tbody></table><h2 id="events" tabindex="-1">Events <a class="header-anchor" href="#events" aria-label="Permalink to &quot;Events&quot;"></a></h2><table tabindex="0"><thead><tr><th>Event</th><th>Parameters</th><th>Description</th></tr></thead><tbody><tr><td>onClick</td><td><code>button string, x number, y number</code></td><td>Fired on mouse click</td></tr></tbody></table><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;"></a></h2><table tabindex="0"><thead><tr><th>Method</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><a href="#visualelement-isinbounds-x-y">VisualElement:isInBounds</a></td><td>boolean</td><td>Checks if point is within bounds</td></tr><tr><td><a href="#visualelement-calculateposition">VisualElement:calculatePosition</a></td><td>number, number</td><td>Calculates the position of the element</td></tr><tr><td><a href="#visualelement-getabsoluteposition-x-y">VisualElement:getAbsolutePosition</a></td><td>number, number</td><td>Returns the absolute position of the element</td></tr><tr><td><a href="#visualelement-getrelativeposition-x-y">VisualElement:getRelativePosition</a></td><td>number, number</td><td>Returns the relative position of the element</td></tr><tr><td><a href="#visualelement-prioritize">VisualElement:prioritize</a></td><td>VisualElement</td><td>Prioritizes the element by moving it to the top of its parent&#39;s children</td></tr></tbody></table><h2 id="visualelement-isinbounds-x-y" tabindex="-1">VisualElement:isInBounds(x, y) <a class="header-anchor" href="#visualelement-isinbounds-x-y" aria-label="Permalink to &quot;VisualElement:isInBounds(x, y)&quot;"></a></h2><p>Checks if the specified coordinates are within the bounds of the element</p><h3 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position to check</li><li><code>y</code> <code>number</code> The y position to check</li></ul><h3 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>boolean</code> <code>isInBounds</code> Whether the coordinates are within the bounds of the element</li></ul><h2 id="visualelement-calculateposition" tabindex="-1">VisualElement:calculatePosition() <a class="header-anchor" href="#visualelement-calculateposition" aria-label="Permalink to &quot;VisualElement:calculatePosition()&quot;"></a></h2><p>Calculates the position of the element relative to its parent</p><h3 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>number</code> <code>x</code> The x position</li><li><code>number</code> <code>y</code> The y position</li></ul><h2 id="visualelement-getabsoluteposition-x-y" tabindex="-1">VisualElement:getAbsolutePosition(x?, y?) <a class="header-anchor" href="#visualelement-getabsoluteposition-x-y" aria-label="Permalink to &quot;VisualElement:getAbsolutePosition(x?, y?)&quot;"></a></h2><p>Returns the absolute position of the element or the given coordinates.</p><h3 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <em>(optional)</em> <code>number</code> x position</li><li><code>y</code> <em>(optional)</em> <code>number</code> y position</li></ul><h3 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>number</code> <code>x</code> The absolute x position</li><li><code>number</code> <code>y</code> The absolute y position</li></ul><h2 id="visualelement-getrelativeposition-x-y" tabindex="-1">VisualElement:getRelativePosition(x?, y?) <a class="header-anchor" href="#visualelement-getrelativeposition-x-y" aria-label="Permalink to &quot;VisualElement:getRelativePosition(x?, y?)&quot;"></a></h2><p>Returns the relative position of the element or the given coordinates.</p><h3 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <em>(optional)</em> <code>number</code> x position</li><li><code>y</code> <em>(optional)</em> <code>number</code> y position</li></ul><h3 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>number</code> <code>x</code> The relative x position</li><li><code>number</code> <code>y</code> The relative y position</li></ul><h2 id="visualelement-prioritize" tabindex="-1">VisualElement:prioritize() <a class="header-anchor" href="#visualelement-prioritize" aria-label="Permalink to &quot;VisualElement:prioritize()&quot;"></a></h2><p>This function is used to prioritize the element by moving it to the top of its parent&#39;s children. It removes the element from its parent and adds it back, effectively changing its order.</p><h3 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>VisualElement</code> <code>self</code> The VisualElement instance</li></ul>',35)]))}const b=t(r,[["render",n]]);export{m as __pageData,b as default};