/// <inheritdoc cref="IDrawer.OnMouseoverDuringDrag" /> public override void OnMouseoverDuringDrag(MouseDownInfo mouseDownInfo, Object[] dragAndDropObjectReferences) { if (mouseDownInfo.MouseDownOverDrawer == this || mouseDownInfo.MouseDownOverDrawer == null || mouseDownInfo.Reordering.MouseoveredDropTarget.MemberIndex == -1) { DrawGUI.Active.DragAndDropVisualMode = DragAndDropVisualMode.Rejected; } }
/// <inheritdoc /> public sealed override void OnMouseoverDuringDrag(MouseDownInfo mouseDownInfo, Object[] dragAndDropObjectReferences) { if (mouseDownOverSubPart != SliderSubPart.Slider) { DrawGUI.Active.DragAndDropVisualMode = DragAndDropVisualMode.Rejected; return; } OnMouseoverSlider(); }
/// <inheritdoc cref="IDrawer.OnMouseoverDuringDrag" /> public override void OnMouseoverDuringDrag(MouseDownInfo mouseDownInfo, Object[] dragAndDropObjectReferences) { if (mouseDownInfo.MouseDownOverDrawer == this || mouseDownInfo.MouseDownOverDrawer == null || mouseDownInfo.Reordering.MouseoveredDropTarget.MemberIndex == -1) { // Don't reject drag n drop if cursor is over editor body, because it could accept drag n drops (e.g. if it contains Object reference fields). if (HeaderMouseovered) { DrawGUI.Active.DragAndDropVisualMode = DragAndDropVisualMode.Rejected; } } }
/// <inheritdoc cref="IDrawer.OnMouseoverDuringDrag" /> public override void OnMouseoverDuringDrag(MouseDownInfo mouseDownInfo, Object[] dragAndDropObjectReferences) { // Don't reject drag n drop if cursor is over editor body, because it could accept drag n drops (e.g. if it contains Object reference fields). if (HeaderMouseovered) { #if DEV_MODE Debug.LogWarning("OnMouseoverDuringDrag - Rejecting!"); #endif DrawGUI.Active.DragAndDropVisualMode = DragAndDropVisualMode.Rejected; } }
public override void OnMouseoverDuringDrag(MouseDownInfo mouseDownInfo, UnityEngine.Object[] dragAndDropObjectReferences) { if (!mouseDownInfo.CursorMovedAfterMouseDown) { // This is just to replace the ugly drag ignored cursor with something a little bit better // during click events. Unfortunately DragAndDropVisualMode.None didn't seem to work. DrawGUI.Active.DragAndDropVisualMode = DragAndDropVisualMode.Move; GUI.changed = true; return; } base.OnMouseoverDuringDrag(mouseDownInfo, dragAndDropObjectReferences); }
/// <inheritdoc/> public void OnMemberDrag(MouseDownInfo mouseDownInfo, Object[] draggedObjects) { int dragNDropIndex = mouseDownInfo.Reordering.MouseoveredDropTarget.MemberIndex; if (dragNDropIndex >= 0) { var memb = visibleMembers[dragNDropIndex] as IComponentDrawer; if (memb != null) { var reorderDropRect = memb.ReorderDropRect; reorderDropRect.y += Mathf.RoundToInt(reorderDropRect.height * 0.5f) - 1f; reorderDropRect.height = 3f; DrawGUI.Active.DragAndDropVisualMode = DragAndDropVisualMode.Link; GUI.DrawTexture(reorderDropRect, InspectorUtility.Preferences.graphics.ReorderDropTargetBg, ScaleMode.StretchToFill); } } }
/// <inheritdoc cref="IDrawer.OnMouseoverDuringDrag" /> public override void OnMouseoverDuringDrag(MouseDownInfo mouseDownInfo, Object[] dragAndDropObjectReferences) { // Don't set DragAndDropVisualMode to Rejected; we don't know if the drawer accepts them or not }
/// <inheritdoc/> public void OnMemberDragNDrop(MouseDownInfo mouseDownInfo, Object[] draggedObjects) { var reordering = mouseDownInfo.Reordering; int dropIndex = reordering.MouseoveredDropTarget.MemberIndex; if (dropIndex >= 0) { var draggedGameObjectDrawer = reordering.Drawer; //if only raw GameObject references are dragged, e.g. from the hierarchy view if (draggedGameObjectDrawer == null) { var gameObjects = draggedObjects as GameObject[]; if (gameObjects != null) { var inspector = Inspector; #if DEV_MODE && PI_ASSERTATIONS Debug.Assert(reordering.MouseoveredDropTarget.Inspector == inspector); #endif //create a new GameObjectGUIInstrutions to display the dragged GameObjects var gameObjectDrawer = inspector.DrawerProvider.GetForGameObjects(inspector, gameObjects, this); if (gameObjectDrawer != null) { var setMembers = Members; DrawerArrayPool.InsertAt(ref members, dropIndex, gameObjectDrawer, false); SetMembers(setMembers, true); } } } else { var sourceParent = reordering.Parent; int sourceIndex = reordering.MemberIndex; //if reordering GameObjects within the same DrawerGroup (e.g. stacked multi-editing mode) if (sourceParent == this) { if (dropIndex != sourceIndex) { inspector.State.ViewIsLocked = true; var setMembers = Members; DrawerArrayPool.RemoveAt(ref setMembers, sourceIndex, false, false); if (sourceIndex < dropIndex) { dropIndex--; } DrawerArrayPool.InsertAt(ref setMembers, dropIndex, draggedGameObjectDrawer, false); SetMembers(setMembers); } } //if cloning (or moving?) GameObjects from one DrawerGroup to another (e.g. between split views) else { var setMembers = Members; var clone = inspector.DrawerProvider.GetForGameObjects(reordering.MouseoveredDropTarget.Inspector, draggedGameObjectDrawer.GetValues() as GameObject[], this); DrawerArrayPool.InsertAt(ref setMembers, dropIndex, clone, false); SetMembers(setMembers); } } } }
/// <inheritdoc/> public void OnSubjectOverDropTarget(MouseDownInfo mouseDownInfo, Object[] draggedObjects) { }