Ignore:
Timestamp:
09/18/18 11:57:32 (6 years ago)
Author:
bln4
Message:

Used Eclipse refactoring to encapsulate Point.X and Point.Y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gio/TextLayoutManager.java

    r1097 r1142  
    1717        public List<TextLayout> layoutStringRelative(String string, Font font, int widthLimit, int lineSpacing, boolean dontBreakWords, boolean fullJustify)
    1818        {
    19                 return layoutString(string, font, Point.ORIGIN, null, widthLimit, lineSpacing, dontBreakWords, fullJustify);
     19                return layoutString(string, font, Point.ORIGIN.clone(), null, widthLimit, lineSpacing, dontBreakWords, fullJustify);
    2020        }
    2121       
     
    7171                for(Line l : lines) {
    7272                        // check for lines that cross over our y
    73                         if((l.getFirstEnd().y >= p.y && l.getSecondEnd().y <= p.y) || (l.getFirstEnd().y <= p.y && l.getSecondEnd().y >= p.y)) {
    74                                 float dX = l.getFirstEnd().x - l.getSecondEnd().x;
    75                                 float dY = l.getFirstEnd().y - l.getSecondEnd().y;
     73                        if((l.getFirstEnd().getY() >= p.getY() && l.getSecondEnd().getY() <= p.getY()) || (l.getFirstEnd().getY() <= p.getY() && l.getSecondEnd().getY() >= p.getY())) {
     74                                float dX = l.getFirstEnd().getX() - l.getSecondEnd().getX();
     75                                float dY = l.getFirstEnd().getY() - l.getSecondEnd().getY();
    7676                                float newWidth;
    7777                                if(dX == 0) {
    78                                         newWidth = l.getFirstEnd().x;
     78                                        newWidth = l.getFirstEnd().getX();
    7979                                } else if(dY == 0) {
    80                                         newWidth = Math.min(l.getFirstEnd().x, l.getSecondEnd().x);
     80                                        newWidth = Math.min(l.getFirstEnd().getX(), l.getSecondEnd().getX());
    8181                                } else {
    82                                         newWidth = l.getFirstEnd().x + (p.y - l.getFirstEnd().y) * dX / dY;
     82                                        newWidth = l.getFirstEnd().getX() + (p.getY() - l.getFirstEnd().getY()) * dX / dY;
    8383                                }
    84                                 if(newWidth < p.x) {
     84                                if(newWidth < p.getX()) {
    8585                                        continue;
    8686                                }
     
    9090                        }
    9191                }
    92                 return width - p.x;
     92                return width - p.getX();
    9393        }
    9494       
Note: See TracChangeset for help on using the changeset viewer.