Ignore:
Timestamp:
06/20/08 12:55:35 (16 years ago)
Author:
ra33
Message:

Made a whole lot of changes...

Including using polyLine etc for drawing rectangles nicer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Text.java

    r98 r105  
    5858        public static final int MINIMUM_RANGED_CHARS = 2;
    5959
    60         public static final int UP = 0;
    61 
    62         public static final int DOWN = 1;
    63 
    64         public static final int LEFT = 2;
    65 
    66         public static final int RIGHT = 3;
    67 
    68         public static final int HOME = 4;
    69 
    70         public static final int END = 5;
    71 
    72         public static final int PAGE_DOWN = 6;
    73 
    74         public static final int PAGE_UP = 7;
     60        public static final int NONE = 0;
     61
     62        public static final int UP = 1;
     63
     64        public static final int DOWN = 2;
     65
     66        public static final int LEFT = 3;
     67
     68        public static final int RIGHT = 4;
     69
     70        public static final int HOME = 5;
     71
     72        public static final int END = 6;
     73
     74        public static final int PAGE_DOWN = 7;
     75
     76        public static final int PAGE_UP = 8;
    7577
    7678        private int _maxWidth = -1;
     
    392394                // move the cursor to the new location
    393395                float[] caret = last.getCaretInfo(hit);
    394                 int y = getLineDrop(last) * line;
    395 
    396                 int x = ((int) (getX() + caret[0]) + getJustOffset(last));
     396                float y = getLineDrop(last) * line;
     397
     398                int x = ((int) (getX() + caret[0] + 0.5) + getJustOffset(last));
    397399                x = Math
    398400                                .min(
    399401                                                x,
    400402                                                (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth()));
    401                 return new Point(x, getY() + /* DisplayIO.getOffset() + */y
    402                                 + (int) caret[1]);
     403                return new Point(x, (int) (getY() + y + caret[1] + 0.5));
    403404        }
    404405
     
    614615                // move the cursor to the new location
    615616                float[] caret = current.getCaretInfo(hit);
    616                 int y = getLineDrop(current) * line;
    617 
    618                 int x = ((int) (getX() + caret[0]) + getJustOffset(current));
     617                float y = getLineDrop(current) * line;
     618
     619                int x = (int) (getX() + caret[0] + 0.5) + getJustOffset(current);
    619620                x = Math
    620621                                .min(
    621622                                                x,
    622623                                                (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth()));
    623                 return new Point(x, getY() + y + (int) caret[1]);
     624                return new Point(x, (int) (getY() + y + caret[1] + 0.5));
    624625        }
    625626
     
    698699                // move the cursor to the new location
    699700                float[] caret = current.getCaretInfo(hit);
    700                 int y = getLineDrop(current) * line;
    701 
    702                 return new Point((int) (getX() + caret[0]) + getJustOffset(current),
    703                                 getY() + y + (int) caret[1]);
     701                float y = getLineDrop(current) * line;
     702
     703                return new Point((int) (getX() + caret[0] + 0.5)
     704                                + getJustOffset(current), (int) (getY() + y + caret[1] + 0.5));
    704705        }
    705706
     
    937938        }
    938939
    939         private int getLineDrop(TextLayout layout) {
     940        private float getLineDrop(TextLayout layout) {
    940941                if (getSpacing() < 0)
    941                         return (int) (layout.getAscent() + layout.getDescent() + layout
    942                                         .getLeading());
    943 
    944                 return (int) (layout.getAscent() + layout.getDescent() + getSpacing());
     942                        return layout.getAscent() + layout.getDescent()
     943                                        + layout.getLeading();
     944
     945                return layout.getAscent() + layout.getDescent() + getSpacing();
    945946        }
    946947
Note: See TracChangeset for help on using the changeset viewer.