Changeset 11397 in josm for trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
- Timestamp:
- 2016-12-14T15:50:53+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r11383 r11397 504 504 if (e.hasThumbnail()) { 505 505 Dimension d = scaledDimension(e.getThumbnail()); 506 Rectangle target = new Rectangle(p.x - d.width / 2, p.y - d.height / 2, d.width, d.height); 507 if (clip.intersects(target)) { 508 tempG.drawImage(e.getThumbnail(), target.x, target.y, target.width, target.height, null); 506 if (d != null) { 507 Rectangle target = new Rectangle(p.x - d.width / 2, p.y - d.height / 2, d.width, d.height); 508 if (clip.intersects(target)) { 509 tempG.drawImage(e.getThumbnail(), target.x, target.y, target.width, target.height, null); 510 } 509 511 } 510 512 } else { // thumbnail not loaded yet … … 540 542 if (useThumbs && e.hasThumbnail()) { 541 543 Dimension d = scaledDimension(e.getThumbnail()); 542 imgWidth = d.width; 543 imgHeight = d.height; 544 if (d != null) { 545 imgWidth = d.width; 546 imgHeight = d.height; 547 } else { 548 imgWidth = -1; 549 imgHeight = -1; 550 } 544 551 } else { 545 552 imgWidth = selectedIcon.getIconWidth(); … … 756 763 if (useThumbs && img.hasThumbnail()) { 757 764 Dimension d = scaledDimension(img.getThumbnail()); 758 r = new Rectangle(p.x - d.width / 2, p.y - d.height / 2, d.width, d.height); 765 if (d != null) 766 r = new Rectangle(p.x - d.width / 2, p.y - d.height / 2, d.width, d.height); 767 else 768 r = null; 759 769 } else { 760 770 r = new Rectangle(p.x - icon.getIconWidth() / 2, … … 763 773 icon.getIconHeight()); 764 774 } 765 if (r .contains(evt.getPoint())) {775 if (r != null && r.contains(evt.getPoint())) { 766 776 return img; 767 777 } … … 861 871 if (useThumbs && e.hasThumbnail()) { 862 872 Dimension d = scaledDimension(e.getThumbnail()); 863 r = new Rectangle(p.x - d.width / 2, p.y - d.height / 2, d.width, d.height); 873 if (d != null) 874 r = new Rectangle(p.x - d.width / 2, p.y - d.height / 2, d.width, d.height); 875 else 876 r = null; 864 877 } else { 865 878 r = new Rectangle(p.x - icon.getIconWidth() / 2, … … 868 881 icon.getIconHeight()); 869 882 } 870 if (r .contains(ev.getPoint())) {883 if (r != null && r.contains(ev.getPoint())) { 871 884 clearOtherCurrentPhotos(); 872 885 currentPhoto = i;
Note:
See TracChangeset
for help on using the changeset viewer.