This is a migrated thread and some comments may be shown as answers.

Rad Diagram shapes Cursor behavior

5 Answers 52 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Britt-Marie
Top achievements
Rank 1
Britt-Marie asked on 17 Apr 2019, 09:13 AM

Hi,

Cursor on Rad Diagram shapes is showing when we hover mouse exactly on shapes side. We would like to show cursor before some distance, exactly the same behavior like power point. 

I have attached the screen shot of cursor behavior of Rad Diagram shapes and power point.

 

Regards,

Sunil

5 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 19 Apr 2019, 04:31 PM
Hello Anand,

Your picture shows the mouse cursor when shape is dragged, could you please elaborate a bit more whether you need the drag / selection / mouse over /resize / rotate activation be easier with bigger activation areas or you need only one of these ?

Diagram provides public constants class -  Telerik.Windows.Diagrams.Core.DiagramConstants. You can set:
     
          -- SelectionHitTestRadius
          -- ConnectorActivationRadius
          -- ConnectorHitTestRadius
          -- RotationHitTestRadius

However, there is no mouse over constant and also shapes do not respond to mouse over - please let us know if you have seed this in some of our demos / SDK projects.


Regards,
Petar Mladenov
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.
0
Britt-Marie
Top achievements
Rank 1
answered on 20 Apr 2019, 08:22 PM

Hi Petar,

I am talking about mouse over only. When we over mouse on the edge of Rad Diagram shapes, four-headed sizing cursor appears, but for this we need to over mouse exactly on shapes edge. However in power point four-headed sizing cursor appears before some distance. You can see in screenshot, for first case (Rad diagram shape while hover) when we over mouse on the shape before some distance four-headed sizing cursor didn't appeared where in third case (Power point shape while hover) four-headed sizing cursor appeared before some distance only. We would like to have same behavior for Rad Diagram shapes as it is in power point.

0
Petar Mladenov
Telerik team
answered on 24 Apr 2019, 02:51 PM
Hello Anand,

I am a bit confused since the mentioned Cursor appears on dragging, not when shape is hovered. Could you please confirm you can RadDiagram for WPF in mind ? Can you send us some isolated code we can test on our side ?

Regards,
Petar Mladenov
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.
0
Britt-Marie
Top achievements
Rank 1
answered on 25 Apr 2019, 08:58 AM

Hi Petar,

The mentioned Cursor appears as soon as we takes mouse cursor closer to shapes edge and when the shape is ready to drag. I request you check again the screen shot I attached earlier to understand the scenario for Rad Diagram shape and power point shape.  We are using RadDiagram for WPF. Below is the code for creating shape and setting properties:

.xaml file-

        <telerik:RadDiagram x:Name="Diagram" 
                            Width="Auto"
                            Height="Auto"
                            BorderThickness="0,0,0,1"
                            DockPanel.Dock="Right"
                            Background="{StaticResource ReportView_ScrollViewerBackground}" 
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            IsResizingEnabled="True"
                            IsRotationEnabled="False"
                            IsBackgroundSurfaceVisible="False"
                            IsSnapToItemsEnabled="True"
                            IsSnapToGridEnabled="False"
                            ActiveTool="PointerTool" 
                            SnapX="3"
                            SnapY="3"
                            IsInformationAdornerVisible="False"
                            IsConnectorsManipulationEnabled="True"
                            IsZoomEnabled="True"
                            IsPanEnabled="True"
                            AllowCopy="False"
                            AllowCut="False"
                            AllowDelete="False"
                            AllowPaste="False"
                            ScrollViewer.HorizontalScrollBarVisibility="Visible" 
                            ScrollViewer.VerticalScrollBarVisibility="Visible"                           
                            Zoom="{Binding FreeViewZoomLevel, Mode=TwoWay}"
                            RectSelectionMode="Partial"
                            UseLayoutRounding="False" />

Setting the properties in RadDiagramShape class in constructor-

EntityModel = entityModel;
            Tag = entityModel;
            Content = null;
            Cursor = Cursors.SizeAll;
            Geometry = ShapeFactory.GetShapeGeometry((CommonShapeType)EntityModel.ShapeType);
            MaxHeight = workspace.WorkspaceHeightInPixels;
            MaxWidth = workspace.WorkspaceWidthInPixels;

Here entityModel holds the information about rad diagram shape.

Binding the shape to rad diagram:

 var item = new RadDiagramShape(entity, Container.Workspace);
                    Diagram.Items.Add(item);

Container.Workspace - Holds the information about paper layout.

0
Petar Mladenov
Telerik team
answered on 30 Apr 2019, 07:07 AM
Hi Anand,

I understand your requirement now. It seemed strange initially to me the SizeAll cursor but I can see you set it in code. To be honest this is a custom requirement that cannot be implemented out of the box in RadDiagram. Th main mouse tool in diagram handles Mouse Move / Down / Up and decides which secondary tools or services to activate. The HitTestService in RadDiagram has 'ItemUnderMouse' property which is used in primary mouse tool. Here is the code for it:

/// <summary>
/// Gets the item under the mouse.
/// </summary>
public IDiagramItem ItemUnderMouse
{
    get
    {
        return this.Graph.DiagramItems().FirstOrDefault(x => x.IsMouseOver && x.IsEnabled && x.Visibility == Visibility.Visible);
    }
}

So it mainly uses the IsMouseOver property of the diagram shapes / connections which comes out of the box from WPF framework. Basically to change this behavior you will need to start with custom HistTestService. For more info on how to customize tools and services you can follow these resources:
 
Diagram Tools Customization
Diagram Services Overview
Diagram Custom Services SDK example on GitHub

Regards,
Petar Mladenov
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.
Tags
Diagram
Asked by
Britt-Marie
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Britt-Marie
Top achievements
Rank 1
Share this question
or