- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.Scheduling library for HTML5 & JavaScript.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Java 10 and Windows Text Scaling Support
Read 829 times

Jasef   Offline
YaBB Newbies
*
Posts: 22


   
     
 
Java 10 and Windows Text Scaling Support
Jun 21st, 2018 at 12:40am
 
Does JDiagram 4.3.2 support Java 10 and windows text (resolution) scaling?
(Does not require high resolution monitors, reproducible on both 1080 and 1440 resolutions)

I seem to be getting a white area to the right and below the diagram area which the diagram view covers. (See attached image)
You can test this with ctrl+mouse wheel to see the diagram zoon in/out.
(There should be no zooming when the mouse is in the gray area)
It doesn't happen on Java 8. It also occurs on Java 9.

I've also attached some sample code.
 
 

MainWin.zip (0 KB | 23 )
image.png (15 KB | 28 )
image.png
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1548
Gender: male
tech.support


   
     
 
Re: Java 10 and Windows Text Scaling Support
Reply #1 - Jun 24th, 2018 at 4:13pm
 
From what we can tell, Java started scaling control layout sizes by ScreenResolution value. The diagram does not draw itself relative to DiagramView's size though, but already scales by ScreenResolution internally,  so Java's additional scale leaves that white border unpainted. You can work around that by inverse-scaling the view size to compensate for the extra resolution scale:

Code:
public class DiagramViewEx extends DiagramView
{
  public DiagramViewEx(Diagram diagram)
  {
    super(diagram);
  }

  public Dimension getPreferredSize()
  {
    var scale = Toolkit.getDefaultToolkit().getScreenResolution() / 96.0f;
    var size = super.getPreferredSize();
    size.setSize(
      size.getWidth() / scale,
      size.getHeight() / scale);
    return size;
  }
} 



Regards,
Slavcho
Mindfusion
 
 
 
IP Logged    
 
     

Jasef   Offline
YaBB Newbies
*
Posts: 22


   
     
 
Re: Java 10 and Windows Text Scaling Support
Reply #2 - Jun 25th, 2018 at 11:33pm
 
Thanks Slavcho.

We had to use the following instead to handle Windows not updating the value from getScreenResolution until log out.

Code (Java):
    @Override
    public Dimension getPreferredSize()
    {
        AffineTransform transform = getGraphicsConfiguration().getDefaultTransform();
        Dimension size = super.getPreferredSize();

        size.setSize(
                size.getWidth() / transform.getScaleX(),
                size.getHeight() / transform.getScaleY()
        );

        return size;
    } 




Cheers,
Jasef.
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print