Changeset 5356 for trunk/gui/scripts
- Timestamp:
- Apr 29, 2015, 3:35:42 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/molvisviewer.tcl
r5351 r5356 70 70 protected method Rebuild {} 71 71 protected method Rotate {option x y} 72 protected method Rotate.old {option x y} 72 73 protected method SendCmd { string } 73 74 protected method Unmap {} 74 protected method Vmouse {option b m x y} 75 protected method Vmouse2 {option b m x y} 75 protected method Vmouse {option b m x y} 76 76 protected method Zoom {option {factor 10}} 77 77 … … 344 344 set _image(id) "" 345 345 346 # set up bindings for rotation347 346 if 0 { 347 # set up bindings to bridge mouse events to server 348 bind $itk_component(3dview) <ButtonPress> \ 349 [itcl::code $this Vmouse click %b %s %x %y] 350 bind $itk_component(3dview) <ButtonRelease> \ 351 [itcl::code $this Vmouse release %b %s %x %y] 352 bind $itk_component(3dview) <B1-Motion> \ 353 [itcl::code $this Vmouse drag 1 %s %x %y] 354 bind $itk_component(3dview) <B2-Motion> \ 355 [itcl::code $this Vmouse drag 2 %s %x %y] 356 bind $itk_component(3dview) <B3-Motion> \ 357 [itcl::code $this Vmouse drag 3 %s %x %y] 358 bind $itk_component(3dview) <Motion> \ 359 [itcl::code $this Vmouse move 0 %s %x %y] 360 } else { 361 # set up bindings for rotation with mouse 348 362 bind $itk_component(3dview) <ButtonPress-1> \ 349 363 [itcl::code $this Rotate click %x %y] … … 352 366 bind $itk_component(3dview) <ButtonRelease-1> \ 353 367 [itcl::code $this Rotate release %x %y] 354 } else { 355 bind $itk_component(3dview) <ButtonPress-1> \ 356 [itcl::code $this Vmouse click %b %s %x %y] 357 bind $itk_component(3dview) <B1-Motion> \ 358 [itcl::code $this Vmouse drag 1 %s %x %y] 359 bind $itk_component(3dview) <ButtonRelease-1> \ 360 [itcl::code $this Vmouse release %b %s %x %y] 361 } 362 363 bind $itk_component(3dview) <ButtonPress-2> \ 364 [itcl::code $this Pan click %x %y] 365 bind $itk_component(3dview) <B2-Motion> \ 366 [itcl::code $this Pan drag %x %y] 367 bind $itk_component(3dview) <ButtonRelease-2> \ 368 [itcl::code $this Pan release %x %y] 369 368 369 # set up bindings for panning with mouse 370 bind $itk_component(3dview) <ButtonPress-2> \ 371 [itcl::code $this Pan click %x %y] 372 bind $itk_component(3dview) <B2-Motion> \ 373 [itcl::code $this Pan drag %x %y] 374 bind $itk_component(3dview) <ButtonRelease-2> \ 375 [itcl::code $this Pan release %x %y] 376 377 # scroll wheel zoom 378 if {[string equal "x11" [tk windowingsystem]]} { 379 bind $itk_component(3dview) <4> [itcl::code $this Zoom out 2] 380 bind $itk_component(3dview) <5> [itcl::code $this Zoom in 2] 381 } 382 } 383 384 # Set up bindings for panning with keyboard 370 385 bind $itk_component(3dview) <KeyPress-Left> \ 371 386 [itcl::code $this Pan set -10 0] … … 384 399 bind $itk_component(3dview) <Shift-KeyPress-Down> \ 385 400 [itcl::code $this Pan set 0 50] 401 402 # Set up bindings for zoom with keyboard 386 403 bind $itk_component(3dview) <KeyPress-Prior> \ 387 404 [itcl::code $this Zoom out 2] … … 390 407 391 408 bind $itk_component(3dview) <Enter> "focus $itk_component(3dview)" 392 393 394 if {[string equal "x11" [tk windowingsystem]]} {395 bind $itk_component(3dview) <4> [itcl::code $this Zoom out 2]396 bind $itk_component(3dview) <5> [itcl::code $this Zoom in 2]397 }398 399 # set up bindings to bridge mouse events to server400 #bind $itk_component(3dview) <ButtonPress> \401 # [itcl::code $this Vmouse2 click %b %s %x %y]402 #bind $itk_component(3dview) <ButtonRelease> \403 # [itcl::code $this Vmouse2 release %b %s %x %y]404 #bind $itk_component(3dview) <B1-Motion> \405 # [itcl::code $this Vmouse2 drag 1 %s %x %y]406 #bind $itk_component(3dview) <B2-Motion> \407 # [itcl::code $this Vmouse2 drag 2 %s %x %y]408 #bind $itk_component(3dview) <B3-Motion> \409 # [itcl::code $this Vmouse2 drag 3 %s %x %y]410 #bind $itk_component(3dview) <Motion> \411 # [itcl::code $this Vmouse2 move 0 %s %x %y]412 409 413 410 bind $itk_component(3dview) <Configure> \ … … 1342 1339 } 1343 1340 1344 1345 itcl::body Rappture::MolvisViewer::Vmouse2 {option b m x y} { 1341 # 1342 # Send virtual mouse events using the vmouse command 1343 # 1344 itcl::body Rappture::MolvisViewer::Vmouse {option b m x y} { 1346 1345 set now [clock clicks -milliseconds] 1347 1346 set vButton [expr $b - 1] … … 1370 1369 } 1371 1370 1372 itcl::body Rappture::MolvisViewer::Vmouse {option b m x y} { 1371 # ---------------------------------------------------------------------- 1372 # USAGE: Rotate click <x> <y> 1373 # USAGE: Rotate drag <x> <y> 1374 # USAGE: Rotate release <x> <y> 1375 # 1376 # Called automatically when the user clicks/drags/releases in the 1377 # plot area. Moves the plot according to the user's actions. 1378 # ---------------------------------------------------------------------- 1379 itcl::body Rappture::MolvisViewer::Rotate {option x y} { 1373 1380 set now [clock clicks -milliseconds] 1374 1381 # cancel any pending delayed dragging events … … 1386 1393 if { $option == "drag" || $option == "release" } { 1387 1394 set diff 0 1388 1389 1390 set _mevent(afterid) [after [expr 25 - $diff] [itcl::code $this Vmouse drag $b $m$x $y]]1391 1392 1395 catch { set diff [expr $now - $_mevent(time) ] } 1396 if {$diff < 25 && $option == "drag" } { # 75ms between motion updates 1397 set _mevent(afterid) [after [expr 25 - $diff] [itcl::code $this Rotate drag $x $y]] 1398 return 1399 } 1393 1400 set w [winfo width $itk_component(3dview)] 1394 1401 set h [winfo height $itk_component(3dview)] … … 1438 1445 1439 1446 # ---------------------------------------------------------------------- 1440 # USAGE: Rotate click <x> <y>1441 # USAGE: Rotate drag <x> <y>1442 # USAGE: Rotate release <x> <y>1447 # USAGE: Rotate.old click <x> <y> 1448 # USAGE: Rotate.old drag <x> <y> 1449 # USAGE: Rotate.old release <x> <y> 1443 1450 # 1444 1451 # Called automatically when the user clicks/drags/releases in the 1445 1452 # plot area. Moves the plot according to the user's actions. 1446 1453 # ---------------------------------------------------------------------- 1447 itcl::body Rappture::MolvisViewer::Rotate {option x y} {1454 itcl::body Rappture::MolvisViewer::Rotate.old {option x y} { 1448 1455 set now [clock clicks -milliseconds] 1449 1456 #update idletasks … … 1463 1470 drag { 1464 1471 if {[array size _click] == 0} { 1465 Rotate click $x $y1472 Rotate.old click $x $y 1466 1473 } else { 1467 1474 set w [winfo width $itk_component(3dview)] … … 1470 1477 return 1471 1478 } 1472 #set diff 01473 #catch { set diff [expr $now - $_mevent(time) ] }1474 # if {$diff < 175 && $option == "drag" } { # 75ms between motion updates1475 # set _mevent(afterid) [after [expr 175 - $diff] [itcl::code $this Rotatedrag $x $y]]1476 #return1477 #}1479 #set diff 0 1480 #catch { set diff [expr $now - $_mevent(time) ] } 1481 #if {$diff < 75 && $option == "drag" } { # 75ms between motion updates 1482 # set _mevent(afterid) [after [expr 75 - $diff] [itcl::code $this Rotate.old drag $x $y]] 1483 # return 1484 #} 1478 1485 1479 1486 if {[catch { … … 1530 1537 } 1531 1538 release { 1532 Rotate drag $x $y1539 Rotate.old drag $x $y 1533 1540 $itk_component(3dview) configure -cursor "" 1534 1541 catch {unset _click}
Note: See TracChangeset
for help on using the changeset viewer.