Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b0961c9
Restore shapes, arcs, fills
cwervo Apr 27, 2026
96c0eaf
Merge branch 'main' into ac/drawing-primitives
cwervo Apr 28, 2026
5c7f9f2
Port drawing curve and shapes APIs
cwervo May 3, 2026
97178a0
Add physical drawing surfaces
cwervo May 3, 2026
2866c65
Port connections to draw spaces
cwervo May 3, 2026
796fd59
Move arc primitive into draw
cwervo May 3, 2026
d715909
Share drawing space geometry helpers
cwervo May 3, 2026
e70f275
Port decorations and hit targets to surfaces
cwervo May 3, 2026
28b8a83
Strengthen decoration surface tests
cwervo May 3, 2026
b409010
Port terminal to physical surfaces
cwervo May 3, 2026
2de73b2
Harden terminal lifecycle and focus fallback
cwervo May 3, 2026
a26ca34
Clean up drawing surface helper conventions
cwervo May 5, 2026
7b7d126
build: make remote sync work from git worktrees
cwervo May 6, 2026
374ae6d
draw: move primitives into the draw program space
cwervo May 6, 2026
0d02c56
draw: add demo runner and title source margins
cwervo May 6, 2026
568eac3
connections: restore quad-based drawing
cwervo May 6, 2026
ce8c292
draw/text: honor block anchors for aligned lines
cwervo May 6, 2026
016c83e
draw/image: make Folk logo URL work offline
cwervo May 7, 2026
d9e7c20
Clean up draw spaces and texture init
cwervo May 8, 2026
3e6dae9
Add shared PI and TAU constants
cwervo May 13, 2026
5da5157
Merge remote-tracking branch 'origin/main' into ac/drawing-primitives
cwervo May 13, 2026
ffd2279
Merge drawing primitives into drawing May PR branch
cwervo May 13, 2026
3bc7285
Stabilize live draw helper usage
cwervo May 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,17 @@ kill-folk:
fi

FOLK_REMOTE_NODE ?= folk-live
FOLK_SYNC_IGNORES ?= $(shell git rev-parse --git-path ignores.tmp 2>/dev/null || printf '%s\n' .git/ignores.tmp)

sync:
ssh $(FOLK_REMOTE_NODE) -t \
'cd ~/folk && git init > /dev/null && git ls-files --exclude-standard -oi --directory' \
> .git/ignores.tmp || true
git ls-files --exclude-standard -oi --directory >> .git/ignores.tmp
> '$(FOLK_SYNC_IGNORES)' || true
git ls-files --exclude-standard -oi --directory >> '$(FOLK_SYNC_IGNORES)'
rsync --timeout=15 -e "ssh -o StrictHostKeyChecking=no" \
--archive --delete --itemize-changes \
--exclude='/.git' \
--exclude-from='.git/ignores.tmp' \
--exclude-from='$(FOLK_SYNC_IGNORES)' \
--exclude='vendor/tracy/public/TracyClient.o' \
--include='vendor/tracy/public/***' \
--exclude='vendor/tracy/*' \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ Use it in an animation:

```
When the clock time is /t/ {
Wish $this draws a circle with offset [list [expr {sin($t) * 50}] 0]
Wish $this draws a circle with offset [list [expr {sin($t) * 0.05}] 0] radius 0.012
}
```

Expand Down
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 0 additions & 69 deletions builtin-programs/connections.folk

This file was deleted.

