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

add legend in feature #1082

Open
alissonrodrigo opened this issue Jun 28, 2024 · 7 comments
Open

add legend in feature #1082

alissonrodrigo opened this issue Jun 28, 2024 · 7 comments
Labels

Comments

@alissonrodrigo
Copy link

I would like to know how I can add the distance and area measurement feature to the "LineString" and "Polygon" controls in the example "https://viglino.github.io/ol-ext/examples/bar/map.control.editionbar. html" I would like to set these values ​​as caption and not tooltip. Thank you, sorry for anything but I'm new here.

@Viglino
Copy link
Owner

Viglino commented Jun 28, 2024

You have to get the interaction associated with the controls (2 and 3) and set the tooltip feature with the one of the draw:

// Add a tooltip
var tooltip = new ol.Overlay.Tooltip();
map.addOverlay(tooltip);

// Set drawing feature (interaction on control 2 and 3
[2,3].forEach(function(i) {
  // Drawline interaction
  var draw= editbar.getControls()[i].getInteraction()
  // Set feature on drawstart
  draw.on('drawstart', tooltip.setFeature.bind(tooltip));
  // Remove feature on finish
  draw.on(['change:active','drawend'], tooltip.removeFeature.bind(tooltip));
})

@alissonrodrigo
Copy link
Author

tooltip

Is it possible to fix the measured value? instead of just a tooltip

@Viglino
Copy link
Owner

Viglino commented Jun 28, 2024

Use CSS:

.ol-popup.tooltips.black {
    transform: none !important;
    bottom: 0;
}

@alissonrodrigo
Copy link
Author

I don't think I can explain it properly, so I'll attach an image. You can see that for each line there is fixed measurement dataimage

@alissonrodrigo
Copy link
Author

Does anyone know how I can fix the values ​​on the screen?

@Viglino
Copy link
Owner

Viglino commented Jul 2, 2024

@alissonrodrigo
Copy link
Author

I don't intend to fix the popup, but rather a label with the distance fixed

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

No branches or pull requests

2 participants