Hello Community,
I found a bug in the "crosshair" package 1.2 (part of tklib):
File crosshair.tcl, in the function "::crosshair::Unhide" , line 6:
"set opts(hidden) 1"
is only defined as local variable, so has no effect to hide the
crosshair when the mouse leaves the canvas. The crosshair is still
displayed. It occurs from the second time the cursor leaves the canvas,
so maybe it's why it was missed during tests.
I propose the following correction (add 2 lines after line 6):
# Store changes back.
set config($w) [array get opts]
full function:
proc ::crosshair::Unhide { w x y } {
variable config
if { ![info exists config($w)] } return
array set opts $config($w)
# Already unhidden, do nothing
if { !$opts(hidden) } return
set opts(hidden) 0
# Store changes back.
set config($w) [array get opts]
# Recreate cross-hair. This takes the bounding boxes, if any, into
# account, i.e. if we are out of bounds nothing will appear.
Move $w $x $y
return
}
so the config array is updated, the crosshair is hidden when the mouse
cursor leaves the canvas.
Someone to look at it and confirm ?
Thanks !
Hello Community,
I found a bug in the "crosshair" package 1.2 (part of tklib):
File crosshair.tcl, in the function "::crosshair::Unhide" , line 6:
"set opts(hidden) 1"
is only defined as local variable, so has no effect to hide the
crosshair when the mouse leaves the canvas. The crosshair is still
displayed. It occurs from the second time the cursor leaves the canvas,
so maybe it's why it was missed during tests.
I propose the following correction (add 2 lines after line 6):
# Store changes back.
set config($w) [array get opts]
full function:
proc ::crosshair::Unhide { w x y } {
variable config
if { ![info exists config($w)] } return
array set opts $config($w)
# Already unhidden, do nothing
if { !$opts(hidden) } return
set opts(hidden) 0
# Store changes back.
set config($w) [array get opts]
# Recreate cross-hair. This takes the bounding boxes, if any, into
# account, i.e. if we are out of bounds nothing will appear.
Move $w $x $y
return
}
so the config array is updated, the crosshair is hidden when the mouse
cursor leaves the canvas.
Someone to look at it and confirm ?
Thanks !
On 12/14/22 08:04, Adrien Peulvast wrote:
Hello Community,
I found a bug in the "crosshair" package 1.2 (part of tklib):
File crosshair.tcl, in the function "::crosshair::Unhide" , line 6:
"set opts(hidden) 1"
is only defined as local variable, so has no effect to hide the
crosshair when the mouse leaves the canvas. The crosshair is still
displayed. It occurs from the second time the cursor leaves the
canvas, so maybe it's why it was missed during tests.
I propose the following correction (add 2 lines after line 6):
# Store changes back.
set config($w) [array get opts]
full function:
proc ::crosshair::Unhide { w x y } {
variable config
if { ![info exists config($w)] } return
array set opts $config($w)
# Already unhidden, do nothing
if { !$opts(hidden) } return
set opts(hidden) 0
# Store changes back.
set config($w) [array get opts]
# Recreate cross-hair. This takes the bounding boxes, if any, into >> # account, i.e. if we are out of bounds nothing will appear.
Move $w $x $y
return
}
so the config array is updated, the crosshair is hidden when the mouse
cursor leaves the canvas.
Someone to look at it and confirm ?
Thanks !
May I suggest that you go to the Fossil repo and create a ticket and
submit a fix.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 493 |
Nodes: | 16 (2 / 14) |
Uptime: | 183:41:05 |
Calls: | 9,705 |
Files: | 13,737 |
Messages: | 6,179,548 |