Completed
Last Updated: 09 Apr 2019 14:44 by Dimitar
Release R2 2019 (LIB 2019.1.415)
Chris
Created on: 03 Apr 2019 08:16
Category: UI for WinForms
Type: Bug Report
1
RadMap: MapCallouts are not hit-tested correctly

How to reproduce: add a MapCallout to a layer and then try to hit test it in the MouseDown event of the control. The element is not always returned even though it contains the mouse location:

private void RadMap1_MouseDown(object sender, MouseEventArgs e)
{
    PointL point = new PointL(e.X - this.radMap1.MapElement.PanOffset.Width, e.Y - this.radMap1.MapElement.PanOffset.Height);
    MapCallout callout2 = this.radMap1.Layers.HitTest(point) as MapCallout;
    if (callout2 != null)
    {
        RadMessageBox.Show("MapCallout!");
    }
}

2 comments
Dimitar
Posted on: 09 Apr 2019 14:44
Hello, 
 
A Fix will be available in LIB Version 2019.1.415 scheduled for April 15th.

Regards,
Dimitar
ADMIN
Hristo
Posted on: 03 Apr 2019 08:33
Hi,

A possible workaround is to create a custom MapCallout class and override its HitTest method: 
public class MyMapCallout : MapCallout
{
    public MyMapCallout(PointG location) : base(location)
    {
    }
 
    public MyMapCallout(MapVisualElement element) : base(element)
    {
    }
 
    public override bool HitTest(PointG pointG, PointL pointL, IMapViewport viewport)
    {
      bool isInsideFigure = false;
      using (GraphicsPath newPath = new GraphicsPath(this.path.PathPoints, this.path.PathTypes))
      using (Matrix translateMatrix = new Matrix())
      {
          translateMatrix.Translate(this.drawRect.X, this.drawRect.Y);
          newPath.Transform(translateMatrix);
          isInsideFigure = newPath.IsVisible(pointL.X, pointL.Y);
      }
       
      return isInsideFigure;
   }
}


Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.