Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker tooltip with negative elevation #278

Open
mttucl opened this issue Nov 18, 2023 · 1 comment
Open

Marker tooltip with negative elevation #278

mttucl opened this issue Nov 18, 2023 · 1 comment

Comments

@mttucl
Copy link

mttucl commented Nov 18, 2023

When displaying bathymetry data, the marker tooltip line is shown above the path with the tip outside the map. This only happens if all data is negative. If there is another path with positive elevation data, it will only happen if I display the bathymetry data first for the first time after loading the page. Once I check the other path, it will display the bathymetry data tooltip correctly.

Sorry, I don't have a working example but you can try the geojson demo example with attachment (change txt to geojson).

demo.txt

@Raruto
Copy link
Owner

Raruto commented Nov 19, 2023

Hi @mttucl,

If you're interested in seeing it resolved, please check it out and pitch a PR.

I would say that the problem is related to yMax calculation (I haven't checked in detail):

image

let yMax = (this.control._height() / props.yCoordMax * point[this.options.yAttr]);

yCoord: point.y,
length: point.y - yMax, // normalized Y

line
.attr("class", theme + " height-focus line")
.attr("x1", xCoord)
.attr("x2", xCoord)
.attr("y1", yCoord)
.attr("y2", length);

which also depends on yCoordMax variable:

this._yCoordMax = -Infinity;

if (this._yCoordMax < this._data[this._data.length - 1][this.options.yAttr]) this._yCoordMax = this._data[this._data.length - 1][this.options.yAttr];

/*
* Update the position/height indicator marker drawn onto the map
*/
_updateMarker(item) {
if (this._marker) {
this._marker.update({
map : this._map,
item : item,
yCoordMax : this._yCoordMax || 0,
options : this.options
});
}
},

If you're interested in seeing it resolved, please take a hard look and pitch a PR.

👋 Raruto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants