private void DrawHandlesOnGameObject(FPCanvas canvas, FPGameObject gameObject) { RectangleF rect = gameObject.Rect; canvas.DisableTexturing(); canvas.SetCurrentColor(Color.FromArgb(204, Color.White)); canvas.DrawRectangle(rect); canvas.SetPointSize(6.0f); var draggedObject = DraggedObject; bool widthHandles = false; bool heightHandles = false; if (draggedObject != null) { widthHandles = draggedObject.WidthSegments > 0; heightHandles = draggedObject.HeightSegments > 0; } for (FPDragHandle handle = FPDragHandle.TopLeft; handle < FPDragHandle.Center; handle++) { if (!widthHandles && IsWidthHandle(handle)) continue; if (!heightHandles && IsHeightHandle(handle)) continue; if (handle == currentHandle) canvas.SetCurrentColor(Color.FromArgb(204, Color.Red)); else canvas.SetCurrentColor(Color.FromArgb(204, Color.Yellow)); PointF handlePoint = PointFromHandleAroundRect(handle, rect); canvas.DrawPoint(handlePoint); } }
bool RespondsToDragHandle(FPGameObject gameObject, FPDragHandle dragHandle) { bool respondsToWidth = gameObject.WidthSegments > 0; bool respondsToHeight = gameObject.HeightSegments > 0; if (!respondsToWidth && IsWidthHandle(dragHandle)) return false; if (!respondsToHeight && IsHeightHandle(dragHandle)) return false; return true; }
private void AddNewGameObject(FPGameObject gameObject) { BeforeAction("Add New Object"); gameObjects.Add(gameObject); selectedIndices.Clear(); selectedIndices.Add(gameObjects.Count - 1); if (gameObject.NextPart != null) gameObjects.Add(gameObject.NextPart); }