aboutsummaryrefslogtreecommitdiff
path: root/demos/iconTransform.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'demos/iconTransform.tcl')
-rw-r--r--demos/iconTransform.tcl18
1 files changed, 10 insertions, 8 deletions
diff --git a/demos/iconTransform.tcl b/demos/iconTransform.tcl
index 7f245dc..4d00bad 100644
--- a/demos/iconTransform.tcl
+++ b/demos/iconTransform.tcl
@@ -11,7 +11,7 @@ set w .iconTransform
catch {destroy $w}
toplevel $w
wm title $w "Zinc icon scale/rotate Demonstration"
-wm iconname $w zincTransform
+wm iconname $w iconTransform
set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*"
@@ -33,9 +33,9 @@ pack $w.text -expand yes -fill both
$w.text insert end {This demo needs openGL for rescaling/rotating the icon
You can transform this earth gif image with your mouse:
- Drag-Button 1 for zooming the earth,
- Drag-Button 2 for rotating the earth,
- Drag-Button 3 for moving the earth,
+ Drag-Button 1 for moving the earth,
+ Drag-Button 2 for zooming the earth,
+ Drag-Button 3 for rotating the earth,
Shift-Drag-Button 1 for modifying the earth transparency.}
@@ -64,6 +64,8 @@ bind $w.zinc <ButtonPress-1> "press motion %x %y"
bind $w.zinc <ButtonRelease-1> release
bind $w.zinc <ButtonPress-2> "press zoom %x %y"
bind $w.zinc <ButtonRelease-2> release
+bind $w.zinc <ButtonPress-3> "press mouseRotate %x %y"
+bind $w.zinc <ButtonRelease-3> release
#
# Controls for alpha and gradient
@@ -123,7 +125,7 @@ proc mouseRotate {x y} {
global w curAngle topGroup
set lAngle [expr atan2($y, $x)]
- $w.zinc rotate $topGroup [expr -($lAngle - $curAngle)]
+ $w.zinc rotate $topGroup [expr $lAngle - $curAngle]
set curAngle $lAngle
}
@@ -134,11 +136,11 @@ proc release {} {
}
proc modifyAlpha {x y} {
- global w
+ global w topGroup
set xRate [expr double($x) / [$w.zinc cget -width]]
set xRate [expr ($xRate < 0) ? 0 : ($xRate > 1) ? 1 : $xRate]
- set alpha [expr $xRate * 100]
+ set alpha [expr int($xRate * 100)]
- $w.zinc itemconfigure $group -alpha $alpha
+ $w.zinc itemconfigure $topGroup -alpha $alpha
}