Skip to content

Commit 092b5ad

Browse files
committed
Doc updates for Primitives
Doc updates for `Scenic.Primitive` and `Scenic.Primitive.Component` Removed the link to `Scenic.Primitive.Component` from `Scenic.Primitive`'s table because the `component/3` helper no longer exists and `Scenic.Primitive.Component` no longer seems to match in that table. Use plain backticks to create links when possible because it is rendered better in editors and is shorter with better error checking in ex_doc (which then caught the `component/3` and `circle/3` broken links). Also: - Formatting updates - Grammar updates - Remove some dead code - Add more links to modules
1 parent 94679b1 commit 092b5ad

File tree

2 files changed

+26
-31
lines changed

2 files changed

+26
-31
lines changed

lib/scenic/primitive.ex

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ defmodule Scenic.Primitive do
2020
## How to use primitives
2121
2222
By far, the easiest way to use primitives is to import the helper functions in
23-
[`Scenic.Primitives`](Scenic.Primitives.html). These helpers can both add primitives to
23+
`Scenic.Primitives`. These helpers can both add primitives to
2424
a scene you are building and modify later as you react to events.
2525
2626
```elixir
2727
import Scenic.Primitives
2828
2929
@graph Scenic.Graph.build()
30-
|> rect( {100, 50}, stroke: {1, :yellow} )
31-
|> rectangle( {100, 50}, stroke: {1, :yellow} )
30+
|> rect({100, 50}, stroke: {1, :yellow})
31+
|> rectangle({100, 50}, stroke: {1, :yellow})
3232
```
3333
3434
Once you get a primitive out of a graph via functions such as `Graph.modify`, or `Graph.get`,
@@ -44,21 +44,20 @@ defmodule Scenic.Primitive do
4444
4545
| Helper | Primitive Module | Description |
4646
|---|---|---|
47-
| [`arc/3`](Scenic.Primitives.html#arc/3) | `Scenic.Primitive.Arc` | Draw an arc around a circle |
48-
| [`circle/3`](Scenic.Components.html#circle/3) | `Scenic.Primitive.Circle` | Draw a full circle |
49-
| [`component/3`](Scenic.Primitives.html#component/3) | `Scenic.Primitive.Component` | Start a child component |
50-
| [`ellipse/3`](Scenic.Primitives.html#ellipse/3) | `Scenic.Primitive.Ellipse` | Draw an ellipse |
51-
| [`group/3`](Scenic.Primitives.html#group/3) | `Scenic.Primitive.Group` | Create a group |
52-
| [`line/3`](Scenic.Primitives.html#line/3) | `Scenic.Primitive.Line` | Draw a line |
53-
| [`path/3`](Scenic.Primitives.html#path/3) | `Scenic.Primitive.Path` | Draw a complicated path |
54-
| [`quad/3`](Scenic.Primitives.html#quad/3) | `Scenic.Primitive.Quad` | Draw a quad |
55-
| [`rect/3`](Scenic.Primitives.html#rect/3) | `Scenic.Primitive.Rectangle` | Draw a rectangle |
56-
| [`rrect/3`](Scenic.Primitives.html#rrect/3) | `Scenic.Primitive.RoundedRectangle` | Draw a rounded rectangle |
57-
| [`script/3`](Scenic.Primitives.html#script/3) | `Scenic.Primitive.Script` | Run a referenced draw script |
58-
| [`sector/3`](Scenic.Primitives.html#sector/3) | `Scenic.Primitive.Sector` | A boolean toggle control. |
59-
| [`sprites/3`](Scenic.Primitives.html#sprites/3) | `Scenic.Primitive.Sprites` | Draw a sector |
60-
| [`text/3`](Scenic.Primitives.html#text/3) | `Scenic.Primitive.Text` | Draw a string of text |
61-
| [`triangle/3`](Scenic.Primitives.html#triangle/3) | `Scenic.Primitive.Triangle` | Draw a triangle |
47+
| [`arc/3`](`Scenic.Primitives.arc/3`) | `Scenic.Primitive.Arc` | Draw an arc around a circle |
48+
| [`circle/3`](`Scenic.Primitives.circle/3`) | `Scenic.Primitive.Circle` | Draw a full circle |
49+
| [`ellipse/3`](`Scenic.Primitives.ellipse/3`) | `Scenic.Primitive.Ellipse` | Draw an ellipse |
50+
| [`group/3`](`Scenic.Primitives.group/3`) | `Scenic.Primitive.Group` | Create a group |
51+
| [`line/3`](`Scenic.Primitives.line/3`) | `Scenic.Primitive.Line` | Draw a line |
52+
| [`path/3`](`Scenic.Primitives.path/3`) | `Scenic.Primitive.Path` | Draw a complicated path |
53+
| [`quad/3`](`Scenic.Primitives.quad/3`) | `Scenic.Primitive.Quad` | Draw a quad |
54+
| [`rect/3`](`Scenic.Primitives.rect/3`) | `Scenic.Primitive.Rectangle` | Draw a rectangle |
55+
| [`rrect/3`](`Scenic.Primitives.rrect/3`) | `Scenic.Primitive.RoundedRectangle` | Draw a rounded rectangle |
56+
| [`script/3`](`Scenic.Primitives.script/3`) | `Scenic.Primitive.Script` | Run a referenced draw script |
57+
| [`sector/3`](`Scenic.Primitives.sector/3`) | `Scenic.Primitive.Sector` | A boolean toggle control. |
58+
| [`sprites/3`](`Scenic.Primitives.sprites/3`) | `Scenic.Primitive.Sprites` | Draw a sector |
59+
| [`text/3`](`Scenic.Primitives.text/3`) | `Scenic.Primitive.Text` | Draw a string of text |
60+
| [`triangle/3`](`Scenic.Primitives.triangle/3`) | `Scenic.Primitive.Triangle` | Draw a triangle |
6261
"""
6362

6463
alias Scenic.Graph
@@ -145,12 +144,8 @@ defmodule Scenic.Primitive do
145144
contains_point?: 2,
146145
default_pin: 1
147146
end
148-
149-
# quote
150147
end
151148

152-
# defmacro
153-
154149
# ============================================================================
155150
# build and add
156151

@@ -163,7 +158,7 @@ defmodule Scenic.Primitive do
163158
Generic builder to create a new primitive.
164159
165160
This function is used internally. You should almost always use the helpers in
166-
[Scenic.Primitives](Scenic.Primitives.html) instead.
161+
`Scenic.Primitives` instead.
167162
168163
Parameters:
169164
* `module` - The module of the primitive you are building
@@ -501,8 +496,8 @@ defmodule Scenic.Primitive do
501496
@doc """
502497
Put primitive-specific data onto the primitive.
503498
504-
Like many of the functions in the Scenic.Primitive module, you are usually better
505-
off using the helper functions in [`Scenic.Primitives`](Scenic.Primitives.html) instead.
499+
Like many of the functions in the `Scenic.Primitive` module, you are usually better
500+
off using the helper functions in `Scenic.Primitives` instead.
506501
507502
Parameters:
508503
* `primitive` - The primitive

lib/scenic/primitive/component.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ defmodule Scenic.Primitive.Component do
77
@moduledoc """
88
Add a child component to a graph.
99
10-
When a scene pushes a graph containing a Component to it's ViewPort,
10+
When a scene pushes a graph containing a Component to its ViewPort,
1111
a new scene, containing the component, is created and added as a child
1212
to the scene that created it.
1313
1414
Any events the new component creates are sent up the parent. The parent
15-
can use functions in the Scenic.Scene module to manage it's children,
15+
can use functions in the `Scenic.Scene` module to manage its children,
1616
send them messages and such.
1717
1818
The standard components, such as button, slider, etc. have wrapper functions
1919
making them very easy to add to a graph. However, if you have a custom
20-
component you can add it to any graph manually using the add_to_graph
20+
component you can add it to any graph manually using the `add_to_graph/3`
2121
function.
2222
23-
You typically want to give components an :id. This will be used to identify
23+
You typically want to give components an `:id`. This will be used to identify
2424
events coming from that components back to your scene.
2525
2626
```elixir
2727
import Components # contains the button helper
2828
2929
graph
30-
|> button( "Press Me", id: :press_me )
31-
|> MyComponent.add_to_graph( {"Some data", 123}, id: :my_component )
30+
|> button("Press Me", id: :press_me)
31+
|> MyComponent.add_to_graph({"Some data", 123}, id: :my_component)
3232
```
3333
3434
"""

0 commit comments

Comments
 (0)