Changeset 1142 for trunk/src/org/expeditee/gio/TextLayoutManager.java
- Timestamp:
- 09/18/18 11:57:32 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gio/TextLayoutManager.java
r1097 r1142 17 17 public List<TextLayout> layoutStringRelative(String string, Font font, int widthLimit, int lineSpacing, boolean dontBreakWords, boolean fullJustify) 18 18 { 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); 20 20 } 21 21 … … 71 71 for(Line l : lines) { 72 72 // 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(); 76 76 float newWidth; 77 77 if(dX == 0) { 78 newWidth = l.getFirstEnd(). x;78 newWidth = l.getFirstEnd().getX(); 79 79 } else if(dY == 0) { 80 newWidth = Math.min(l.getFirstEnd(). x, l.getSecondEnd().x);80 newWidth = Math.min(l.getFirstEnd().getX(), l.getSecondEnd().getX()); 81 81 } 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; 83 83 } 84 if(newWidth < p. x) {84 if(newWidth < p.getX()) { 85 85 continue; 86 86 } … … 90 90 } 91 91 } 92 return width - p. x;92 return width - p.getX(); 93 93 } 94 94
Note:
See TracChangeset
for help on using the changeset viewer.