Menu

#3679 MechViewPanel width and height not properly set

stable 0.36
closed
None
fixed
6
2013-04-13
2013-03-21
No

In MechViewPanel.java:
Line 128 should be:

int width = DEFAULT_WIDTH;

instead of

int width = WIDTH;

Line 136 should be:

int height = DEFAULT_HEIGHT;

instead of

int height = HEIGHT;

DEFAULT_WIDTH and DEFAULT_HEIGHT are defined in MechViewPanel, WIDTH and HEIGHT are flags in java.awt.image.ImageObserver.

Discussion

  • Nicholas Walczak

    I spent some more time on this and have made a few more changes, which I have attached as a patch.

    In a discussion with Xenon54z, he recommended ensuring that fluff images don't make the MechViewPanel get too large, so I decided to check to see if the fluff image is larger than DEFAULT_WIDTH, and if it is the image is scaled to be less than or equal to DEFAULT_WIDTH while preserving the aspect ratio.

    While making this change, I made two other fixes. One, is that in MechSelectorDialog the unit table selection changed callback (MechSelectorDialog line 179) can fire more than once per selection change, which causes multiple calls to refreshUnitView. The ListSelectionEvent has a method, getValueIsAdjusting that can be used to ensure that the refreshUnitView is only called once each time the selection is changed.

    In addition, the refreshUnitView method within MechSelectorDialog is a bit inefficient. It creates a MechView object just to check whether it can be created with the selected Entity, and if it can be created, it updates the MechViewPanel which creates another MechView. By adding a new setMech(Entity, MechView) method to MechViewDialog only one MechView needs to be created.

     
  • Sebastian Brocks

    • assigned_to: Sebastian Brocks
    • resolution: none --> fixed
     
  • Sebastian Brocks

    fixed, thanks

     
  • Sebastian Brocks

    • milestone: undetermined --> stable 0.36
     
  • Sebastian Brocks

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB