Skip to content

Commit

Permalink
use MoveObjectTo() when adding curve control object
Browse files Browse the repository at this point in the history
  • Loading branch information
MikiraSora committed Oct 29, 2024
1 parent c4df6ec commit e341611
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ public void Drop(FumenVisualEditorViewModel editor, Point dragEndPoint)
if (!editor.CheckAndNotifyIfPlaceBeyondDuration(dragEndPoint))
return;

var dragTGrid = TGridCalculator.ConvertYToTGrid_DesignMode(dragEndPoint.Y, editor);
var dragXGrid = XGridCalculator.ConvertXToXGrid(dragEndPoint.X, editor);
var isFirst = true;

editor.UndoRedoManager.ExecuteAction(LambdaUndoAction.Create(Resources.AddCurveControlPoint, () =>
{
cachePathControl.TGrid = dragTGrid;
cachePathControl.XGrid = dragXGrid;
curveObject.AddControlObject(cachePathControl);
editor.MoveObjectTo(cachePathControl, dragEndPoint);
if (isFirst)
{
editor.NotifyObjectClicked(cachePathControl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,15 +886,12 @@ private void ProcessAsAddCurve(ConnectableChildObjectBase child, Point position)
return;

var curvePoint = new LaneCurvePathControlObject();
var dragTGrid = TGridCalculator.ConvertYToTGrid_DesignMode(position.Y, this);
var dragXGrid = XGridCalculator.ConvertXToXGrid(position.X, this);
var isFirst = true;

UndoRedoManager.ExecuteAction(LambdaUndoAction.Create(Resources.AddCurveControlPoint, () =>
{
curvePoint.TGrid = dragTGrid;
curvePoint.XGrid = dragXGrid;
child.AddControlObject(curvePoint);
MoveObjectTo(curvePoint, position);
if (isFirst)
{
NotifyObjectClicked(curvePoint);
Expand Down

0 comments on commit e341611

Please sign in to comment.