Commit 1e0bfca4 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

added proper getscroll detection for nw anchored images (e.g. imagebang)

parent ee89f304
...@@ -3775,12 +3775,23 @@ proc pdtk_canvas_getscroll {name} { ...@@ -3775,12 +3775,23 @@ proc pdtk_canvas_getscroll {name} {
set imgh [image height $img] set imgh [image height $img]
set imgw [image width $img] set imgw [image width $img]
set center [$name coords $item] set center [$name coords $item]
set coords [list \ #for debugging purposes
[expr [lindex $center 0] - [expr $imgw/2]] \ #puts stderr "IMAGE: $anchor [lindex $center 0] [lindex $center 1]"
[expr [lindex $center 1] - [expr $imgh/2]] \ if { $anchor == "nw" } {
[expr [lindex $center 0] + [expr $imgw/2]] \ set coords [list \
[expr [lindex $center 1] + [expr $imgh/2]] \ [expr [lindex $center 0]] \
] [expr [lindex $center 1]] \
[expr [lindex $center 0] + [expr $imgw]] \
[expr [lindex $center 1] + [expr $imgh]] \
]
} else {
set coords [list \
[expr [lindex $center 0] - [expr $imgw/2]] \
[expr [lindex $center 1] - [expr $imgh/2]] \
[expr [lindex $center 0] + [expr $imgw/2]] \
[expr [lindex $center 1] + [expr $imgh/2]] \
]
}
foreach {x y} $coords { foreach {x y} $coords {
if { $x < $x1 } {set x1 $x} if { $x < $x1 } {set x1 $x}
if { $x > $x2 } {set x2 $x} if { $x > $x2 } {set x2 $x}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment