Skip to content

Commit 1497e60

Browse files
committed
working on docs for styles
1 parent 23ad908 commit 1497e60

27 files changed

+261
-70
lines changed

lib/scenic/primitive/arc.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ defmodule Scenic.Primitive.Arc do
2828
## Styles
2929
3030
This primitive recognizes the following styles
31-
* `hidden` - show or hide the primitive
32-
* `fill` - fill in the area of the primitive
33-
* `stroke` - stroke the outline of the primitive. In this case, only the curvy part.
31+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
32+
* [`fill`](Scenic.Primitive.Style.Fill.html) - fill in the area of the primitive
33+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
3434
"""
3535

3636
use Scenic.Primitive

lib/scenic/primitive/circle.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ defmodule Scenic.Primitive.Circle do
1717
## Styles
1818
1919
This primitive recognizes the following styles
20-
* `hidden` - show or hide the primitive
21-
* `fill` - fill in the area of the primitive
22-
* `stroke` - stroke the outline of the primitive.
20+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
21+
* [`fill`](Scenic.Primitive.Style.Fill.html) - fill in the area of the primitive
22+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
2323
"""
2424

2525
use Scenic.Primitive

lib/scenic/primitive/ellipse.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ defmodule Scenic.Primitive.Ellipse do
1818
## Styles
1919
2020
This primitive recognizes the following styles
21-
* `hidden` - show or hide the primitive
22-
* `fill` - fill in the area of the primitive
23-
* `stroke` - stroke the outline of the primitive.
21+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
22+
* [`fill`](Scenic.Primitive.Style.Fill.html) - fill in the area of the primitive
23+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
2424
2525
Note: you can achieve the same effect with a Circle primitive
2626
by applying a :size transform to it with unequal values on the axes

lib/scenic/primitive/line.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ defmodule Scenic.Primitive.Line do
1818
## Styles
1919
2020
This primitive recognizes the following styles
21-
* `hidden` - show or hide the primitive
22-
* `cap` - says how to draw the ends of the line.
23-
* `stroke` - stroke the outline of the primitive.
21+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
22+
* [`cap`](Scenic.Primitive.Style.Cap.html) - says how to draw the ends of the line.
23+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
2424
"""
25-
25+
2626
use Scenic.Primitive
2727

2828
# import IEx

lib/scenic/primitive/path.ex

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ defmodule Scenic.Primitive.Path do
1717
## Styles
1818
1919
This primitive recognizes the following styles
20-
* `hidden` - show or hide the primitive
21-
* `fill` - fill in the area of the primitive
22-
* `stroke` - stroke the outline of the primitive.
20+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
21+
* [`fill`](Scenic.Primitive.Style.Fill.html) - fill in the area of the primitive
22+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
23+
* [`cap`](Scenic.Primitive.Style.Cap.html) - says how to draw the ends of the line.
24+
* [`join`](Scenic.Primitive.Style.Join.html) - control how segments are joined.
25+
* [`miter_limit`](Scenic.Primitive.Style.MiterLimit.html) - control how segments are joined.
2326
2427
## Commands
2528
@@ -38,7 +41,7 @@ defmodule Scenic.Primitive.Path do
3841

3942
# import IEx
4043

41-
@styles [:hidden, :fill, :stroke]
44+
@styles [:hidden, :fill, :stroke, :cap, :join, :miter_limit]
4245

4346
# ============================================================================
4447
# data verification and serialization

lib/scenic/primitive/quad.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ defmodule Scenic.Primitive.Quad do
2020
## Styles
2121
2222
This primitive recognizes the following styles
23-
* `hidden` - show or hide the primitive
24-
* `fill` - fill in the area of the primitive
25-
* `stroke` - stroke the outline of the primitive.
23+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
24+
* [`fill`](Scenic.Primitive.Style.Fill.html) - fill in the area of the primitive
25+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
26+
* [`join`](Scenic.Primitive.Style.Join.html) - control how segments are joined.
27+
* [`miter_limit`](Scenic.Primitive.Style.MiterLimit.html) - control how segments are joined.
2628
"""
2729

