Commit 749e4847 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1602-click-on-pathways-and-compartments' into 'devel_16.0.x'

if pathway is too far don't highlight it

See merge request !1411
parents 3137d440 07881f01
Pipeline #51129 failed with stage
in 13 minutes and 48 seconds
......@@ -17,6 +17,9 @@ minerva (16.0.6) stable; urgency=medium
"default_compartment" id was crashing (#1622)
* Bug fix: import of SBGN file where TARGET PORT of modification was not
defined crashed minerva (#1620)
* Bug fix: clicking on 'empty' area in the map using "Pathways and
compartments view" returned results for the closest Pathway/Compartment
(#1603)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 16 Dec 2021 11:00:00 +0200
......
......@@ -210,6 +210,7 @@ SearchDbOverlay.prototype.computeMaxDistance = function (model, zoom) {
*/
SearchDbOverlay.prototype.findCompartmentByCoordinates = function (coordinates, zoom, model, maxDistance) {
var self = this;
var result = undefined;
return ServerConnector.getClosestElementsByCoordinates({
modelId: model.getId(),
coordinates: coordinates,
......@@ -228,7 +229,8 @@ SearchDbOverlay.prototype.findCompartmentByCoordinates = function (coordinates,
}
});
}
}).then(function (result) {
}).then(function (compartment) {
result = compartment;
if (result !== undefined) {
return model.getAliasById(result.getId(), true).then(function (alias) {
//pathways with glyph and z index below 0 should not be clickable
......@@ -239,6 +241,19 @@ SearchDbOverlay.prototype.findCompartmentByCoordinates = function (coordinates,
}
});
}
}).then(function () {
if (result !== undefined) {
return self.getMap().getDistance({
modelId: result.getModelId(),
coordinates: coordinates,
element: result
}).then(function (distance) {
if (distance <= maxDistance) {
return result;
}
});
}
return result;
});
};
......
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