Skip to content

Commit 88e186c

Browse files
committed
improving generic component and primitive docs
1 parent a56d0cb commit 88e186c

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

lib/scenic/component.ex

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,31 @@ defmodule Scenic.Component do
1717
1818
At the top of your module definition.
1919
20+
## Standard Components
21+
22+
Scenic includes a small number of standard components that you can simply reuse in your
23+
scenes. These were chosen to be in the main library because a) they are used frequently,
24+
and b) their use promotes a certain amount of "common" look and feel.
25+
26+
All of these components are typically added/modified via the helper functions in the
27+
[`Scenic.Components`](Scenic.Components.html) module.
28+
29+
* [`Button`](Scenic.Component.Button.html) a simple button.
30+
* [`Checkbox`](Scenic.Component.Input.Checkbox.html) a checkbox input field.
31+
* [`Dropdown`](Scenic.Component.Input.Dropdown.html) a dropdown / select input field.
32+
* [`RadioGroup`](Scenic.Component.Input.RadioGroup.html) a group of radio button inputs.
33+
* [`Slider`](Scenic.Component.Input.Slider.html) a slider input.
34+
* [`TextField`](Scenic.Component.Input.TextField.html) a text / password input field.
35+
* [`Toggle`](Scenic.Component.Input.Toggle.html) an on/off toggle input.
36+
37+
## Other Components
38+
39+
For completeness, Scenic also includes the following standard components. They are used
40+
by the components above, although you are free to use them as well if they fit your needs.
41+
42+
* [`Caret`](Scenic.Component.Input.Caret.html) the vertical, blinking, caret line in a text field.
43+
* [`RadioButton`](Scenic.Component.Input.RadioButton.html) a single radio button in a radio group.
44+
2045
## Verifiers
2146
2247
One of the main differences between a Component and a Scene is the two extra callbacks

lib/scenic/primitive.ex

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,30 @@ defmodule Scenic.Primitive do
2424
a scene you are building and modify later as you react to events.
2525
2626
Once you get a primitive out of a graph via functions such as `Graph.modify`, or `Graph.get`,
27-
You can use the generic helpers in this module to access or manipulate them.
27+
You can use the generic helpers in this module to access or manipulate them.
28+
29+
## Standard primitives
30+
31+
The set of primitives supported in Scenic is fixed in any given version. They have been chosen
32+
to provide the maximum flexibility when combined together, while still requiring the minimal
33+
amount of code and maintenance.
34+
35+
If required, new primitives can be added in the future, but they will not work with older
36+
versions of the drivers.
37+
38+
* [`Arc`](Scenic.Primitive.Arc.html) draws an arc. This would be a line cut out of a part of the edge of a circle. If you want a shape that looks like a piece of pie, then you should use the [`Sector`](Scenic.Primitive.Sector.html).
39+
* [`Circle`](Scenic.Primitive.Circle.html) draws a circle.
40+
* [`Ellipse`](Scenic.Primitive.Ellipse.html) draws an ellipse.
41+
* [`Group`](Scenic.Primitive.Group.html) doesn't draw anything. Instead, it creates a node in the graph that you can insert more primitives into. Any styles or transforms you apply to the Group are inherited by all the primitives below it.
42+
* [`Line`](Scenic.Primitive.Line.html) draws a line.
43+
* [`Path`](Scenic.Primitive.Path.html) is sort of an escape valve for complex shapes not covered by the other primitives. You supply a list of instructions, such as :move_to, :line_to, :bezier_to, etc to generate a complex shape.
44+
* [`Quad`](Scenic.Primitive.Quad.html) draws polygon with four sides.
45+
* [`Rectangle`](Scenic.Primitive.Rectangle.html) draws a rectangle.
46+
* [`RoundedRectangle`](Scenic.Primitive.RoundedRectangle.html) draws a rectangle with the corners rounded by a given radius.
47+
* [`SceneRef`](Scenic.Primitive.SceneRef.html) doesn't draw anything by itself. Instead it points to another scene/graph and tells the driver to draw that here.
48+
* [`Sector`](Scenic.Primitive.Sector.html) draws a shape that looks like a piece of pie. If you want to stroke just the curved edge, then combine it with an [`Arc`](Scenic.Primitive.Arc.html).
49+
* [`Text`](Scenic.Primitive.Text.html) draws a string of text.
50+
* [`Triangle`](Scenic.Primitive.Triangle.html) draws a triangle.
2851
"""
2952

3053
alias Scenic.Graph

0 commit comments

Comments
 (0)