Skip to content

Commit fae3b60

Browse files
authored
Merge pull request #288 from ScenicFramework/fix_doc_and_spec_bugs
Fix doc and spec bugs
2 parents db11aa3 + edf198e commit fae3b60

File tree

2 files changed

+47
-13
lines changed

2 files changed

+47
-13
lines changed

lib/scenic/primitives.ex

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ defmodule Scenic.Primitives do
262262
263263
An arc is the outer edge of a part of a circle or ellipse. It
264264
is the sort of thing you would use a compass to draw on a piece
265-
of paper. It has a radius, a start angle and an ending angle. The
266-
angles are specified in radians.
265+
of paper. It has a radius, and angle that defines how much of
266+
the arc to sweep through. The angle is specified in radians.
267267
268268
Data:
269269
270-
{radius, start, finish}
270+
{radius, angle}
271271
272272
If you want something that looks like a piece of pie (maybe for a
273273
pie chart??), then you want a Sector, not an Arc.
@@ -279,7 +279,16 @@ defmodule Scenic.Primitives do
279279
starting straight out to the right, then going down 0.4 radians.
280280
281281
graph
282-
|> arc( {100, 0, 0.4} )
282+
|> arc( {100, 0.6} )
283+
284+
### Note
285+
286+
The format for Arc has changed since v0.10. It used to be
287+
{radius, start_angle, end_angle}. You can achieve the same effect in the
288+
new, simpler format by using the same radius and the new angle is the
289+
difference between the old end_angle and start_angle. Then you can apply
290+
a rotation transform to get it in the right position.
291+
283292
284293
### Styles
285294
@@ -296,12 +305,12 @@ defmodule Scenic.Primitives do
296305
Example:
297306
298307
graph
299-
|> arc( {100, 0, 0.4}, stroke: {4, :blue} )
308+
|> arc( {100, 0.4}, stroke: {4, :blue} )
300309
301310
"""
302311
@spec arc(
303312
source :: Graph.t() | Primitive.t(),
304-
arc :: {radius :: number, start :: number, finish :: number},
313+
arc :: {radius :: number, angle :: number},
305314
options :: list
306315
) :: Graph.t() | Primitive.t()
307316

@@ -325,10 +334,19 @@ defmodule Scenic.Primitives do
325334
326335
arc = arc_spec( {100, 0, 0.4}, stroke: {4, :blue} )
327336
graph = arc.(graph)
337+
338+
339+
### Note
340+
341+
The format for Arc has changed since v0.10. It used to be
342+
{radius, start_angle, end_angle}. You can achieve the same effect in the
343+
new, simpler format by using the same radius and the new angle is the
344+
difference between the old end_angle and start_angle. Then you can apply
345+
a rotation transform to get it in the right position.
328346
"""
329347

330348
@spec arc_spec(
331-
arc :: {radius :: number, start :: number, finish :: number},
349+
arc :: {radius :: number, angle :: number},
332350
options :: list
333351
) :: Graph.deferred()
334352

@@ -1086,20 +1104,28 @@ defmodule Scenic.Primitives do
10861104
Add a sector to a graph
10871105
10881106
A sector looks like a piece of pie. It is wedge shaped with a pointy
1089-
bit on one side and a rounded bit on the other. It has a radius, a
1090-
start angle and a finish angle. The angles are specified in radians.
1107+
bit on one side and a rounded bit on the other. It has a radius, and angle that
1108+
defines how much of the arc to sweep through. The angle is specified in radians.
10911109
10921110
Data:
10931111
1094-
{radius, start, finish}
1112+
{radius, angle}
10951113
10961114
To create a sector of an ellipse, create a normal sector, and apply
10971115
a `:scale` transform with unequal x and y sizing.
10981116
10991117
The following example will draw a sector with a radius of 100,
11001118
starting straight out to the right, then going down 0.4 radians.
11011119
1102-
|> sector( {100, 0, 0.4} )
1120+
|> sector( {100, 0.4} )
1121+
1122+
### Note
1123+
1124+
The format for Sector has changed since v0.10. It used to be
1125+
{radius, start_angle, end_angle}. You can achieve the same effect in the
1126+
new, simpler format by using the same radius and the new angle is the
1127+
difference between the old end_angle and start_angle. Then you can apply
1128+
a rotation transform to get it in the right position.
11031129
11041130
### Styles
11051131
@@ -1155,8 +1181,16 @@ defmodule Scenic.Primitives do
11551181
11561182
Example:
11571183
1158-
sector = sector_spec( {100, 0, 0.4}, fill: :red )
1184+
sector = sector_spec( {100, 0.4}, fill: :red )
11591185
graph = sector.(graph)
1186+
1187+
### Note
1188+
1189+
The format for Sector has changed since v0.10. It used to be
1190+
{radius, start_angle, end_angle}. You can achieve the same effect in the
1191+
new, simpler format by using the same radius and the new angle is the
1192+
difference between the old end_angle and start_angle. Then you can apply
1193+
a rotation transform to get it in the right position.
11601194
"""
11611195

11621196
@spec sector_spec(

lib/scenic/script.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ defmodule Scenic.Script do
126126
```elixir
127127
graph =
128128
Graph.build()
129-
|> script(chx_id, id: :chx, hidden: !checked?})
129+
|> script(chx_id, id: :chx, hidden: !checked?)
130130
```
131131
132132
## Script State

0 commit comments

Comments
 (0)