Changeset 4055 for trunk


Ignore:
Timestamp:
Nov 14, 2013, 3:44:32 PM (11 years ago)
Author:
ldelgass
Message:

Reset zoom when changing aspect (stretch mode) setting. Also, make Zoom reset
only reset zoom/pan (not rotation) and add CameraReset? method to reset all
camera settings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/vtkheightmapviewer.tcl

    r3963 r4055  
    6464    public method scale {args}
    6565
     66    protected method CameraReset {}
    6667    protected method Connect {}
    6768    protected method CurrentDatasets {args}
     
    288289            -highlightthickness 0 \
    289290            -image [Rappture::icon reset-view] \
    290             -command [itcl::code $this Zoom reset]
     291            -command [itcl::code $this CameraReset]
    291292    } {
    292293        usual
     
    11501151}
    11511152
     1153itcl::body Rappture::VtkHeightmapViewer::CameraReset {} {
     1154    array set _view {
     1155        qw      0.36
     1156        qx      0.25
     1157        qy      0.50
     1158        qz      0.70
     1159        zoom    1.0
     1160        xpan    0
     1161        ypan    0
     1162    }
     1163    if { $_first != "" } {
     1164        set location [$_first hints camera]
     1165        if { $location != "" } {
     1166            array set _view $location
     1167        }
     1168    }
     1169    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1170    $_arcball quaternion $q
     1171    if {$_settings(isHeightmap) } {
     1172        DoRotate
     1173    }
     1174    SendCmd "camera reset"
     1175}
     1176
    11521177# ----------------------------------------------------------------------
    11531178# USAGE: Zoom in
     
    11701195        "reset" {
    11711196            array set _view {
    1172                 qw      0.36
    1173                 qx      0.25
    1174                 qy      0.50
    1175                 qz      0.70
    11761197                zoom    1.0
    11771198                xpan    0
    11781199                ypan    0
    1179             }
    1180             if { $_first != "" } {
    1181                 set location [$_first hints camera]
    1182                 if { $location != "" } {
    1183                     array set _view $location
    1184                 }
    1185             }
    1186             set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1187             $_arcball quaternion $q
    1188             if {$_settings(isHeightmap) } {
    1189                 DoRotate
    11901200            }
    11911201            SendCmd "camera reset"
     
    14691479            SendCmd "dataset scalar $_curFldName"
    14701480            SendCmd "heightmap colormode scalar $_curFldName"
    1471             SendCmd "camera reset"
     1481            Zoom reset
    14721482            UpdateContourList
    14731483            DrawLegend
     
    15491559                bind $c <ButtonRelease-1> {}
    15501560            }
    1551             SendCmd "camera reset"
     1561            Zoom reset
    15521562            # Fix the mouse bindings for rotation/panning and the
    15531563            # camera mode. Ideally we'd create a bindtag for these.
     
    16451655                SendCmd "camera aspect native"
    16461656            }
     1657            Zoom reset
    16471658        }
    16481659        "wireframe" {
Note: See TracChangeset for help on using the changeset viewer.