Changeset 2217 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-09-30T01:21:34+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r2143 r2217 249 249 Point p = mv.getLocationOnScreen(); 250 250 Dimension scrn = Toolkit.getDefaultToolkit().getScreenSize(); 251 Dimension dim = content.getPreferredSize(); 252 253 int xPos = p.x + ms.mousePos.x + 16; 254 // Display the popup to the left of the cursor if it would be cut 255 // off on its right 256 if(xPos + dim.width > scrn.width) { 257 xPos = p.x + ms.mousePos.x - 4 - dim.width; 258 } 259 int yPos = p.y + ms.mousePos.y + 16; 260 // Move the popup up if it would be cut off at its bottom but do not 261 // move it off screen on the top 262 if(yPos + dim.height > scrn.height - 5) { 263 yPos = Math.max(5, scrn.height - dim.height - 5); 264 } 265 266 // Create a JScrollPane around the content, in case there's still 267 // not enough space 251 252 // Create a JScrollPane around the content, in case there's not 253 // enough space 268 254 JScrollPane sp = new JScrollPane(content); 269 255 sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); … … 271 257 // Implement max-size content-independent 272 258 Dimension prefsize = sp.getPreferredSize(); 273 int w = Math.min(prefsize.width, scrn.width/2);259 int w = Math.min(prefsize.width, Math.min(800, (scrn.width/2) - 16)); 274 260 int h = Math.min(prefsize.height, scrn.height - 10); 275 261 sp.setPreferredSize(new Dimension(w, h)); 262 263 int xPos = p.x + ms.mousePos.x + 16; 264 // Display the popup to the left of the cursor if it would be cut 265 // off on its right, but only if more space is available 266 if(xPos + w > scrn.width && xPos > scrn.width/2) { 267 xPos = p.x + ms.mousePos.x - 4 - w; 268 } 269 int yPos = p.y + ms.mousePos.y + 16; 270 // Move the popup up if it would be cut off at its bottom but do not 271 // move it off screen on the top 272 if(yPos + h > scrn.height - 5) { 273 yPos = Math.max(5, scrn.height - h - 5); 274 } 276 275 277 276 PopupFactory pf = PopupFactory.getSharedInstance(); … … 324 323 } 325 324 DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected()); 326 mv.repaint();327 325 } 328 326 … … 383 381 * Sets the colors for the given label depending on the selected status of 384 382 * the given OsmPrimitive 385 * 383 * 386 384 * @param lbl The label to color 387 385 * @param osm The primitive to derive the colors from … … 453 451 osm.setSelected(!osm.isSelected()); 454 452 DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected()); 455 mv.repaint();456 453 l.validate(); 457 454 }
Note:
See TracChangeset
for help on using the changeset viewer.