2830
use Scenic.Primitive
@@ -31,7 +33,7 @@ defmodule Scenic.Primitive.Quad do
3133

3234
# import IEx
3335

34-
@styles [:hidden, :fill, :stroke]
36+
@styles [:hidden, :fill, :stroke, :join, :miter_limit]
3537

3638
# ============================================================================
3739
# data verification and serialization

lib/scenic/primitive/rectangle.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ defmodule Scenic.Primitive.Rectangle do
1818
## Styles
1919
2020
This primitive recognizes the following styles
21-
* `hidden` - show or hide the primitive
22-
* `fill` - fill in the area of the primitive
23-
* `stroke` - stroke the outline of the primitive.
21+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
22+
* [`fill`](Scenic.Primitive.Style.Fill.html) - fill in the area of the primitive
23+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
24+
* [`join`](Scenic.Primitive.Style.Join.html) - control how segments are joined.
25+
* [`miter_limit`](Scenic.Primitive.Style.MiterLimit.html) - control how segments are joined.
2426
"""
2527

2628
use Scenic.Primitive
2729

28-
@styles [:hidden, :fill, :stroke]
30+
@styles [:hidden, :fill, :stroke, :join, :miter_limit]
2931

3032
# ============================================================================
3133
# data verification and serialization

lib/scenic/primitive/rounded_rectangle.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ defmodule Scenic.Primitive.RoundedRectangle do
1919
## Styles
2020
2121
This primitive recognizes the following styles
22-
* `hidden` - show or hide the primitive
23-
* `fill` - fill in the area of the primitive
24-
* `stroke` - stroke the outline of the primitive.
22+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
23+
* [`fill`](Scenic.Primitive.Style.Fill.html) - fill in the area of the primitive
24+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
2525
"""
2626

2727
use Scenic.Primitive

lib/scenic/primitive/sector.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ defmodule Scenic.Primitive.Sector do
2121
## Styles
2222
2323
This primitive recognizes the following styles
24-
* `hidden` - show or hide the primitive
25-
* `fill` - fill in the area of the primitive
26-
* `stroke` - stroke the outline of the primitive. In this case, only the curvy part.
24+
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitive
25+
* [`fill`](Scenic.Primitive.Style.Fill.html) - fill in the area of the primitive
26+
* [`stroke`](Scenic.Primitive.Style.Stroke.html) - stroke the outline of the primitive. In this case, only the curvy part.
2727
"""
2828

2929
use Scenic.Primitive

lib/scenic/primitive/style/cap.ex

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@
44
#
55

66
defmodule Scenic.Primitive.Style.Cap do
7-
@moduledoc false
7+
@moduledoc """
8+
Set how to draw the end of a line.
9+
10+
Example:
11+
12+
graph
13+
|> line({{0,0}, {100,100}}, cap: :round)
14+
15+
## Data
16+
* `:butt` - End of the line is flat, passing through the end point.
17+
* `:round` - End of the line is round, radiating from the end point.
18+
* `:square` - End of the line is flat, but projecting a square around the end point.
19+
"""
820

921
use Scenic.Primitive.Style
1022

1123
# ============================================================================
1224
# data verification and serialization
1325

1426
# --------------------------------------------------------
27+
@doc false
1528
def info(data),
1629
do: """
1730
#{IO.ANSI.red()}#{__MODULE__} data must be one of :butt, :round, :square
@@ -21,7 +34,7 @@ defmodule Scenic.Primitive.Style.Cap do
2134

2235
# --------------------------------------------------------
2336
# named color
24-
37+
@doc false
2538
def verify(stroke) do
2639
try do
2740
normalize(stroke)
@@ -32,7 +45,7 @@ defmodule Scenic.Primitive.Style.Cap do
3245
end
3346

3447
# --------------------------------------------------------
35-
48+
@doc false
3649
def normalize(:butt), do: :butt
3750
def normalize(:round), do: :round
3851
def normalize(:square), do: :square

0 commit comments

Comments
 (0)