I did a simple and small change on TSimpleGraph.MouseUp event in order to allow create elements with one click. I hope this could be interesting to someone.
In the code below, "50" could be replaced by a "default size" property.
Best regards,
Guilherme Vaccaro.
- Code: Select all
...
else if CommandMode = cmInsertNode then
begin
{ Start - Modified by Vaccaro - 10-07-2005 }
{
if (Button = mbLeft) and not (ssDouble in Shift) and
not IsRectEmpty(SelectionRect)
then
InsertNode(@SelectionRect);
}
if (Button = mbLeft) and not (ssDouble in Shift) then
begin
if IsRectEmpty(SelectionRect) then
begin
if SnapToGrid and not (ssCtrl in Shift) then
StopPoint := Point((StartPoint.X + 50) div GridSize * GridSize, (StartPoint.Y + 50) div GridSize * GridSize)
else
StopPoint := Point(StartPoint.X + 50, StartPoint.Y + 50);
SelectionRect := MakeRect(StartPoint, StopPoint);
end;
InsertNode(@SelectionRect);
end;
{ Stop - Modified by Vaccaro - 10-07-2005 }
CommandMode := cmEdit;
if ssShift in Shift then
CommandMode := cmInsertNode;
end
....