Документация Engee

Toggle

Страница в процессе перевода.

Переключатель с атрибутом active, который может иметь значение либо true, либо false, чтобы включать или отключать свойства интерактивного графика.

using GLMakie

fig = Figure()

ax = Axis(fig[1, 1], limits = (0, 600, -2, 2))
hidexdecorations!(ax)

t = Observable(0.0)
points = lift(t) do t
    x = range(t-1, t+1, length = 500)
    @. sin(x) * sin(2x) * sin(4x) * sin(23x)
end

lines!(ax, points, color = (1:500) .^ 2, linewidth = 2, colormap = [(:blue, 0.0), :blue])

gl = GridLayout(fig[2, 1], tellwidth = false)
Label(gl[1, 1], "Live Update")
toggle = Toggle(gl[1, 2], active = false)

on(fig.scene.events.tick) do tick
    toggle.active[] || return
    t[] += tick.delta_time
end

fig

Атрибуты

MarkdownAST.Heading(3)

Defaults to false

Indicates if the toggle is active or not.

MarkdownAST.Heading(3)

Defaults to Inside()

The align mode of the toggle in its parent GridLayout.

MarkdownAST.Heading(3)

Defaults to COLOR_ACCENT[]

The color of the toggle button.

MarkdownAST.Heading(3)

Defaults to 15

The number of poly segments in each rounded corner.

MarkdownAST.Heading(3)

Defaults to COLOR_ACCENT_DIMMED[]

The color of the border when the toggle is hovered.

MarkdownAST.Heading(3)

Defaults to RGBf(0.94, 0.94, 0.94)

The color of the border when the toggle is inactive.

MarkdownAST.Heading(3)

Defaults to :center

The horizontal alignment of the toggle in its suggested bounding box.

MarkdownAST.Heading(3)

Defaults to Auto()

The height of the bounding box. Use length and markersize to set the dimensions of the toggle.

MarkdownAST.Heading(3)

Defaults to 32

The length of the toggle.

MarkdownAST.Heading(3)

Defaults to 18

The size of the button.

MarkdownAST.Heading(3)

Defaults to :horizontal

The orientation of the toggle. Can be :horizontal, :vertical, or -pi to pi. 0 is horizontal with "on" being to the right.

MarkdownAST.Heading(3)

Defaults to 0.33

The border width as a fraction of the toggle height

MarkdownAST.Heading(3)

Defaults to true

Controls if the parent layout can adjust to this element’s height

MarkdownAST.Heading(3)

Defaults to true

Controls if the parent layout can adjust to this element’s width

MarkdownAST.Heading(3)

Defaults to 0.15

The duration of the toggle animation.

MarkdownAST.Heading(3)

Defaults to :center

The vertical alignment of the toggle in its suggested bounding box.

MarkdownAST.Heading(3)

Defaults to Auto()

The width of the bounding box. Use length and markersize to set the dimensions of the toggle.