TauCrosshairStyle¶
Inherits: TauStyle
Controls the visual appearance of the crosshair guide lines drawn at the hovered position.
Description¶
The crosshair draws up to two guide lines in the hovered pane. The X line crosses the pane at the hovered X position, the Y line at the hovered Y position, and each spans the pane from edge to edge. TauCrosshairStyle controls their color, their stroke width, and their dash length.
Which of the two lines appears comes from TauHoverConfig.crosshair_mode, not from this class. Both lines are drawn alike, so a plot cannot style one differently from the other.
TauCrosshairStyle lives on TauHoverConfig.crosshair_style. It is created with TauHoverConfig and is never null. Several TauHoverConfig instances can share the same instance.
Three-layer cascade¶
Each property is resolved in three layers: the built-in default, then the value the active Godot theme names, then the value assigned on this instance. A property counts as overridden as soon as it is assigned, whatever the value, and for an array property only assigning a new array counts.
See TauStyle for the cascade and TauStyle for the grammar of the keys listed in Theming.
Theming¶
TauCrosshairStyle reads its keys from the TauCrosshair theme type variation, whose base type is Control.
A theme resource using TauCrosshair must 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. |
One crosshair is drawn at a time, in the hovered pane, so no key takes a pane index.
Side effects¶
All properties are visual-only. A change triggers a redraw and never a layout recomputation.
Example¶
var hover := TauHoverConfig.new()
hover.crosshair_mode = TauHoverConfig.CrosshairMode.BOTH
hover.crosshair_style.color = Color(1, 1, 1, 0.6)
hover.crosshair_style.dash_px = 0
Constructor¶
new()¶
Creates a TauCrosshairStyle holding the built-in default of every property.
Properties¶
color¶
color: Color
Color of the crosshair guide lines. Default is Color(1, 1, 1, 0.4).
thickness_px¶
thickness_px: int
Stroke width in pixels of the crosshair guide lines. Default is 1.
Values below 1 are raised to 1 on assignment, so the crosshair cannot be hidden this way. Use TauHoverConfig.crosshair_mode instead.
dash_px¶
dash_px: int
Length in pixels of one dash of the crosshair guide lines, with an equal gap between dashes. Default is 4.
0 draws solid lines. Values below 0 are raised to 0 on assignment.
Related Classes¶
TauStyleBase class. Defines the cascade, the cycle indexing, and the theme key grammar.TauHoverConfigOwns theTauCrosshairStyleinstance through itscrosshair_styleproperty, and decides which guide lines are drawn.TauPlotThe plot node. Resolves the cascade and holds the Godot theme the second layer reads.TauXYStyleSibling style resource for the plot as a whole.TauPaneStyleSibling style resource for the contents of one pane.TauBarStyleSibling style resource for bar overlays.TauScatterStyleSibling style resource for scatter overlays.TauLineStyleSibling style resource for line overlays.TauLegendStyleSibling style resource for the legend.TauTooltipStyleSibling style resource for the hover tooltip.