Skip to content

Commit 03e5af9

Browse files
committed
run the formatter
1 parent 1497e60 commit 03e5af9

File tree

11 files changed

+39
-13
lines changed

11 files changed

+39
-13
lines changed

lib/scenic/graph.ex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55

66
defmodule Scenic.Graph do
7-
87
@moduledoc """
98
Please see [`Graph Overview`](overview_graph.html) for a high-level description.
109
@@ -126,7 +125,6 @@ defmodule Scenic.Graph do
126125
when used to identify components...
127126
"""
128127

129-
130128
alias Scenic.Primitive
131129
alias Scenic.Primitive.Group
132130

@@ -255,7 +253,7 @@ defmodule Scenic.Graph do
255253
# delete a primitive/s from a graph
256254
@doc """
257255
Permanently delete a primitive from a group by id.
258-
256+
259257
This will remove a primitive (or many if they have the same id) from a graph. It
260258
then returns the modified graph.
261259
@@ -680,8 +678,6 @@ defmodule Scenic.Graph do
680678
end
681679
end
682680

683-
684-
685681
@doc """
686682
Modify one or more primitives in a graph.
687683

lib/scenic/primitive.ex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ defmodule Scenic.Primitive do
2727
You can use the generic helpers in this module to access or manipulate them.
2828
"""
2929

30-
3130
alias Scenic.Graph
3231
alias Scenic.Primitive
3332
alias Scenic.Primitive.Style
@@ -95,13 +94,15 @@ defmodule Scenic.Primitive do
9594

9695
@doc false
9796
def build(data \\ nil, opts \\ [])
97+
9898
def build(data, opts) do
9999
data = verify!(data)
100100
Primitive.build(__MODULE__, data, opts)
101101
end
102102

103103
@doc false
104104
def add_to_graph(graph, data \\ nil, opts \\ [])
105+
105106
def add_to_graph(%Scenic.Graph{} = graph, data, opts) do
106107
Graph.add(graph, __MODULE__, data, opts)
107108
end
@@ -438,7 +439,6 @@ defmodule Scenic.Primitive do
438439
Map.put(p, :transforms, txs)
439440
end
440441

441-
442442
@spec get_transform(primitive :: Primitive.t(), type :: atom, default :: any) :: any
443443
def get_transform(primitive, tx_type, default \\ nil)
444444

@@ -489,7 +489,6 @@ defmodule Scenic.Primitive do
489489
end)
490490
end
491491

492-
493492
@doc """
494493
Deletes a specified transform from a primitive.
495494
@@ -537,7 +536,6 @@ defmodule Scenic.Primitive do
537536
raise "Primitive.put_opts has been deprecated. Use Primitive.merge_opts instead."
538537
end
539538

540-
541539
@doc """
542540
Merge an options-list of styles and transforms onto a primitive.
543541

lib/scenic/primitive/group.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ defmodule Scenic.Primitive.Group do
3535
# --------------------------------------------------------
3636
@doc false
3737
def build(nil, opts), do: build([], opts)
38+
3839
def build(ids, opts) do
3940
verify!(ids)
4041
Primitive.build(__MODULE__, ids, opts)

lib/scenic/primitive/line.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defmodule Scenic.Primitive.Line do
2222
* [`cap`](Scenic.Primitive.Style.Cap.html) - says how to draw the ends of the line.
2323
* [`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
@@ -67,6 +67,7 @@ defmodule Scenic.Primitive.Line do
6767
rotate or scale transforms.
6868
"""
6969
def centroid(data)
70+
7071
def centroid({{x0, y0}, {x1, y1}}) do
7172
{
7273
(x0 + x1) / 2,

lib/scenic/primitive/quad.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ defmodule Scenic.Primitive.Quad do
5353
is_number(y2) and is_number(x3) and is_number(y3) do
5454
{:ok, data}
5555
end
56+
5657
def verify(_), do: :invalid_data
5758

5859
# ============================================================================

lib/scenic/primitive/rectangle.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ defmodule Scenic.Primitive.Rectangle do
4646
def verify({width, height} = data) when is_number(width) and is_number(height) do
4747
{:ok, data}
4848
end
49+
4950
def verify(_), do: :invalid_data
5051

5152
# ============================================================================
@@ -64,6 +65,7 @@ defmodule Scenic.Primitive.Rectangle do
6465
rotate or scale transforms.
6566
"""
6667
def centroid(data)
68+
6769
def centroid({width, height}) do
6870
{width / 2, height / 2}
6971
end

lib/scenic/primitive/rounded_rectangle.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ defmodule Scenic.Primitive.RoundedRectangle do
8686
rotate or scale transforms.
8787
"""
8888
def centroid(data)
89+
8990
def centroid({width, height, _}) do
9091
{width / 2, height / 2}
9192
end

lib/scenic/primitive/style/join.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ defmodule Scenic.Primitive.Style.Join do
2424
* `:bevel` - Bevel the joint.
2525
"""
2626

27-
2827
use Scenic.Primitive.Style
2928

3029
# ============================================================================

lib/scenic/primitive/style/miter_limit.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ defmodule Scenic.Primitive.Style.MiterLimit do
1616
)
1717
1818
## Data
19-
19+
2020
A number greater than zero.
2121
"""
2222

lib/scenic/primitive/style/paint.ex

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@
44
#
55

66
defmodule Scenic.Primitive.Style.Paint do
7-
@moduledoc false
7+
@moduledoc """
8+
Paint is used to "fill" the area of primitives.
9+
10+
When you apply the `:fill` style to a primitive, you must supply valid
11+
paint data.
12+
13+
There are five types of paint.
14+
* [`:color`](Scenic.Primitive.Style.Paint.Color.html) - Fill with a solid color. This is the most common and has shortcuts.
15+
* [`:image`](Scenic.Primitive.Style.Paint.Image.html) - Fill with an image from the cache.
16+
* [`:box_gradient`](Scenic.Primitive.Style.Paint.BoxGradient.html) - Fill with a box gradient.
17+
* [`:linear_gradient`](Scenic.Primitive.Style.Paint.LinearGradient.html) - Fill with a linear gradient.
18+
* [`:radial_gradient`](Scenic.Primitive.Style.Paint.RadialGradient.html) - Fill with a radial gradient.
19+
20+
See the documentation for each type for details.
21+
22+
## Color Shortcut
23+
24+
Filling with a color is so common, you can just declare any valid color
25+
in a fill, and it will figure out the right paint to use.
26+
27+
Examples:
28+
29+
graph
30+
|> line({{0,0}, {100,100}}, fill: :blue)
31+
|> line({{10,0}, {110,100}}, fill: {:blue, 128})
32+
|> line({{20,0}, {120,100}}, fill: {10,20,30,40})
33+
"""
834

935
alias Scenic.Primitive.Style.Paint
1036

0 commit comments

Comments
 (0)