possibly fix to work with negative values
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1101 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ScrollBox.java,v 1.2 2003/03/26 20:38:18 ray Exp $
|
// $Id: ScrollBox.java,v 1.3 2003/04/20 01:06:12 ray Exp $
|
||||||
|
|
||||||
package com.samskivert.swing;
|
package com.samskivert.swing;
|
||||||
|
|
||||||
@@ -120,15 +120,17 @@ public class ScrollBox extends JPanel
|
|||||||
*/
|
*/
|
||||||
protected void updateBox ()
|
protected void updateBox ()
|
||||||
{
|
{
|
||||||
_hFactor = (_active.width) /
|
int hmin = _horz.getMinimum();
|
||||||
(float) (_horz.getMaximum() - _horz.getMinimum());
|
int vmin = _vert.getMinimum();
|
||||||
_vFactor = (_active.height) /
|
_hFactor = (_active.width) / (float) (_horz.getMaximum() - hmin);
|
||||||
(float) (_vert.getMaximum() - _vert.getMinimum());
|
_vFactor = (_active.height) / (float) (_vert.getMaximum() - vmin);
|
||||||
|
|
||||||
_box.x = _active.x + (int) Math.round(_horz.getValue() * _hFactor);
|
_box.x = _active.x + (int) Math.round((_horz.getValue() - hmin) *
|
||||||
|
_hFactor);
|
||||||
_box.width = (int) Math.round(_horz.getExtent() * _hFactor);
|
_box.width = (int) Math.round(_horz.getExtent() * _hFactor);
|
||||||
|
|
||||||
_box.y = _active.y + (int) Math.round(_vert.getValue() * _vFactor);
|
_box.y = _active.y + (int) Math.round((_vert.getValue() - vmin) *
|
||||||
|
_vFactor);
|
||||||
_box.height = (int) Math.round(_vert.getExtent() * _vFactor);
|
_box.height = (int) Math.round(_vert.getExtent() * _vFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user