63 changes: 37 additions & 26 deletions builtin-programs/decorations/label.folk
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
When /thing/ has resolved geometry /geom/ {
fn drawLabelMaxLineLength {text} {
set maxLength 0
foreach line [split $text "\n"] {
set lineLength [string length $line]
if {$lineLength > $maxLength} {
set maxLength $lineLength
}
}
return $maxLength
}

fn drawLabelDefaultScale {text} {
set maxLength [drawLabelMaxLineLength $text]
if {$maxLength == 0} { return 0.02 }
::math::min 0.02 [/ 0.45 $maxLength]
}

fn drawLabelDefaultOptions {text width height} {
set scale [drawLabelDefaultScale $text]
set position [lmap value [list [expr {$width / 2.0}] [expr {$height / 2.0}]] {
format "%sm" $value
}]
dict create \
position $position \
scale [format "%sm" $scale] \
anchor center \
font "PTSans-Regular"
}

When display /disp/ has width /displayWidth/ height /displayHeight/ &\
/thing/ has physical drawing surface /surface/ with width /width/ height /height/ space /space/ &\
/disp/ has canvas projection for surface /surface/ /surfaceToClip/ {
When the collected results for [list /someone/ wishes $thing is labelled /text/ with /...options/] are /results/ {
set text [join [lmap result $results {dict get $result text}] "\n"]
if {$text eq ""} { return }

# Split text into lines and find the longest line.
set lines [split $text "\n"]
set maxLength 0
foreach line $lines {
set lineLength [string length $line]
if {$lineLength > $maxLength} {
set maxLength $lineLength
}
}

# Set default scale based on longest line length.
# Scale inversely with length to keep text readable.
set defaultScale [::math::min 0.02 [/ 0.45 $maxLength]]

set x [/ $geom(width) 2.0]
try {
set y $($geom(top) + $geom(tagSize) + $geom(bottom)/2.0)
} on error e {
set y [/ $geom(height) 2.0]
set options [drawLabelDefaultOptions $text $width $height]
foreach result $results {
set options [dict merge $options [dict get $result options]]
}
set options [dict create x $x y $y scale $defaultScale]
# FIXME: support per-label options; right now, this just
# applies an arbitrary label's options to all of them
# together.
set options [dict merge $options [dict get $result options]]
dict set options text $text
Wish to draw text onto $thing with {*}$options

Wish to draw text onto $disp in surface $surface with {*}$options
}
}

Expand Down
42 changes: 32 additions & 10 deletions builtin-programs/decorations/outline.folk
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
When /someone/ wishes /thing/ is outlined /color/ &\
/thing/ has resolved geometry /geom/ {
dict with geom {
set points [list [list 0 0] \
[list $width 0] \
[list $width $height] \
[list 0 $height] \
[list 0 0]]
fn drawOutlinePoints {width height} {
lmap point [list \
{0 0} \
[list $width 0] \
[list $width $height] \
[list 0 $height] \
{0 0}] {
lmap value $point {
format "%sm" $value
}
}
}

When /someone/ wishes /thing/ is outlined /color/ {
Wish $thing is outlined with color $color
}

When /someone/ wishes /thing/ is outlined /color/ with /...options/ {
if {![info exists options]} { set options [dict create] }
Wish $thing is outlined with color $color {*}$options
}

When display /disp/ has width /displayWidth/ height /displayHeight/ &\
/thing/ has physical drawing surface /surface/ with width /width/ height /height/ space /space/ &\
/disp/ has canvas projection for surface /surface/ /surfaceToClip/ &\
/someone/ wishes /thing/ is outlined with /...options/ {
if {![info exists options]} { set options [dict create] }
set color [dict getdef $options color white]
set outlineWidth [dict getdef $options width [dict getdef $options thickness [format "%sm" 0.01]]]
set layer [dict getdef $options layer 2]

Wish to draw a line onto $thing with \
points $points width 0.01 color $color
Wish to draw a line onto $disp in surface $surface with \
points [drawOutlinePoints $width $height] \
width $outlineWidth color $color layer $layer
}
2 changes: 1 addition & 1 deletion builtin-programs/demos.folk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Claim 45004 has demo code {
}
Claim 45005 has demo code {
When the clock time is /t/ {
Wish $this draws a circle offset [list expr {sin($t) * 50} 0]
Wish $this draws a circle with offset [list [expr {sin($t) * 0.05}] 0] radius 0.012
}
}
Claim 45006 has demo code {
Expand Down
39 changes: 0 additions & 39 deletions builtin-programs/display/arc.folk

This file was deleted.

Loading