diff options
| author | Omar Rizwan <omar@omar.website> | 2023-07-14 23:30:12 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-14 23:30:12 +0000 |
| commit | 7e14ccc586a32cfcc1f9ec3185a4b7d613fd6da8 (patch) | |
| tree | 07e4b9e987e7df359bc17fdea8d7bebce06679c2 /virtual-programs | |
| parent | Merge remote-tracking branch 'origin/main' (diff) | |
| parent | Fix calibrate use of drawText, keep it up for 10s (diff) | |
| download | folk-7e14ccc586a32cfcc1f9ec3185a4b7d613fd6da8.tar.gz folk-7e14ccc586a32cfcc1f9ec3185a4b7d613fd6da8.zip | |
Merge pull request #48 from FolkComputer/osnr/rotate-labels
Rotate labels
Diffstat (limited to 'virtual-programs')
| -rw-r--r-- | virtual-programs/label.folk | 23 | ||||
| -rw-r--r-- | virtual-programs/tags-and-calibration.folk | 2 |
2 files changed, 5 insertions, 20 deletions
diff --git a/virtual-programs/label.folk b/virtual-programs/label.folk index eeaaf143..bfc67ada 100644 --- a/virtual-programs/label.folk +++ b/virtual-programs/label.folk @@ -1,33 +1,20 @@ When /thing/ has region /region/ { - set bbox [regionToBbox $region] - lassign [boxCentroid $bbox] x y - set width [boxWidth $bbox] - set height [boxHeight $bbox] - - + lassign [region centroid $region] x y + set width [region width $region] + set height [region height $region] set radians [region angle $region] - set upsidedown [expr {$radians > 1.57 || $radians < -1.57}] - if {$::isLaptop} {set upsidedown false} When the collected matches for [list /someone/ wishes $thing is labelled /text/] are /matches/ { set text [join [lmap match $matches {dict get $match text}] "\n"] if {$text eq ""} { return } - set lines [split $text "\n"] - set lines [expr {$upsidedown ? [lreverse $lines] : $lines}] set scale 1 - set fontSize [expr {18 * $scale}] - - for {set lineNum 0} {$lineNum < [llength $lines]} {incr lineNum} { - set line [lindex $lines $lineNum] - set ly [expr {$y + $lineNum * $fontSize}] - Display::text device $x $ly $scale $line $radians - } + Display::text $x $y $scale $text $radians } } fn text {coords text angle} { - Display::text Display::fb [lindex $coords 0] [lindex $coords 1] 2 $text $angle + Display::text [lindex $coords 0] [lindex $coords 1] 2 $text $angle } When /anyone/ wishes /p/ has halo message /message/ & /p/ has region /r/ { diff --git a/virtual-programs/tags-and-calibration.folk b/virtual-programs/tags-and-calibration.folk index c57adafe..6a4cf98f 100644 --- a/virtual-programs/tags-and-calibration.folk +++ b/virtual-programs/tags-and-calibration.folk @@ -135,8 +135,6 @@ When (non-capturing) tag /tag/ is a tag { When (non-capturing) tag /tag/ has corners /corners/ { set tagCorners [lmap p $corners {::cameraToProjector $p}] - # foreach tagCorner $tagCorners { Display::text fb {*}$tagCorner 1 $tagCorner } - # Display::fillQuad {*}$tagCorners white set vecBottom [sub [lindex $tagCorners 1] [lindex $tagCorners 0]] set vecRight [sub [lindex $tagCorners 2] [lindex $tagCorners 1]] |
