/// <summary> /// Nastaví dané souřadnice do Owner prvku. Pokud to prvek umožňuje, předá i další informace. /// </summary> /// <param name="e"></param> /// <param name="boundsTarget"></param> private void _DragOwnerCall(GDragActionArgs e, Rectangle boundsTarget) { if (!this._DragOwnerBoundsOriginal.HasValue) { return; } Rectangle boundsOriginal = this._DragOwnerBoundsOriginal.Value; // Souřadnice výchozí, před začátkem procesu Resize Rectangle boundsCurrent = this._InteractiveOwner.Bounds; // Souřadnice nynější, před jejich změnou aktuálním krokem Resize DragActionType action = e.DragAction; if (this._IResizeObject != null) { // a) varianta přes interface IResizeObject a jeho metodu SetBoundsResized(): RectangleSide side = RectangleSide.None; // Najdeme reálné strany, kde došlo ke změně souřadnice proti původní souřadnici: // (ono při pohybu myši NAHORU na LEVÉ straně sice máme pohyb, ale nemáme změnu Bounds) // (a dále při povolení UpsideDown můžeme sice pohybovat PRAVÝM resizerem doleva, ale nakonec měníme LEFT i RIGHT souřadnici) side = (boundsOriginal.Left != boundsTarget.Left ? RectangleSide.Left : RectangleSide.None) | (boundsOriginal.Top != boundsTarget.Top ? RectangleSide.Top : RectangleSide.None) | (boundsOriginal.Right != boundsTarget.Right ? RectangleSide.Right : RectangleSide.None) | (boundsOriginal.Bottom != boundsTarget.Bottom ? RectangleSide.Bottom : RectangleSide.None); if (side != RectangleSide.None || action == DragActionType.DragThisCancel) { ResizeObjectArgs args = new ResizeObjectArgs(e, boundsOriginal, boundsCurrent, boundsTarget, side); this._IResizeObject.SetBoundsResized(args); } } else if (boundsTarget != boundsCurrent || action == DragActionType.DragThisCancel) { // b) varianta s prostým setováním Bounds do prvku (tehdy, když prvek nemá interface IResizeObject): this._InteractiveOwner.Bounds = boundsTarget; ((IInteractiveItem)this._InteractiveOwner).Parent.Repaint(); } }
public override void StartDragging(DragActionType actionType, int hoveredPart, EditorSceneBase scene) { if (Selected) { scene.StartTransformAction(new LocalOrientation(GlobalPosition, Framework.Mat3FromEulerAnglesDeg(Rotation)), actionType); } }
public override void StartDragging(DragActionType actionType, int hoveredPart, EditorSceneBase scene) { if (Selected) { scene.StartTransformAction(new LocalOrientation(GlobalPosition, GlobalRotation), actionType); } }
public void StartTransformAction(LocalOrientation localOrientation, DragActionType dragActionType, int part = -1, IRevertable revertable = null) { AbstractTransformAction transformAction; Vector3 pivot; draggingDepth = control.PickingDepth; if (part != -1) { pivot = localOrientation.Origin; } else { BoundingBox box = BoundingBox.Default; foreach (IEditableObject obj in GetObjects()) { obj.GetSelectionBox(ref box); } pivot = box.GetCenter(); if (box == BoundingBox.Default) { return; } } switch (dragActionType) { case DragActionType.TRANSLATE: transformAction = new TranslateAction(control, control.GetMousePos(), pivot, draggingDepth); break; case DragActionType.ROTATE: transformAction = new RotateAction(control, control.GetMousePos(), pivot, draggingDepth); break; case DragActionType.SCALE: transformAction = new ScaleAction(control, control.GetMousePos(), pivot); break; case DragActionType.SCALE_INDIVIDUAL: transformAction = new ScaleActionIndividual(control, control.GetMousePos(), localOrientation); break; default: return; } StartTransformAction(transformAction, part, revertable); }
public override void StartDragging(DragActionType actionType, int hoveredPart, EditorSceneBase scene) { // if (!WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftCtrl)) // DeselectAll(scene.GL_Control); foreach (RenderablePathPoint point in PathPoints) { int span = point.GetPickableSpan(); if (hoveredPart >= 0 && hoveredPart < span || point.IsSelected()) { point.StartDragging(actionType, hoveredPart, scene); } hoveredPart -= span; } }
public override void StartDragging(DragActionType actionType, int hoveredPart, EditorSceneBase scene) { if (PickingSelection == PickingMode.Mesh) { foreach (GenericPickableMesh mesh in PickableMeshes) { int span = mesh.GetPickableSpan(); if (hoveredPart >= 0 && hoveredPart < span || mesh.IsSelected()) { mesh.StartDragging(actionType, hoveredPart, scene); } hoveredPart -= span; } } else { base.StartDragging(actionType, hoveredPart, scene); } }
public virtual void StartDragging(DragActionType actionType, int hoveredPart, EditorSceneBase scene) { }
public override bool TryStartDragging(DragActionType actionType, int hoveredPart, out LocalOrientation localOrientation, out bool dragExclusively) { localOrientation = new LocalOrientation(position); dragExclusively = false; return(Selected); }