public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); Vector3 spaceCoord = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z)); float lastAngle = MathF.Angle(selectionCenter.X, selectionCenter.Y, lastLocSpace.X, lastLocSpace.Y); float curAngle = MathF.Angle(selectionCenter.X, selectionCenter.Y, spaceCoord.X, spaceCoord.Y); float rotation = curAngle - lastAngle; state.RotateSelectionBy(rotation); state.ActionLastLocSpace = spaceCoord; }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); float zMovement = state.CameraObj.Transform.Pos.Z - lastLocSpace.Z; Vector3 target = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z + zMovement)); Vector3 movLock = beginLocSpace - lastLocSpace; Vector3 mov = target - lastLocSpace; mov.Z = zMovement; target.Z = 0; if (lockedAxis == CamViewState.LockedAxis.X) { mov = new Vector3(mov.X, 0, 0); } else if (lockedAxis == CamViewState.LockedAxis.Y) { mov = new Vector3(0, mov.Y, 0); } else { mov = state.ApplyAxisLock(mov, movLock, target + (Vector3.UnitZ * state.CameraObj.Transform.Pos.Z) - beginLocSpace); } state.MoveSelectionBy(mov); state.ActionLastLocSpace += mov; }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { if (DualityEditorApp.IsSelectionChanging) { return; // Prevent Recursion in case SelectObjects triggers UpdateAction. } bool shift = (Control.ModifierKeys & Keys.Shift) != Keys.None; bool ctrl = (Control.ModifierKeys & Keys.Control) != Keys.None; // Determine picked rect int pX = Math.Max(Math.Min(mouseLoc.X, beginLoc.X), 0); int pY = Math.Max(Math.Min(mouseLoc.Y, beginLoc.Y), 0); int pX2 = Math.Max(mouseLoc.X, beginLoc.X); int pY2 = Math.Max(mouseLoc.Y, beginLoc.Y); int pW = Math.Max(pX2 - pX, 1); int pH = Math.Max(pY2 - pY, 1); // Check which renderers are picked List <CamViewState.SelObj> picked = state.PickSelObjIn(pX, pY, pW, pH); // Store in internal rect selection ObjectSelection oldRectSel = state.ActiveRectSel; state.ActiveRectSel = new ObjectSelection(picked); // Apply internal selection to actual editor selection if (shift || ctrl) { if (state.ActiveRectSel.ObjectCount > 0) { ObjectSelection added = (state.ActiveRectSel - oldRectSel) + (oldRectSel - state.ActiveRectSel); state.SelectObjects(added.OfType <CamViewState.SelObj>(), shift ? SelectMode.Append : SelectMode.Toggle); } } else if (state.ActiveRectSel.ObjectCount > 0) { state.SelectObjects(state.ActiveRectSel.OfType <CamViewState.SelObj>()); } else { state.ClearSelection(); } state.Invalidate(); }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.InvalidateSelectionStats(); }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); if (selectionRadius == 0.0f) { return; } Vector3 spaceCoord = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z)); float lastRadius = selectionRadius; float curRadius = (selectionCenter - spaceCoord).Length; float scale = MathF.Clamp(curRadius / lastRadius, 0.0001f, 10000.0f); state.ScaleSelectionBy(scale); state.ActionLastLocSpace = spaceCoord; state.Invalidate(); }