IDEA-141348 Text error wave issues
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 19 Jun 2015 15:58:17 +0000 (18:58 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 19 Jun 2015 15:59:15 +0000 (18:59 +0300)
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/util/src/com/intellij/util/ui/UIUtil.java

index e9507352a6a5472dbb2392facd20903fb3095ae0..ce89a60e121d77fe7fe18d8247eaa25576d19673 100644 (file)
@@ -2358,7 +2358,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
         int y = visibleLineToY(visibleStartLine) + getAscent() + 1;
         g.setColor(attributes.getEffectColor());
         if (attributes.getEffectType() == EffectType.WAVE_UNDERSCORE) {
-          UIUtil.drawWave((Graphics2D)g, new Rectangle(end.x, y, charWidth - 1, 2));
+          UIUtil.drawWave((Graphics2D)g, new Rectangle(end.x, y, charWidth - 1, getDescent()- 1));
         }
         else if (attributes.getEffectType() == EffectType.BOLD_DOTTED_LINE) {
           final int dottedAt = SystemInfo.isMac ? y - 1 : y;
index 948694b0e7a4006dc7113280b955bac180634902..18b5e8bfd2a71fd982142af25dc8f1355314763f 100644 (file)
@@ -603,13 +603,15 @@ public class UIUtil {
     GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
     Stroke oldStroke = g.getStroke();
     try {
-      g.setStroke(new BasicStroke(0.7F));
-      double cycle = 4;
-      final double wavedAt = rectangle.y + (double)rectangle.height /2 - .5;
+      float thickness = 0.7f;
+      g.setStroke(new BasicStroke(thickness));
+      double height = 1;
+      double cycle = 4*height;
+      final double wavedAt = rectangle.y + rectangle.height - thickness - height;
       GeneralPath wavePath = new GeneralPath();
-      wavePath.moveTo(rectangle.x, wavedAt -  Math.cos(rectangle.x * 2 * Math.PI / cycle));
-      for (int x = rectangle.x + 1; x <= rectangle.x + rectangle.width; x++) {
-        wavePath.lineTo(x, wavedAt - Math.cos(x * 2 * Math.PI / cycle) );
+      wavePath.moveTo(rectangle.x, wavedAt - Math.cos(rectangle.x * 2 * Math.PI / cycle)*height);
+      for (int x = rectangle.x + 1; x < rectangle.x + rectangle.width; x++) {
+        wavePath.lineTo(x, wavedAt - Math.cos(x * 2 * Math.PI / cycle)*height);
       }
       g.draw(wavePath);
     }