private void CreateRotationHandleForPositionedObject(PositionedObject posObj) { float size = 10; Circle circ = new Circle(); circ.Radius = size / SpriteManager.Camera.PixelsPerUnitAt(posObj.Z); circ.Position = new Vector3(posObj.X, posObj.Y + 2, posObj.Z); circ.Color = Color.LightBlue; Handle handle = new Handle(Layer, circ); circ.AttachTo(posObj, true); }
public bool IsMouseOnHandle() { foreach (Handle h in mHandles) { if (h.IsMouseOver()) { mSelectedHandle = h; mOppositeHandle = mHandles[(mHandles.IndexOf(h) + 4) % 8]; return true; } } return false; }
private Circle AddHandle(float x, float y, float z, float size, float ScaleXCoef, float ScaleYCoef) { Circle circ = new Circle(); circ.Radius = size / SpriteManager.Camera.PixelsPerUnitAt(z); circ.Position = new Vector3(x, y, z); circ.Color = Color.LightBlue; circ.AttachTo((PositionedObject)mCurrentElement, true); Handle handle = new Handle(Layer, circ); handle.ScaleXCoefficient = ScaleXCoef; handle.ScaleYCoefficient = ScaleYCoef; handle.HandleSize = mHandleSize; //Add the handle to the lists mHandles.Add(handle); return circ; }
public void UpdateHighlights() { int handleID = -1; if (mSelectedHandle != null) { handleID = mHandles.IndexOf(mSelectedHandle); } CurrentElement = mCurrentElement; if (handleID != -1) { mSelectedHandle = mHandles.ElementAt(handleID); } }
public override void RemoveHighlights() { mSelectedHandle = null; foreach(Handle h in mHandles) { h.RemoveFromShapeManager(); } mHandles.Clear(); base.RemoveHighlights(); }