summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorAndrés Cuervo <andrescuervor@gmail.com>2023-10-20 21:45:23 +0000
committerAndrés Cuervo <andrescuervor@gmail.com>2023-10-20 21:45:23 +0000
commita0eaf8cffc77ffb98f35403a306bf5d5b718e8ee (patch)
treed21c50837f5504d2aca70e78db3c4733e4b5a5e2 /virtual-programs
parentAdd debugging (diff)
downloadfolk-a0eaf8cffc77ffb98f35403a306bf5d5b718e8ee.tar.gz
folk-a0eaf8cffc77ffb98f35403a306bf5d5b718e8ee.zip
Test long default code
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/editor.folk17
1 files changed, 9 insertions, 8 deletions
diff --git a/virtual-programs/editor.folk b/virtual-programs/editor.folk
index 8461f8f3..b7f150e1 100644
--- a/virtual-programs/editor.folk
+++ b/virtual-programs/editor.folk
@@ -95,7 +95,9 @@ proc newRegion {program x y w h} {
Claim $program has region [region create $vertices $edges]
}
-set baseCode "Claim\nWish \$this is outlined green"
+# set baseCode "Claim\nWish \$this is outlined green"
+# long base code
+set baseCode "Claim\nWish \$this is outlined green\nClaim this is a super long linelooooooooong line\nClaim the future is good\nClaim lorem ipsum\nClaim bloooooop\nClaim hello"
Commit code { Claim $id has program code $baseCode }
proc drawText {text cursor count region} {
@@ -138,16 +140,14 @@ proc debug {position color} {
}
proc drawCursor {cursorPosition lineShift region} {
- puts "$lineShift | $cursorPosition"
set anchor [region centroid $region]
set angle [region angle $region]
- # 9 is the width of a character, 20 is the height of a character
- # These values could theortically be set from drawText in Display.tcl
set cursorHeight 20
set cursorWidth 9
set shiftMultiplier [list 10 10]
+ # 20 20 scale is arbitrary, computing it off of Display or something .....
set cursorScale [list 20 20] ;# OLD
# set cursorScale [list $cursorHeight $cursorWidth]
@@ -161,12 +161,13 @@ proc drawCursor {cursorPosition lineShift region} {
# add (x * width) to the shiftedAnchor position from the beginning of the line ...
# Calculate the final cursor position
set scaledCursor [vec2::mult $cursorScale $cursorPosition]
+
puts "lineShiftHalf | multipliedShift | adjustedShift | shiftedAnchor | scaledCursor"
puts "$lineShiftHalf | $multipliedShift | $adjustedShift | $shiftedAnchor | $scaledCursor"
- debug $scaledCursor blue
+
# Something is going wrong here, I think
set finalCursor [add $shiftedAnchor $scaledCursor]
- debug $finalCursor gold
+ # debug $finalCursor gold
# Rotate and display the cursor
set rotatedFinalCursor [lindex [rotateStroke [list $finalCursor] $anchor $angle] 0]
# This is where the cursor point is relative to.
@@ -182,8 +183,6 @@ proc drawCursor {cursorPosition lineShift region} {
Display::stroke [rotateStroke \
[list $finalCursor \
[add $finalCursor [list $cursorWidth 0]] \
- [add $finalCursor [list [* -3 $cursorWidth] $cursorHeight]] \
- [add $finalCursor [list 0 $cursorHeight]] \
] \
$anchor $angle] 2 green
}
@@ -191,7 +190,9 @@ proc drawCursor {cursorPosition lineShift region} {
When $id has program code /code/ & the clock time is /t/ & the cursor is /cursor/ & $id has region /r/ {
set intTime [expr {int($t * 10)}]
drawText [insertCursor $code $cursor $intTime] $cursor $intTime $r
+
set lineShift [getLineShift $code]
+ # Hmmmm, need a fn to go from cursor to pixel positions
drawCursor $cursor $lineShift $r
}