public override void Update() { Vector3 mousePos = Input.mousePosition; int subKey = InputHelper.GetSubKey(); Vector2 prev, next; prev = new Vector2(mPrevMousePos.x, mPrevMousePos.y); next = new Vector2(mousePos.x, mousePos.y); Vector2 stdPrev = mHomographyEditor.ConvertPosToUv(prev); Vector2 stdNext = mHomographyEditor.ConvertPosToUv(next); for (int i = 0; i < mCurrFP.Count; i++) { if (mMode == HomographyEditor.ManipulationKind.UV) { mCurrFP [i].UV = mPrevFP [i].UV + (stdNext - stdPrev); } else { mCurrFP [i].Vertex = mPrevFP [i].Vertex + (stdNext - stdPrev); } } if (!Input.GetMouseButton(0)) { Controller.RemoveManipulation(); } }
public override void Update() { Vector3 mousePos = Input.mousePosition; int subKey = InputHelper.GetSubKey(); Vector2 prev, next; prev = new Vector2(mPrevMousePos.x, mPrevMousePos.y); next = new Vector2(mousePos.x, mousePos.y); Rect rect = new Rect(prev, next - prev); { Vector2 stdPrev = mHomographyEditor.ConvertPosToUv(prev); Vector2 stdNext = mHomographyEditor.ConvertPosToUv(next); Rect stdRect = new Rect(stdPrev, stdNext - stdPrev); mDraw.MouseRect = stdRect; } List <FragmentPoint> selectingList = Select(rect); string oprName = "A"; if (subKey == (int)InputHelper.SubKey.Shift) { oprName = "A+B"; } if (subKey == (int)InputHelper.SubKey.Command) { oprName = "A^B"; } List <FragmentPoint> selectedList = mHomographyEditor.SelectedPointList; selectedList.RemoveRange(0, selectedList.Count); selectedList.AddRange(SelectHelper <FragmentPoint> .IntegrateAAndB(oprName, selectingList, mSelectedList)); if (!Input.GetMouseButton(0)) { Controller.RemoveManipulation(); } }
public override void Update() { HomographyFragment hf = mHomographyEditor.CreateFragment().GetComponent <HomographyFragment> (); Vector3 mousePos = Input.mousePosition; Vector2 stdPos = mHomographyEditor.ConvertPosToUv(new Vector2(mousePos.x, mousePos.y)); FragmentVertex fv = new FragmentVertex(stdPos); hf.FragmentVertices.Add(fv); List <FragmentPoint> selectedList = mHomographyEditor.SelectedPointList; selectedList.RemoveRange(0, selectedList.Count); selectedList.Add(fv); mHomographyEditor.ManipulationMode = mHomographyEditor.EditTarget | HomographyEditor.ManipulationKind.Add; Controller.ReplaceManipulation(new MoveVertex()); }
public override void Update() { bool isFinishedAdd = false; HomographyFragment hf; int index; List <FragmentPoint> selectedList = mHomographyEditor.SelectedPointList; if (selectedList.Count == 1) { if (selectedList [0] is FragmentVertex) { if (FindFragmentVertex(selectedList [0] as FragmentVertex, out hf, out index)) { Vector3 mousePos = Input.mousePosition; Vector2 stdPos = mHomographyEditor.ConvertPosToUv(new Vector2(mousePos.x, mousePos.y)); FragmentVertex fv = new FragmentVertex(stdPos); hf.FragmentVertices.Insert(index + 1, fv); selectedList.RemoveRange(0, selectedList.Count); selectedList.Add(fv); isFinishedAdd = true; } } } if (isFinishedAdd) { Controller.ReplaceManipulation(new MoveVertex()); } else { Controller.RemoveManipulation(); } }