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

Implemented marker double click #5

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions GMap.NET.WindowsForms/GMap.NET.WindowsForms/GMapControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ namespace GMap.NET.WindowsForms
public partial class GMapControl : UserControl, Interface
{
#if !PocketPC
/// <summary>
/// occurs when double clicked on marker
/// </summary>
public event MarkerDoubleClick OnMarkerDoubleClick;

/// <summary>
/// occurs when clicked on marker
/// </summary>
Expand Down Expand Up @@ -1832,6 +1837,43 @@ protected override void OnMouseUp(MouseEventArgs e)
}

#if !PocketPC
protected override void OnMouseDoubleClick(MouseEventArgs e)
{
base.OnMouseDoubleClick(e);

if (!Core.IsDragging)
{
for (int i = Overlays.Count - 1; i >= 0; i--)
{
GMapOverlay o = Overlays[i];
if (o != null && o.IsVisibile)
{
foreach (var m in o.Markers)
{
if (m.IsVisible && m.IsHitTestVisible)
{
GPoint rp = new GPoint(e.X, e.Y);
#if !PocketPC
if (!MobileMode)
{
rp.OffsetNegative(Core.renderOffset);
}
#endif
if (m.LocalArea.Contains((int)rp.X, (int)rp.Y))
{
if (OnMarkerDoubleClick != null)
{
OnMarkerDoubleClick(m, e);
}
break;
}
}
}
}
}
}
}

protected override void OnMouseClick(MouseEventArgs e)
{
base.OnMouseClick(e);
Expand Down
1 change: 1 addition & 0 deletions GMap.NET.WindowsForms/GMap.NET.WindowsForms/GMapMarker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ public virtual void Dispose()
#endregion
}

public delegate void MarkerDoubleClick(GMapMarker item, MouseEventArgs e);
public delegate void MarkerClick(GMapMarker item, MouseEventArgs e);
public delegate void MarkerEnter(GMapMarker item);
public delegate void MarkerLeave(GMapMarker item);
Expand Down