I want to show a popup next to a graphic that I selected with findGraphics.
I guess a way to do this is to get the Graphic's geometry x and y and show my popup there.
Is this correct? if so, how do I access the Graphic's x and y?
I would use the mouseClicked signal on the map for this. This signal passes a MouseEvent object with it ArcGIS Runtime SDK for Qt (QML API): Map
From that, you can get the screen coordinates and the map coordinates.
ArcGIS Runtime SDK for Qt (QML API): MouseEvent
Perhaps you could then place your components location somewhere near this?
Yes it work well enough, thanks!
I'm being silly, I just need to store the mouse.x and mouse.y values...
Thanks Luke.
I see a difficulty in that I am currently calling findGraphics in a onMousePressed event, but then deal with the result in the GraphicLayer's onFindGraphicsComplete. Here's the code:
GraphicsLayer {
id: gl
renderingMode: Enums.RenderingModeStatic
onFindGraphicsComplete: {
gl.clearSelection();
if (graphicIDs[0]) {
gl.selectGraphic(graphicIDs[0]);
console.log(graphicIDs[0])
}
onMousePressed: {
var tolerance = Qt.platform.os === "ios" || Qt.platform.os === "android" ? 4 : 1;
gl.findGraphics(mouse.x, mouse.y, tolerance * scaleFactor, 1)
so far I have been able to get the geometry's envelope x and y in map coordinates - how do I convert those to screen coordinates?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.