Menu

#448 Undo movement jumps to end of list

closed-fixed
nobody
2
2009-03-05
2008-06-29
Anonymous
No

Undo movement jumps to end of list:
I don't if anyone else has had an issue with this, but one thing that I find mildly annoying with the User Interface is the way that the combat/non-com scroll bar (to the right of the listed moves) always jumps up to the latest manuever whenever you click "undo" for a given step. So often times, for example, I want to undo a series of combat or non-com moves (say 10, 11 and 12), but after I click undo for move 12, its autoscrolls back up to the top of the list, instead of just staying put so I can quickly undo 11 and 10 without having to scroll back down each time. In Revised and Classic the issue is less dramatic, though even there, in a turn with a lot of combat or non-Combat movements, I still notice the issue. I'm not sure if there is a simple way to fix this, but I think it would be nice.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I agree. It is very annoying and would be nice to see this fixed.

     
  • ComradeKev

    ComradeKev - 2008-10-01
    • priority: 5 --> 2
     
  • ComradeKev

    ComradeKev - 2008-10-01
    • labels: --> Interface (example)
     
  • Chris McIntosh

    Chris McIntosh - 2009-02-01

    I've modified the file. Could a developer apply this patch.

    I tested this in classic by opening the game and moving 15 of Russia units, then undoing. The scrollbar stayed where it should.

    Index: UndoableMovesPanel.java

    --- UndoableMovesPanel.java (revision 2293)
    +++ UndoableMovesPanel.java (working copy)
    @@ -31,6 +31,11 @@
    private final GameData m_data;
    private final MovePanel m_movePanel;

    + // Place scroll pane in class global scope so the inner undo class can record
    + // the position so we can go back to that place.
    + JScrollPane scroll;
    + Integer scrollBarPreviousValue = null;
    +
    public UndoableMovesPanel(GameData data, MovePanel movePanel)
    {
    m_data = data;
    @@ -94,12 +99,15 @@
    }
    }

    - JScrollPane scroll = new JScrollPane(items);
    + scroll = new JScrollPane(items);
    scroll.setBorder(null);
    scroll.getVerticalScrollBar().setUnitIncrement(scrollIncrement);

    + if (scrollBarPreviousValue != null) {
    + scroll.getVerticalScrollBar().setValue(scrollBarPreviousValue);
    + scrollBarPreviousValue = null;
    + }

    -
    add(scroll, BorderLayout.CENTER);
    SwingUtilities.invokeLater(new Runnable()
    {
    @@ -176,6 +184,8 @@

    public void actionPerformed(ActionEvent e)
    {
    + // Record position of scroll bar as percentage.
    + scrollBarPreviousValue = scroll.getVerticalScrollBar().getValue();
    m_movePanel.undoMove(m_moveIndex);
    }
    }
    @@ -190,7 +200,7 @@
    }

    public void actionPerformed(ActionEvent e)
    - {
    + {
    m_movePanel.cancelMove();
    if(!m_movePanel.getMap().isShowing(m_move.getRoute().getEnd()))
    m_movePanel.getMap().centerOn(m_move.getRoute().getEnd());

     
  • ComradeKev

    ComradeKev - 2009-02-04
    • status: open --> open-fixed
     
  • ComradeKev

    ComradeKev - 2009-02-04

    Fix checked in for version 1.0.2.1

     
  • ComradeKev

    ComradeKev - 2009-02-04

    Fix checked in for version 1.0.2.1

     
  • ComradeKev

    ComradeKev - 2009-02-04
    • status: open-fixed --> pending-fixed
     
  • ComradeKev

    ComradeKev - 2009-03-05
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.