Commit a84a11b1 authored by Gloria's avatar Gloria
Browse files

popup scroll, eslint, iconAnchor fix

parent e05d6b8b
......@@ -42,7 +42,6 @@ public class Geomap implements Iterable<TopicModel>, JSONEnabled {
this.viewProps = viewProps;
this.geoCoords = geoCoords;
this.domainTopics = domainTopics;
}
// -------------------------------------------------------------------------------------------------- Public Methods
......@@ -85,16 +84,16 @@ public class Geomap implements Iterable<TopicModel>, JSONEnabled {
private Object geoMarkersJSON(Map<Long, TopicModel> geoCoords, Map<Long, List<TopicModel>> domainTopics) {
JSONArray geoMarkers = new JSONArray();
for(TopicModel item : geoCoords.values()){
for (TopicModel item : geoCoords.values()) {
JSONObject json = new JSONObject();
List domain = domainTopics.get(item.getId());
try {
json.put("geoCoordTopic", item.toJSON());
json.put("domainTopics", DMXUtils.toJSONArray(domain));
geoMarkers.put(json);
json.put("geoCoordTopic", item.toJSON());
json.put("domainTopics", DMXUtils.toJSONArray(domain));
geoMarkers.put(json);
} catch (Exception e) {
throw new RuntimeException("Serialization failed", e);
throw new RuntimeException("Serialization failed", e);
}
}
......
......@@ -122,11 +122,10 @@ public class GeomapsPlugin extends PluginActivator implements GeomapsService, Ge
List<Topic> domainTopics = new ArrayList();
for (Topic parentTopic : parentTopics) {
if (!parentTopic.getTypeUri().equals(ADDRESS) && !parentTopic.getTypeUri().equals(GEO_COORDINATE)) {
domainTopics.add(parentTopic);
domainTopics.add(parentTopic);
}
}
return domainTopics;
} catch (Exception e) {
throw new RuntimeException("Finding domain topics failed (geoCoordId=" + geoCoordId + ")", e);
}
......@@ -256,45 +255,45 @@ public class GeomapsPlugin extends PluginActivator implements GeomapsService, Ge
@Override
public void postUpdateTopic(Topic topic, ChangeReport report, TopicModel updateModel) {
// logger.info(">>>>> report=" + report);
CompDef compDef = hasAddressChildType(topic.getType());
if (compDef != null) {
Topic domainTopic = topic;
logger.info("@@@ domainTopic: " + domainTopic);
List<ChangeReport.Change> changes = report.getChanges(compDef.getCompDefUri());
if (changes != null) {
for (ChangeReport.Change change : changes) {
Topic oldValue = change.oldValue;
Topic newValue = change.newValue;
if (oldValue == null) {
// send add-domain-topic message
Topic toGeoCoord = getGeoCoordinateTopic(newValue);
me.addDomainTopic(toGeoCoord, domainTopic);
} else if (newValue == null) {
// send remove-domain-topic message
Topic fromGeoCoord = getGeoCoordinateTopic(oldValue);
me.removeDomainTopic(fromGeoCoord, domainTopic.getId());
} else {
// send move-domain-topic message
Topic fromGeoCoord = getGeoCoordinateTopic(oldValue);
Topic toGeoCoord = getGeoCoordinateTopic(newValue);
me.moveDomainTopic(fromGeoCoord, toGeoCoord, domainTopic);
}
}
}
}
// logger.info(">>>>> report=" + report);
CompDef compDef = hasAddressChildType(topic.getType());
if (compDef != null) {
Topic domainTopic = topic;
// logger.info("@@@ domainTopic: " + domainTopic);
List<ChangeReport.Change> changes = report.getChanges(compDef.getCompDefUri());
if (changes != null) {
for (ChangeReport.Change change : changes) {
Topic oldValue = change.oldValue;
Topic newValue = change.newValue;
if (oldValue == null) {
// send add-domain-topic message
Topic toGeoCoord = getGeoCoordinateTopic(newValue);
me.addDomainTopic(toGeoCoord, domainTopic);
} else if (newValue == null) {
// send remove-domain-topic message
Topic fromGeoCoord = getGeoCoordinateTopic(oldValue);
me.removeDomainTopic(fromGeoCoord, domainTopic.getId());
} else {
// send move-domain-topic message
Topic fromGeoCoord = getGeoCoordinateTopic(oldValue);
Topic toGeoCoord = getGeoCoordinateTopic(newValue);
me.moveDomainTopic(fromGeoCoord, toGeoCoord, domainTopic);
}
}
}
}
}
@Override
public void postDeleteTopic(TopicModel topic) {
logger.info("###PostDeleteTopic " + topic);
// send remove-domain-topic-from-all message
me.removeFromAll(topic.getId());
logger.info("###PostDeleteTopic " + topic);
// send remove-domain-topic-from-all message
me.removeFromAll(topic.getId());
}
// ---
......@@ -342,7 +341,7 @@ public class GeomapsPlugin extends PluginActivator implements GeomapsService, Ge
for (Topic geoCoordTopic : _fetchGeoCoordinates(geomapTopic)) {
List domain = getDomainTopics(geoCoordTopic.getId());
domainTopics.put(geoCoordTopic.getId(), domain);
}
}
// logger.info("@@@domainTopics" + domainTopics);
return domainTopics;
}
......
......@@ -129,10 +129,10 @@ export default {
// NOSPOT (remove marker)
if (this.geoMarkers[i].domainTopics.length === 0) {
this.markers.splice(i, 1)
// SINGLESPOT
// MULTISPOT
} else if (this.geoMarkers[i].domainTopics.length > 1) {
this.pushMarker(this.geoMarkers[i], '\uf041', '#3c90ce')
// MULTISPOT
// SINGLESPOT
} else if (this.geoMarkers[i].domainTopics.length === 1) {
this.pushMarker(this.geoMarkers[i],
this.geoMarkers[i].domainTopics[0].icon,
......@@ -150,12 +150,13 @@ export default {
const height = 40
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
<path d="${glyph.path}" fill="${color}" transform="scale(${ICON_SCALING} -${ICON_SCALING})
translate(100 -1400)"></path></svg>`
translate(100 -1600)"></path></svg>`
const svgURL = 'data:image/svg+xml,' + encodeURIComponent(svg)
return new L.Icon({/* eslint no-undef: "off" */
iconSize: [width, height],
iconAnchor: [width / 2, height / 4],
iconUrl: svgURL
iconAnchor: [width / 2, height],
iconUrl: svgURL,
popupAnchor: [1, -height / 2]
})
},
......@@ -240,6 +241,18 @@ export default {
.leaflet-popup-content {
min-width: 200px;
max-height: 300px;
min-height: 42px; /* see --loading-spinner-size in element-ui/packages/theme-chalk/src/common/var.scss */
overflow-y: scroll !important;
overflow-x: hidden;
}
.leaflet-popup-content .assoc.label {
display:none; /* hides the association labels like Address entry and Composition from the popup */
}
.leaflet-popup-content .fa-eye::before {
display:none; /* hides eye icon - */
}
</style>
......@@ -3,14 +3,14 @@ export default ({dmx}) => {
const state = {
geomap: undefined, // the rendered geomap (Geomap, see geomaps-service.js)
// {
// id:
// viewProps:
// geoMarkers: [
// {
// geoCoordTopic: {}
// domainTopics: []
// }
// ]
// id:
// viewProps:
// geoMarkers: [
// {
// geoCoordTopic: {}
// domainTopics: []
// }
// ]
// }
writable: false // if the rendered geomap is writable by the current user (Boolean)
}
......@@ -59,8 +59,8 @@ export default ({dmx}) => {
}
/** finds the geoCoord Id
* @returns the index of the geoCoord
*/
* @returns the index of the geoCoord
*/
function findIndex (geoCoordId) {
for (let i = 0; i < state.geomap.geoMarkers.length; i++) {
if (state.geomap.geoMarkers[i].geoCoordTopic.id === geoCoordId) {
......@@ -100,8 +100,8 @@ export default ({dmx}) => {
}
/**
* @returns the remain domainTopics in the geoMarker
*/
* @returns the remain domainTopics in the geoMarker
*/
function filterDomainTopics (i, domainTopicId) {
const remainDomainTopics = state.geomap.geoMarkers[i].domainTopics = state.geomap.geoMarkers[i].domainTopics.filter(
elem => elem.id !== domainTopicId)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment