aboutsummaryrefslogtreecommitdiff
path: root/demos/iconTransform.tcl
diff options
context:
space:
mode:
authorlecoanet2003-03-30 09:09:44 +0000
committerlecoanet2003-03-30 09:09:44 +0000
commit839c6cd06b3fccc2e6dc227746e58b3544a70b22 (patch)
tree9a1ca213fcdf9dc4e4dfa93d6b52698f1b0cf28b /demos/iconTransform.tcl
parentd6a7dbb3a6090cc7d8007237f0b4f75c1d3f0112 (diff)
downloadtkzinc-839c6cd06b3fccc2e6dc227746e58b3544a70b22.zip
tkzinc-839c6cd06b3fccc2e6dc227746e58b3544a70b22.tar.gz
tkzinc-839c6cd06b3fccc2e6dc227746e58b3544a70b22.tar.bz2
tkzinc-839c6cd06b3fccc2e6dc227746e58b3544a70b22.tar.xz
Mise � jour interm�diaire
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
}