Skip to content

Commit

Permalink
fix the drawing tutorial (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Holy <[email protected]>
  • Loading branch information
ExpandingMan and timholy authored Sep 23, 2022
1 parent e4e3624 commit fbb73b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "GtkObservables"
uuid = "8710efd8-4ad6-11eb-33ea-2d5ceb25a41c"
version = "1.2.4"
version = "1.2.5"

[deps]
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
Expand Down
10 changes: 6 additions & 4 deletions docs/src/drawing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ lines.
Let's begin by creating a window with a canvas in it:

```julia
using Gtk.ShortNames, GtkObservables, Graphics, Colors
using GtkObservables, Colors
using GtkObservables.Gtk
using GtkObservables.Gtk.ShortNames

win = Window("Drawing")
c = canvas(UserUnit) # create a canvas with user-specified coordinates
Expand Down Expand Up @@ -83,7 +85,7 @@ sigextend = on(c.mouse.motion) do btn
# extend `newline` with the most recent point
push!(newline[], btn.position)
# notify any observers -- alternatively we could reassign to newline[]
Observables.notify(newline)
notify(newline)
end
end
```
Expand All @@ -104,7 +106,7 @@ sigend = on(c.mouse.buttonrelease) do btn
# We do this in a way that prevents triggering anything (yet).
newline.val = []
# Now trigger
Observables.notify(lines)
notify(lines)
end
end
```
Expand All @@ -125,7 +127,7 @@ function):
redraw = draw(c, lines, newline) do cnvs, lns, newl # the function body takes 3 arguments
fill!(cnvs, colorant"white") # set the background to white
set_coordinates(cnvs, BoundingBox(0, 1, 0, 1)) # set coordinates to 0..1 along each axis
ctx = getgc(cnvs) # gets the "graphics context" object (see Cairo/Gtk)
ctx = Gtk.getgc(cnvs) # gets the "graphics context" object (see Cairo/Gtk)
for l in lns
drawline(ctx, l, colorant"blue") # draw old lines in blue
end
Expand Down

2 comments on commit fbb73b1

@timholy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/68854

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.5 -m "<description of version>" fbb73b1e588a8c87102ef9f9f50ee3b1f706b55c
git push origin v1.2.5

Please sign in to comment.