void OnDrag(object sender, EventArgs e) { if (InputManager.Mouse.IsOwnerFocused) { //If there is an element if (mCurrentSelectedElementRuntime != null) { if (mCurrentAction == ActionType.Scale) { mScalingHandles.Scale(); } //Move else if (mCurrentAction == ActionType.Move) { //If the element is something else (such as part of an entity) if (mCurrentSelectedElementRuntime.DirectObjectReference != null && mCurrentSelectedElementRuntime.DirectObjectReference is PositionedObject && mCurrentSelectedElementRuntime.ReferencedFileRuntimeList.LoadedScenes.Count == 0 && mCurrentSelectedElementRuntime.ReferencedFileRuntimeList.LoadedShapeCollections.Count == 0) { PositionedObject element = (PositionedObject)mCurrentSelectedElementRuntime.DirectObjectReference; PositionedObject parent = element.Parent; element.Detach(); element.X += GuiManager.Cursor.WorldXChangeAt(0, mLayers[entityControlControls.LayerComboBox.SelectedIndex]); element.Y += GuiManager.Cursor.WorldYChangeAt(0, mLayers[entityControlControls.LayerComboBox.SelectedIndex]); element.AttachTo(parent, true); } //Else, just move the element else { PositionedObject parent = mCurrentSelectedElementRuntime.Parent; mCurrentSelectedElementRuntime.Detach(); mCurrentSelectedElementRuntime.X += GuiManager.Cursor.WorldXChangeAt(0, mLayers[entityControlControls.LayerComboBox.SelectedIndex]); mCurrentSelectedElementRuntime.Y += GuiManager.Cursor.WorldYChangeAt(0, mLayers[entityControlControls.LayerComboBox.SelectedIndex]); mCurrentSelectedElementRuntime.AttachTo(parent, true); } } //Rotate else if (mCurrentAction == ActionType.Rotate) { } } } }