Ignore:
Timestamp:
04/23/07 13:07:25 (13 years ago)
Author:
curtis
Message:

Add clockwise and counterclockwise rotation buttons.

Location:
trunk/loci/visbio/view
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/view/ViewHandler.java

    r1989 r2657  
    5252 
    5353  /** How far display rotates each time. */ 
    54   public static final double ROTATION_AMOUNT = 30; 
     54  public static final double ROTATION_AMOUNT = 15; 
    5555 
    5656  /** How far display pans each time. */ 
     
    110110  /** Zooms out on the display. */ 
    111111  public void zoomOut() { zoom(1 / ZOOM_AMOUNT); } 
     112 
     113  /** Rotates the display to the left (3D only). */ 
     114  public void rotateClockwise() { rotate(0, 0, ROTATION_AMOUNT); } 
     115 
     116  /** Rotates the display to the left (3D only). */ 
     117  public void rotateCounterclockwise() { rotate(0, 0, -ROTATION_AMOUNT); } 
    112118 
    113119  /** Rotates the display to the left (3D only). */ 
  • trunk/loci/visbio/view/ViewPanel.java

    r1989 r2657  
    9595    else if (cmd.equals("panUp")) handler.panUp(); 
    9696    else if (cmd.equals("panDown")) handler.panDown(); 
     97    else if (cmd.equals("rotateClock")) handler.rotateClockwise(); 
     98    else if (cmd.equals("rotateCounter")) handler.rotateCounterclockwise(); 
    9799    else if (cmd.equals("rotateLeft")) handler.rotateLeft(); 
    98100    else if (cmd.equals("rotateRight")) handler.rotateRight(); 
     
    149151 
    150152    // rotate buttons 
     153    JButton rotateCW = makeButton("rotate-clock.png", "Rotate clockwise", 
     154      "rotateClock", "Rotates the display clockwise"); 
     155    JButton rotateCC = makeButton("rotate-counter.png", 
     156      "Rotate counterclockwise", "rotateCounter", 
     157      "Rotates the display counterclockwise"); 
    151158    JButton rotateL = null, rotateR = null, rotateU = null, rotateD = null; 
    152159    if (threeD) { 
     
    162169 
    163170    // lay out components 
    164     String rows = "pref, 3dlu, pref"; 
    165     if (threeD) rows += ", 3dlu, pref"; 
    166     PanelBuilder builder = new PanelBuilder(new FormLayout( 
    167       "pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref", rows)); 
     171    PanelBuilder builder = new PanelBuilder(new FormLayout("pref, 3dlu, " + 
     172      "pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref", 
     173      "pref, 3dlu, pref, 3dlu, pref")); 
    168174    CellConstraints cc = new CellConstraints(); 
    169175 
     
    179185    builder.add(panD, cc.xy(9, 3)); 
    180186 
    181     if (threeD) { 
    182       builder.addLabel("Rotate", cc.xy(1, 5)); 
    183       builder.add(rotateL, cc.xy(3, 5)); 
    184       builder.add(rotateR, cc.xy(5, 5)); 
    185       builder.add(rotateU, cc.xy(7, 5)); 
    186       builder.add(rotateD, cc.xy(9, 5)); 
     187    builder.addLabel("Rotate", cc.xy(1, 5)); 
     188    builder.add(rotateCW, cc.xy(3, 5)); 
     189    builder.add(rotateCC, cc.xy(5, 5)); 
     190    if (threeD) { 
     191      builder.add(rotateL, cc.xy(7, 5)); 
     192      builder.add(rotateR, cc.xy(9, 5)); 
     193      builder.add(rotateU, cc.xy(11, 5)); 
     194      builder.add(rotateD, cc.xy(13, 5)); 
    187195    } 
    188196 
Note: See TracChangeset for help on using the changeset viewer.