Ticket #24671: patch_24671.txt

File patch_24671.txt, 2.3 KB (added by DanProgs <Abenteurer.2901@…>, 28 hours ago)
Line 
1### Eclipse Workspace Patch 1.0
2#P JMapViewer
3Index: src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java
4===================================================================
5--- src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java (revision 36495)
6+++ src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java (working copy)
7@@ -131,36 +131,32 @@
8 }
9
10 public boolean handleAttribution(Point p, boolean click) {
11- if (source == null || !source.requiresAttribution())
12+ if (source == null || !source.requiresAttribution()) {
13 return false;
14-
15- if (attrTextBounds != null && attrTextBounds.contains(p)) {
16- String attributionURL = source.getAttributionLinkURL();
17- if (attributionURL != null) {
18- if (click) {
19- FeatureAdapter.openLink(attributionURL);
20- }
21- return true;
22+ }
23+
24+ if (getUrlAtPoint(p) != null) {
25+ if (click) {
26+ FeatureAdapter.openLink(getUrlAtPoint(p));
27 }
28- } else if (attrImageBounds != null && attrImageBounds.contains(p)) {
29- String attributionImageURL = source.getAttributionImageURL();
30- if (attributionImageURL != null) {
31- if (click) {
32- FeatureAdapter.openLink(source.getAttributionImageURL());
33- }
34- return true;
35- }
36- } else if (attrToUBounds != null && attrToUBounds.contains(p)) {
37- String termsOfUseURL = source.getTermsOfUseURL();
38- if (termsOfUseURL != null) {
39- if (click) {
40- FeatureAdapter.openLink(termsOfUseURL);
41- }
42- return true;
43- }
44+ return true;
45 }
46+
47 return false;
48 }
49+
50+ private String getUrlAtPoint(Point p) {
51+ if (attrTextBounds != null && attrTextBounds.contains(p)) {
52+ return source.getAttributionLinkURL();
53+ }
54+ if (attrImageBounds != null && attrImageBounds.contains(p)) {
55+ return source.getAttributionImageURL();
56+ }
57+ if (attrToUBounds != null && attrToUBounds.contains(p)) {
58+ return source.getTermsOfUseURL();
59+ }
60+ return null;
61+ }
62
63 }
64