Commit 5eb2b556 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

pathways with glyphs and z-index <0 are not clickable

parent 7874d5c0
Pipeline #29022 passed with stage
in 13 minutes and 9 seconds
......@@ -21,7 +21,10 @@ minerva (15.1.0) unstable; urgency=medium
raised if images are not referenced in coords.txt file (#1308)
* Small improvement: hitting enter after filling credentials automatically
tries to log in (#1312)
* Small improvement: rest API provides information about element glyph
* Small improvement: rest API provides information about element glyph and z
index
* Small improvement: pathways with glyphs and z index below 0 are not
clickable (#1314)
* Bug fix: export to image from selected polygon contained all elements
inside rectangle bounded by the polygon coordinates (#1096)
* Bug fix: continuous refreshing list of project when uploading/removing
......
......@@ -23,6 +23,7 @@ function Alias(javaObject) {
if (javaObject.bounds !== undefined) {
this.setX(javaObject.bounds.x);
this.setY(javaObject.bounds.y);
this.setZ(javaObject.bounds.z);
this.setWidth(javaObject.bounds.width);
this.setHeight(javaObject.bounds.height);
}
......@@ -79,8 +80,11 @@ Alias.prototype.update = function (javaObject) {
this.setInitialAmount(javaObject.getInitialAmount());
this.setInitialConcentration(javaObject.getInitialConcentration());
this.setGlyph(javaObject.getGlyph());
this.setX(javaObject.getX());
this.setY(javaObject.getY());
this.setZ(javaObject.getZ());
this.setWidth(javaObject.getWidth());
this.setHeight(javaObject.getHeight());
......@@ -113,10 +117,12 @@ Alias.prototype.update = function (javaObject) {
this.setInitialAmount(javaObject.initialAmount);
this.setInitialConcentration(javaObject.initialConcentration);
this.setGlyph(javaObject.glyph);
if (javaObject.bounds !== undefined) {
this.setX(javaObject.bounds.x);
this.setY(javaObject.bounds.y);
this.setZ(javaObject.bounds.z);
this.setWidth(javaObject.bounds.width);
this.setHeight(javaObject.bounds.height);
}
......@@ -256,6 +262,24 @@ Alias.prototype.getY = function () {
return this.y;
};
/**
*
* @param {number} z
*/
Alias.prototype.setZ = function (z) {
if (z !== undefined) {
this.z = z;
}
};
/**
*
* @returns {number}
*/
Alias.prototype.getZ = function () {
return this.z;
};
/**
*
* @param {number} elementId
......@@ -400,4 +424,20 @@ Alias.prototype.getCenter = function () {
return new Point(this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() / 2);
};
/**
*
* @returns {Object}
*/
Alias.prototype.getGlyph = function () {
return this._glyph;
};
/**
*
* @param {Object} glyph
*/
Alias.prototype.setGlyph = function (glyph) {
this._glyph = glyph;
};
module.exports = Alias;
......@@ -228,6 +228,17 @@ SearchDbOverlay.prototype.findCompartmentByCoordinates = function (coordinates,
}
});
}
}).then(function (result) {
if (result !== undefined) {
return model.getAliasById(result.getId(), true).then(function (alias) {
//pathways with glyph and z index below 0 should not be clickable
if (alias.getType() === "Pathway" && alias.getZ() < 0 && alias.getGlyph() !== null) {
return undefined;
} else {
return result;
}
});
}
});
};
......@@ -295,6 +306,13 @@ SearchDbOverlay.prototype.searchByCoordinates = function (params) {
searchResult.push(new IdentifiedElement(reactionElements[i]));
}
});
} else {
return model.getAliasById(searchResult[0].getId(), true).then(function (alias) {
//pathways with glyph and z index below 0 should not be clickable
if (alias.getType() === "Pathway" && alias.getZ() < 0 && alias.getGlyph() !== null) {
searchResult = [];
}
});
}
} else {
searchResult = [];
......
......@@ -212,7 +212,7 @@ public class ElementsRestImpl extends BaseRestImpl {
}
break;
case "bounds":
value = createBounds(element.getX(), element.getY(), element.getWidth(), element.getHeight());
value = createBounds(element.getX(), element.getY(),element.getZ(), element.getWidth(), element.getHeight());
break;
case "glyph":
value = createGlyph(element.getGlyph());
......@@ -321,10 +321,11 @@ public class ElementsRestImpl extends BaseRestImpl {
return result;
}
private Map<String, Object> createBounds(Double x, Double y, Double width, Double height) {
private Map<String, Object> createBounds(Double x, Double y, Integer z, Double width, Double height) {
Map<String, Object> result = new TreeMap<>();
result.put("x", x);
result.put("y", y);
result.put("z", z);
result.put("width", width);
result.put("height", height);
return result;
......
Supports Markdown
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