summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorAndrés Cuervo <andrescuervor@gmail.com>2023-09-22 17:23:06 +0000
committerAndrés Cuervo <andrescuervor@gmail.com>2023-09-22 17:23:06 +0000
commit86d072c4205fec692176dc3a67c5b1799e3faa43 (patch)
tree7bde464e10677a4ff414bfe58fab72827713c273 /virtual-programs
parentAdd absolute cursor, prep for refactor (diff)
downloadfolk-86d072c4205fec692176dc3a67c5b1799e3faa43.tar.gz
folk-86d072c4205fec692176dc3a67c5b1799e3faa43.zip
Fix halo angle, begin fixing editor text position
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/editor.folk10
-rw-r--r--virtual-programs/label.folk5
2 files changed, 4 insertions, 11 deletions
diff --git a/virtual-programs/editor.folk b/virtual-programs/editor.folk
index 6387c363..81b635c4 100644
--- a/virtual-programs/editor.folk
+++ b/virtual-programs/editor.folk
@@ -117,15 +117,7 @@ Commit code { Claim $id has program code $baseCode }
proc drawText {text cursor count region} {
set lineNumber 1
set showCursor [expr {$count % 2 == 0}]
- set corner [region topleft $region]
- set angle [region angle $region]
- lassign $corner cornerX cornerY
- foreach line [split $text "\n"] {
- set lineCornerY [- $cornerY [* $lineNumber 50]]
- set lineCornerX [- $cornerX [* [string length $line] 9]]
- Display::text $lineCornerX $lineCornerY 2 $line $angle
- set lineNumber [+ $lineNumber 1]
- }
+ Display::text {*}[region centroid $region] 2 $text [region angle $region]
}
# TODO: refactor this to not reply on absolute region position but instead to compose as 0, 0
diff --git a/virtual-programs/label.folk b/virtual-programs/label.folk
index ad5e406f..624ae8ad 100644
--- a/virtual-programs/label.folk
+++ b/virtual-programs/label.folk
@@ -19,7 +19,8 @@ fn text {coords text angle} {
When /anyone/ wishes /p/ has halo message /message/ & /p/ has region /r/ {
lassign [lindex $r 0] a b c d
+ set angle [region angle $r]
lassign $a x y
- text [list [lindex $a 0] [expr {[lindex $a 1] - 50}]] $message 0
- text [list [lindex $d 0] [expr {[lindex $d 1] + 50}]] $message 3.1415
+ text [list [lindex $a 0] [expr {[lindex $a 1] - 50}]] $message $angle
+ text [list [lindex $d 0] [expr {[lindex $d 1] + 50}]] $message [+ 3.1415 $angle]
}