Changeset 1174
- Timestamp:
- 09/28/18 10:22:03 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FreeItems.java
r1102 r1174 59 59 @Override 60 60 public void clear() 61 { 61 { 62 62 for (Item i : this) { 63 63 i.invalidateAll(); … … 105 105 public static boolean textOnlyAttachedToCursor() 106 106 { 107 if (!hasItemsAttachedToCursor()) return false; 108 109 for (Item i : getInstance()) { 110 if (!(i instanceof Text)) return false; 107 if (!hasItemsAttachedToCursor()) { 108 return false; 109 } 110 111 for (Item i : getInstance()) { 112 if (!(i instanceof Text)) { 113 return false; 114 } 111 115 } 112 116 … … 116 120 public static Item getItemAttachedToCursor() 117 121 { 118 if (hasItemsAttachedToCursor()) return getInstance().get(0); 122 if (hasItemsAttachedToCursor()) { 123 return getInstance().get(0); 124 } 119 125 120 126 return null; … … 123 129 public static Text getTextAttachedToCursor() 124 130 { 125 if (textOnlyAttachedToCursor()) return (Text) getInstance().get(0); 131 if (textOnlyAttachedToCursor()) { 132 return (Text) getInstance().get(0); 133 } 126 134 127 135 return null; … … 137 145 138 146 for (Item i : getInstance()) { 139 if (i instanceof Text) textItems.add((Text) i); 147 if (i instanceof Text) { 148 textItems.add((Text) i); 149 } 140 150 } 141 151 … … 150 160 Collection<Item> addedItems = new HashSet<Item>(); 151 161 for (Item i : getInstance()) { 152 if (!(i instanceof Text) || !i.isLineEnd()) continue; 162 if (!(i instanceof Text) || !i.isLineEnd()) { 163 continue; 164 } 153 165 154 166 // Check for text inside the box … … 218 230 if(i.isVisible()) { 219 231 toCount.removeAll(i.getAllConnected()); // treat polygons as a single item 220 if(c++ > 0) return true; 232 if(c++ > 0) { 233 return true; 234 } 221 235 } 222 236 } … … 239 253 public static boolean rubberBanding() 240 254 { 241 if (getInstance().size() != 2) return false; 255 if (getInstance().size() != 2) { 256 return false; 257 } 242 258 243 259 // if rubber-banding, there will be 1 line end and the rest will be lines … … 245 261 for (Item i : getInstance()) { 246 262 if (i.isLineEnd()) { 247 if (foundLineEnd) return false; 263 if (foundLineEnd) { 264 return false; 265 } 248 266 foundLineEnd = true; 249 267 } else if (!(i instanceof Line) || !i.isVisible()) {
Note:
See TracChangeset
for help on using the changeset viewer.