Hi,
SizeAll cursor(Four headed Sizing Cursor) only appears when we hover the mouse pointer on the sides of RadDiagram shapes .But expectation is , SizeAll Cursor has to enable before the mouse pointer touches the sides of shapes (approximately in 0.5 gap). we would like to show the cursor behavior as like powerPoint.
In powerpoint , we could see SizeAll cursor appears in some distance when we move the mouse pointer closer to the shapes. I have attached screenshot for reference .
We have also tried the solution which is given in previous
post, yet couldn’t find a solution to fix this issue. Can you kindly check and
let us know a appropriate solution.
Note: Need to implement a cursor behavior out of the RadDiagram
Shapes (Distance of 0.5 gap).
Regards,
Jeevitha S.
7 Answers, 1 is accepted
Hello Jeevitha,
To achieve your requirement you can create a custom PointTool and replace the default one. You can override the MouseMove() method of the tool and implement a logic that activates the dragging when the mouse is near the shape. You can check this approach in the attached project. I hope it helps.
Regards,
Martin Ivanov
Progress Telerik

Hi,
We have tired the above approach. And also have added the logic for custom cursor behavior (on RadDiagram), because cursor needs to be enable before some distance(0.5) from shape.
Need assistance on Multi-Select Shape and "NoFill”
Behavior:
1. Multi-Select has been working when select the multiple-shape from far distance. It wasn’t working when try to select the multi-shape with distance of 0.5 from shape. Instead, selected shape was jumped from original position to other position.
2. When creating a Rad Diagram shapes (Rectangle, Circle etc..) with "No fill" [only outline] ,Is it possible to make it selectable only by pin pointing the outline, rather than selecting it inside the shape?. Eventhough, I have tried the approach by setting the Background of the corresponding shape to null. Still, its not working.
Below is the code for reference.
public override bool MouseMove(PointerArgs e)
{
var baseResult = base.MouseMove(e);
var selectionMode = _graph.SelectionMode;
var hitTestService = Graph.ServiceLocator.GetService<IHitTestService>() as HitTestService;
var getItemsNearPoint = hitTestService.GetItemsNearPoint(e.TransformedPoint, 5);
if (getItemsNearPoint.Count() > 0)
{
_graph.Cursor = Cursors.SizeAll;
if (HitItem == null && ToolService.IsMouseDown && selectionMode != SelectionMode.None)
{
foreach (var item in getItemsNearPoint)
{
var inflatedBounds = item.Bounds.InflateRect(30);
if (inflatedBounds.Contains(e.TransformedPoint))
{
if (!item.IsSelected)
{
bool addToExistingSelection = selectionMode != SelectionMode.Single && (ToolService.IsControlDown || selectionMode == SelectionMode.Multiple);
SelectWithGroups(addToExistingSelection, item);
}
bool isDraggingEnabled = SelectionService.SelectedItems.ToList().Any(d => d.IsDraggingEnabled == false) ? false : true;
if (isDraggingEnabled)
{
ToolService.ActivateTool(DraggingTool.ToolName);
return false;
}
return true;
}
}
}
}
else
{
_graph.Cursor = Cursors.Arrow;
}
return baseResult;
}
Regards,
Jeevitha S
Hello Anand,
Thank you for the provided details.
We need more time to check your requirements. We will contact you again tomorrow with further information about your case.
Regards,
Dinko
Progress Telerik

Kindly assist us on No-Fill Behavior.
Hello Anand,
It is good to hear that you managed to implement the multi-select case. As for selecting the shape only by clicking its borders (outline), I've tried setting the Background to null and in this case the selection doesn't work when you click inside the shape. However, the selection will appear if you start dragging the shape. To avoid this you can include some additional logic in the MouseMove override of the custom PointerTool and check if the mouse position is on the outline. If so, add the shape to the selection. Here is an example where you can add this code:
public override bool MouseMove(PointerArgs e)
{
var baseResult = base.MouseMove(e);
var selectionMode = this.graph.SelectionMode;
if (this.HitItem == null && this.ToolService.IsMouseDown && selectionMode != SelectionMode.None)
{
foreach (var shape in this.graph.Shapes)
{
var inflatedBounds = shape.ActualBounds.InflateRect(30);
if (inflatedBounds.Contains(e.TransformedPoint))
{
if (!shape.IsSelected)
{
// add logic here that checks if the e.TransformedPoint is on the borders of the shape.ActualBounds. If so, add call the SelectWithGroups method. Otherwise, don't.
bool addToExistingSelection = selectionMode != SelectionMode.Single && (this.ToolService.IsControlDown || selectionMode == SelectionMode.Multiple);
SelectWithGroups(addToExistingSelection, shape);
}
bool isDraggingEnabled = this.SelectionService.SelectedItems.Any(d => d.IsDraggingEnabled == false) ? false : true;
if (isDraggingEnabled)
{
this.ToolService.ActivateTool(DraggingTool.ToolName);
return false;
}
return true;
}
}
}
return baseResult;
}
Regards,
Martin Ivanov
Progress Telerik

Hi,
I've tired the logic which was mentioned above and in this case e.TransformedPoint value won't be the same as shape.ActualBounds at any point. So, I can't able to achieve No-Fill behavior. Is there any possibilities to accomplish No-Fill Behavior ?
Regards,
Jeevitha S.
Hello Anand,
There is no built-in mechanism that allows the desired effect. To achieve it you will need a custom solution as the one mentioned in my previous reply for example.
As for the ActualBounds and the TransformedPoint, I've tested this on my side and it works as expected. When I start dragging an unselected shape, the shape.ActualBounds contains the e.TransformedPoint.
Note that the ActualBounds is a Rect object and the TransformedPoint is a Point, which means that you cannot compare them. Instead, you can implement an algorithm that checks if the TransformedPoint is close to, or on, the borders of the ActualBounds. I've updated my last project to show a possible approach. I hope this helps.
Regards,
Martin Ivanov
Progress Telerik