TauCrosshairStyle¶
Inherits: Resource
Controls the visual appearance of the crosshair guide lines drawn at the hovered position.
Description¶
TauCrosshairStyle controls how the crosshair looks: the color, stroke width, and dash length of the lines drawn across a pane at the hovered sample position.
The crosshair draws up to two lines per pane. An X line runs perpendicular to the X axis at the hovered X position, spanning the full pane extent along the Y direction. A Y line runs perpendicular to the Y axis at the hovered Y position, spanning the full pane extent along the X direction. Which lines appear depends on TauHoverConfig.crosshair_mode, not on TauCrosshairStyle.
TauCrosshairStyle lives on TauHoverConfig.crosshair_style. It is created automatically when TauHoverConfig is instantiated, so it is never null.
Multiple TauHoverConfig instances can reference the same TauCrosshairStyle resource. Every crosshair that holds a reference picks up any change made to that shared instance.
Three-layer cascade¶
Each property's final value is resolved through the following cascade, in order:
-
Built-in default
The final value starts from the built-in default. -
Theme value
If the active Godot theme defines a matching crosshair property, that value replaces the built-in default. -
User override
If the property is explicitly set on theTauCrosshairStyleinstance, that value overrides both the theme and the built-in default.
In short:
- the last layer that provides a value wins
- the Godot theme is suited for project-wide styling
TauCrosshairStyleis suited for per-plot styling
Override detection limitation
A property is considered overridden only when its value differs from the corresponding built-in default constant.
As a result, assigning a property to exactly its built-in default value does not force it to override the theme.
Example:
- built-in default
thickness_pxis1 - the theme sets
crosshair_thicknessto3 - setting
style.thickness_px = 1does not override the theme
Theming¶
TauCrosshairStyle reads theme values from the TauCrosshair theme type variation. Its base type is Control.
A theme resource using TauCrosshair must therefore include a base type declaration:
The following theme entries are used:
| Theme property | Description |
|---|---|
crosshair_color: Color |
Maps to color |
crosshair_thickness: int |
Maps to thickness_px |
crosshair_dash: int |
Maps to dash_px |
Side effects¶
All properties are visual-only. Every change triggers a redraw but never triggers layout recomputation.
Constructor¶
new()¶
Creates a new TauCrosshairStyle with all properties set to their built-in defaults. Properties left at their defaults remain theme-overridable.
Properties¶
color¶
color: Color
The color used to draw the crosshair lines. Default is Color(1, 1, 1, 0.4).
thickness_px¶
thickness_px: int
The stroke width in pixels of the crosshair lines. Default is 1.
dash_px¶
dash_px: int
The dash length in pixels of the crosshair lines. Default is 4.
A value of 0 produces solid lines. Any positive value switches the lines to dashed rendering with alternating segments of that length.
Related Classes¶
TauPlotThe plot node. ConsumesTauCrosshairStyleduring rendering and theme resolution.TauHoverConfigOwns theTauCrosshairStyleinstance via itscrosshair_styleproperty.TauXYStyleSibling style resource for the whole plot.TauPaneStyleSibling style resource for individual panes.TauBarStyleSibling style resource for bar overlays.TauScatterStyleSibling style resource for scatter overlays.TauLegendStyleSibling style resource for the legend.TauTooltipStyleSibling style resource for the hover tooltip.