Skip to content

Commit

Permalink
[zoom] default item linewidth to 1.0 at creation time
Browse files Browse the repository at this point in the history
(except for text items and rectangular selection outline)
  • Loading branch information
Ant1r committed Mar 14, 2024
1 parent 59652d2 commit 9b0107e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tcl/pd_canvaszoom.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ proc ::pd_canvaszoom::zoom_text_and_lines {c oldzdepth zdepth} {
$c addtag _lw$linewidth withtag $i
}
# scale
set newwitdth [expr {$linewidth * $zdepth}]
if {$newwitdth < 1} {set newwitdth 1}
$c itemconfigure $i -width $newwitdth
set newwidth [expr {$linewidth * $zdepth}]
if {$newwidth < 1} {set newwidth 1}
$c itemconfigure $i -width $newwidth
}
}
}
Expand Down Expand Up @@ -360,7 +360,20 @@ proc ::pd_canvaszoom::scale_command {cmd} {
"create" {
if {! [set zdepth [getzdepth [lindex $cmd 0]]]} {return $cmd}
set cmd [scale_consecutive_numbers $cmd 3 $zdepth]

set widthindex [lsearch -start 3 $cmd "-width"]
# for non-text, default linewidth to 1.0
if {$widthindex == -1 && [lindex $cmd 2] != "text"} {
set tagsindex [lsearch -start 3 $cmd "-tags"]
incr tagsindex
set tags [lindex $cmd $tagsindex]
# don't scale rect selection outline width (tagged "x")
if {{x} ni $tags} {
set cmd [string_lset $cmd $tagsindex [concat "\{ " $tags " \}" -width 1.0]]
set widthindex [lsearch -start 3 $cmd "-width"]
}
}
# now scale 'width' value, if any
if {$widthindex != -1} {
incr widthindex
set cmd [scale_consecutive_numbers $cmd $widthindex $zdepth]
Expand Down

0 comments on commit 9b0107e

Please sign in to comment.