Comment 5 for bug 1220575

Revision history for this message
Luciana Moreira Sá de Souza (lso) wrote :

Hey RainMan,

I believe I fixed one part of the problem on my machine. The score calculation was incorrect. I don't know how this can work in windows...

Here is the new code which calculates correctly a value from 0 to 1 in org.sikuli.ide.PatternSimilaritySlider.paintComponent:

     @Override
 protected void paintComponent(Graphics g) {
  int w = getWidth();
  final int margin = 13;
  final int y1 = 20, y2 = 30;
  for (int i = 0; i < w - (margin *2); i++) {
   float score = (float) i / (w - margin);
   g.setColor(getScoreColor(score));
   g.drawLine(i + margin, y1, i + margin, y2);
  }
  if (getValue() != curVal) {
   curVal = getValue();
   showValue(lblVal, curVal);
  }
  super.paintComponent(g);
 }

Only problem is that the slider is not taking over the space it should on the screen, so at first everything on the slider is squeezed. After I maximize the window, the slide shows correctly with the colors.