Last Updated: 03 Aug 2017 07:41 by ADMIN
Created on: 31 Aug 2016 08:45
Category: Diagram, DiagramRibbonBar, DiagramToolBox
Type: Bug Report
FIX. RadDiagram - the ConnectionClicked event is not fired when the diagram is zoomed.
To reproduce:
- Add some connections and zoom.
- Click a connection
- The event is not fired.

Friend Class MyInputBehaviour
    Inherits DiagramInputBehavior

    Public Sub New(ByVal element As RadDiagramElement)
    End Sub
    Public Overrides Function HandleMouseUp(ByVal e As MouseEventArgs) As Boolean
        '  return base.HandleMouseUp(e);
        If Me.DiagramElement.ElementTree.Control.Site IsNot Nothing Then
            Return False
        End If
        Dim elementUnderMouse As RadElement = Me.DiagramElement.ElementTree.GetElementAtPoint(e.Location)
        If Me.IsScrollBar(elementUnderMouse) Then
            Return False
        End If

        If TypeOf elementUnderMouse Is RadButtonElement Then
            Return False
        End If

        Dim position = e.Location

        Dim transform As Telerik.WinControls.Layouts.RadMatrix = Me.DiagramElement.MainPanel.TotalTransform

        Dim transformedPosition = transform.TransformPoint(position)

        Dim service = Me.DiagramElement.Controller.ServiceLocator.GetService(Of IHitTestService)()
        Dim conectionUnderPoint = TryCast(service.GetItemsNearPoint(transformedPosition, DiagramConstants.SelectionHitTestRadius).Where(Function(i) TypeOf i Is IConnection).OrderByDescending(Function(x) x.ZIndex).FirstOrDefault(), IConnection)

        If conectionUnderPoint IsNot Nothing Then
            DirectCast(Me.DiagramElement, IGraphInternal).PublishDiagramEvent(DiagramEvent.ConnectionClicked, New GenericEventArgs(Of IConnection)(conectionUnderPoint, e))
        End If

        Dim mi = Me.DiagramElement.GetType().GetMethod("UpdateFocusedElement", System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic)
        mi.Invoke(Me.DiagramElement, Nothing)

        Return False
    End Function
End Class

Change like this:
RadDiagram1.DiagramElement.InputBehavior = New MyInputBehaviour(RadDiagram1.DiagramElement)
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)