diff options
| author | Andrés Cuervo <andrescuervor@gmail.com> | 2023-09-04 20:19:20 +0000 |
|---|---|---|
| committer | Andrés Cuervo <andrescuervor@gmail.com> | 2023-09-04 20:19:20 +0000 |
| commit | 558b479674b6865f2ccf18d437044fbd6fe5ec4b (patch) | |
| tree | 4c00a3371cbeb9acf89116aef49a1db44e05df86 /virtual-programs | |
| parent | Start fixing dot trie (diff) | |
| download | folk-558b479674b6865f2ccf18d437044fbd6fe5ec4b.tar.gz folk-558b479674b6865f2ccf18d437044fbd6fe5ec4b.zip | |
Begin rewriting shapes to correctly use centroid-relative positioning
Diffstat (limited to 'virtual-programs')
| -rw-r--r-- | virtual-programs/shapes.folk | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/virtual-programs/shapes.folk b/virtual-programs/shapes.folk index 25c615c5..33d13767 100644 --- a/virtual-programs/shapes.folk +++ b/virtual-programs/shapes.folk @@ -58,7 +58,12 @@ proc shape {numPoints x y r {color white} {filled false} args} { } When /someone/ wishes /p/ draws a /color/ /shape/ offset /offsetVector/ & /p/ has region /r/ { - lassign [regionToInnerRect $r] x y width height + # -------------- + # TODO: Remove magic numbers, replace with consistent math defined off of centroid, width, and height + # -------------- + lassign [region centroid $r] x y + set width [region width $r] + set height [region height $r] lassign $offsetVector offsetX offsetY if {$offsetX != 0} { @@ -68,6 +73,8 @@ When /someone/ wishes /p/ draws a /color/ /shape/ offset /offsetVector/ & /p/ ha set y [expr {$y + $offsetY}] } + # Hmmmm, what's the point of adjustedWidth? To compensate for the wacky shape function? + # Solution is to probably refactor shae to return linked points of consistent size from centroid. set adjustedWidth [expr {$width * 0.25}] set x [expr { $x * 1.3}] set y [expr { $y * 1.25}] |
