Changeset 1125 for trunk/src/org/expeditee/items/Text.java
- Timestamp:
- 09/13/18 12:30:53 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Text.java
r1116 r1125 979 979 // if a rebuild is required 980 980 rebuild(true, false); 981 981 982 982 // determine the new position the cursor should have 983 983 for (int i = 0; i < _textLayouts.size(); i++) { … … 992 992 993 993 if (newLine == lineIndex) { 994 // System.err.println("newLine == lineIndex"); 994 995 if (insertionIndex > 0) 995 996 hit = current.getNextRightHit(insertionIndex - 1); … … 1008 1009 float[] caret = current.getCaretInfo(hit); 1009 1010 float y = getLineDrop(current) * lineIndex; 1011 y = getY() + y + caret[1]; 1010 1012 1011 1013 float x = getX() + caret[0] + getJustOffset(current); 1012 x = Math.min( 1013 x, 1014 (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth()) 1015 ); 1016 1017 invalidateAll(); 1018 1019 return new Point(Math.round(x), Math.round(getY() + y + caret[1])); 1014 x = Math.min(x, (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth())); 1015 1016 invalidateAll(); 1017 1018 // System.err.println("Mouse location: " + mouseX + "," + mouseY); 1019 // System.err.println("Caret location: " + caret[0] + "," + caret[1]); 1020 1021 // System.err.println(text); 1022 // System.err.println("X delta: " + (x - getX())); 1023 final Point newCursor = new Point(Math.round(x), Math.round(y)); 1024 // System.err.println("Moving cursor to: " + newCursor); 1025 return newCursor; 1020 1026 } 1021 1027 … … 1223 1229 { 1224 1230 invalidateAll(); 1225 // all decoding occurs in the Utils class1231 1226 1232 _font = font; 1227 // rejustify(); 1233 1228 1234 rebuild(false); 1229 1235 … … 1247 1253 public Font getPaintFont() 1248 1254 { 1249 if (getFont() == null) { 1250 return EcosystemManager.getFontManager().getDefaultFont().clone(); 1251 } 1252 return getFont(); 1255 final Font f = getFont(); 1256 if (f == null) { 1257 _font = EcosystemManager.getFontManager().getDefaultFont().clone(); 1258 return _font; 1259 } 1260 return f; 1253 1261 } 1254 1262 … … 1324 1332 Font currentFont = getPaintFont(); 1325 1333 currentFont.toggleBold(); 1326 setFont(currentFont);1334 //setFont(currentFont); 1327 1335 rebuild(true); 1328 1336 invalidateAll(); … … 1333 1341 Font currentFont = getPaintFont(); 1334 1342 currentFont.toggleItalic(); 1335 setFont(currentFont);1343 //setFont(currentFont); 1336 1344 rebuild(true); 1337 1345 invalidateAll(); … … 1343 1351 if (newFace == null || newFace.trim().length() == 0) { 1344 1352 currentFont.setStyle(Font.Style.PLAIN); 1345 setFont(currentFont);1353 //setFont(currentFont); 1346 1354 return; 1347 1355 } … … 1359 1367 } 1360 1368 1361 setFont(currentFont);1369 //setFont(currentFont); 1362 1370 1363 1371 } … … 1478 1486 Font currentFont = getPaintFont(); 1479 1487 currentFont.setSpacing(spacing); 1480 setFont(currentFont);1488 //setFont(currentFont); 1481 1489 } 1482 1490 … … 1916 1924 fill = null; 1917 1925 } 1926 // System.err.println("Top left: " + getBoundingBox().getTopLeft() + ", " + "Bottom right: " + getBoundingBox().getBottomRight()); 1918 1927 g.drawRectangle(bounds, 0.0, fill, getPaintHighlightColor(), highlightStroke, null); 1919 1928 } … … 1989 1998 copy.setWordSpacing(getWordSpacing()); 1990 1999 copy.setWidth(getWidthToSave()); 1991 copy.setFont(getFont() );2000 copy.setFont(getFont().clone()); 1992 2001 if (hasFormula()) { 1993 2002 copy.calculate(getFormula()); … … 2025 2034 Font currentFont = getPaintFont(); 2026 2035 currentFont.setSize((int) size); 2027 setFont(currentFont);2036 //setFont(currentFont); 2028 2037 rebuild(true); 2029 2038 invalidateAll();
Note:
See TracChangeset
for help on using the changeset viewer.