public override IEventResult OnMouseMove(IMouseEventArgs e) { if (e.IsMiddlePressed) { return(EventResult.Handled); } switch (_step) { case Step.Step1_SpecifyCenter: break; case Step.Step2_SpecityRadiusX: _ellipse.RadiusX = (_ellipse.center - this.Pointer.CurrentSnapPoint).Length; _ellipse.RadiusY = _ellipse.RadiusX; _ellipse.Draw(); break; case Step.Step3_SpecityRadiusY: _ellipse.RadiusY = (_ellipse.center - this.Pointer.CurrentSnapPoint).Length; _ellipse.Draw(); break; } return(EventResult.Handled); }
public override EventResult OnMouseDown(IMouseEventArgs e) { switch (_step) { case Step.Step3_SpecifyPointCenter: if (e.IsLeft) { _center = this.pointer.currentSnapPoint; _step = Step.Step4_SpecifyPointOther; } break; case Step.Step4_SpecifyPointOther: if (e.IsLeft) { _point = this.pointer.currentSnapPoint; this.UpdatePolygon(); _mgr.FinishCurrentCommand(); } break; } return(EventResult.Handled); }
public IEventResult OnMouseDoubleClick(IMouseEventArgs e) { switch (mode) { case PointerModes.Default: if (e.IsLeftPressed) { //if (_anchorMgr.currentGripPoint == null) //{ // //_pickupBox.center = _pos; // //List<Selection> sels = _pickupBox.Select(_drawing.currentBlock); // //if (sels.Count > 0) // //{ // // foreach (Selection sel in sels) // // { // // DBObject dbobj = (_drawing.Document as Document).database.GetObject(sel.objectId); // // if (dbobj != null && dbobj is MediaTypeNames.Text) // // { // // (_drawing.Document as Document).selections.Clear(); // // } // // } // //} //} } break; default: break; } return(null); }
public override IEventResult OnMouseMove(IMouseEventArgs e) { if (e.IsMiddlePressed) { return(EventResult.Handled); } switch (_step) { case Step.Step1_SpecifyCenter: break; case Step.Step2_SpecityStartPoint: _line.endPoint = this.Pointer.CurrentSnapPoint; _line.Draw(); break; case Step.Step3_SpecifyEndPoint: double endAngle = CADVector.SignedAngleInRadian( new CADVector(1, 0), this.Pointer.CurrentSnapPoint - _arc.center); endAngle = MathUtils.NormalizeRadianAngle(endAngle); _arc.endAngle = endAngle; _arc.Draw(); _line.endPoint = this.Pointer.CurrentSnapPoint; _line.Draw(); break; } return(EventResult.Handled); }
protected override void InputOnMouseWheel(object sender, IMouseEventArgs args) { base.InputOnMouseWheel(sender, args); // copy camera reference var cameraInfo = RenderHost.CameraInfo; // default scaling const double scale = 0.15; const double scaleForward = 1.0 + scale; const double scaleBackwards = 2.0 - 1.0 / (1.0 - scale); // calculate how much to zoom var scaleCurrent = args.WheelDelta > 0 /* scroll up => zoom in */ ? scaleForward : scaleBackwards; var eyeVector = cameraInfo.Target - cameraInfo.Position; var offset = eyeVector.ScaleBy(scaleCurrent) - eyeVector; // zoom var position = cameraInfo.Position + offset; var projection = cameraInfo.Projection is ProjectionOrthographic po // if projection is orthographic we need to resize view field ? ProjectionOrthographic.FromDistance(po.NearPlane, po.FarPlane, (cameraInfo.Target - position).Length, cameraInfo.Viewport.AspectRatio) // otherwise just clone existing one : cameraInfo.Projection.Cloned(); // set camera info RenderHost.CameraInfo = new CameraInfo(position, cameraInfo.Target, cameraInfo.UpVector, projection, cameraInfo.Viewport); }
internal void HandleMouseUp(IMouseEventArgs e) { if (_IsDisposed) { return; } Point pos = e.Location; lock (this) { if (_MouseDragEditing) { // mouse button was raised during drag-editing // so move originally selected text to where the cursor is at HandleMouseUp_OnDragEditing(e); } else if (_MouseDragEditDelayTimer != null) { // mouse button was raised before entering drag-editing mode. // just set caret where the cursor is at _MouseDragEditDelayTimer.Dispose(); View.ScreenToVirtual(ref pos); int targetIndex = View.GetIndexFromVirPos(pos); Document.SetSelection(targetIndex, targetIndex); } } ClearDragState(pos); }
public static bool IsDraggedOutside(this IMouseEventArgs e, IObject control) => e.Button == MouseButton.Left && e.State == MouseState.Move && #if AdvancedVersion control.IsMouseDragging&& #endif !control.Bounds.Has(e.X, e.Y);
public override IEventResult OnMouseMove(IMouseEventArgs e) { if (e.IsRightPressed) { return(EventResult.Unhandled); } if (_step == Step.Step1_SelectObjects) { } else if (_step == Step.Step2_SpecifyBasePoint) { } else if (_step == Step.Step3_SpecifySecondPoint) { CADVector preTranslation = translation; _pathLine.endPoint = this.Pointer.CurrentSnapPoint; CADVector offset = translation - preTranslation; foreach (Entity copy in _copys) { copy.Translate(offset); copy.Draw(); } _pathLine.endPoint = this.Pointer.CurrentSnapPoint; _pathLine.Draw(); } return(EventResult.Handled); }
public override IEventResult OnMouseMove(IMouseEventArgs e) { _mousePosInWorld = this.Pointer.CurrentSnapPoint; _entityCopy.SetGripPointAt(_index, _gripPoint, _mousePosInWorld); Draw(); return(EventResult.Handled); }
private static void Window_MouseUp(object sender, IMouseEventArgs e) { if (e.Button == MouseButton.Left) { //timer.Run(!timer.IsRunning); } }
internal void HandleDoubleClick(IMouseEventArgs e) { if (_IsDisposed) { return; } if (e.Location.X < 0 || e.Location.Y < 0) { return; } // remember mouse down screen position and convert it to virtual view's coordinate _MouseDownVirPos = e.Location; // select a word there if it is in the text area if (_View.TextAreaRectangle.Contains(_MouseDownVirPos)) { Point pos = e.Location; View.ScreenToVirtual(ref pos); var clickedIndex = View.GetIndexFromVirPos(pos); _UI.SelectionMode = TextDataType.Words; Document.SetSelection(clickedIndex, clickedIndex, View); } }
private static void Window_MouseUp(object sender, IMouseEventArgs e) { if (e.Button == MouseButton.Left) { //window.Background = Rgba.Aqua; //window.Update(); } }
private void HookManager_MouseWheel(object sender, IMouseEventArgs e) { if (chLockM.Checked) { e.PreventDefault(); } lblWheel.Text = $"Wheel={e.Delta:000}" + GetLockedStr(e.DefaultPrevented); }
private void HookManager_MouseDoubleClick(object sender, IMouseEventArgs e) { if (chLockM.Checked) { e.PreventDefault(); } WriteLog(e.Key.ToString(), e.DefaultPrevented); }
private void HookManager_MouseMove(object sender, IMouseEventArgs e) { if (chLockM.Checked) { e.PreventDefault(); } lblMousePosition.Text = $"x={e.Coords.X:0000}; y={e.Coords.Y:0000}" + GetLockedStr(e.DefaultPrevented); }
public IEventResult OnMouseMove(IMouseEventArgs e) { if (_currentCmd != null) { _currentCmd.OnMouseMove(e); } return(null); }
public override IEventResult OnMouseMove(IMouseEventArgs e) { if (_step == Step.Step3_SpecifyMirrorLinePoint2nd) { endPoint = this.Pointer.CurrentSnapPoint; DrawMirrorLine(); UpdateResultEntities(); } return(EventResult.Handled); }
public IEventResult OnMouseMove(IMouseEventArgs e) { if (e.IsMiddlePressed) { var pnt = new CADPoint(e.X, e.Y); _tempOffsetVector = (m_MiddleBtnPressed_Point - pnt); _tempOffsetVector.Y *= -1; _drawing.Canvas.Redraw(); } return(null); }
public static bool DdcOpen(this IMouseEventArgs e, IDDControl ddc) { if (ddc.DroppedDown) { return(false); } if (e.Up() && e.Left() && !ddc.DroppedDown && ddc.DropDownButton.Has(e.X, e.Y)) { return(true); } return(false); }
protected override void InputOnMouseUp(object sender, IMouseEventArgs args) { base.InputOnMouseUp(sender, args); if (args.Buttons != MouseButtons.Right) { return; } MouseDownCameraInfo = default; MouseDownPlane = default; MouseDownOnPlane = default; }
/// <inheritdoc /> protected override void InputOnMouseMove(object sender, IMouseEventArgs args) { base.InputOnMouseMove(sender, args); if (!MouseDownView.HasValue || MouseDownCameraInfo == null || !OrbitOrigin.HasValue) { return; } var mouseMoveView = RenderHost.CameraInfo.GetTransformationMatrix(Space.Screen, Space.View).Transform(args.Position.ToPoint3D()); RenderHost.CameraInfo = Orbit(MouseDownCameraInfo, mouseMoveView - MouseDownView.Value, OrbitOrigin.Value); }
/// <inheritdoc /> protected override void InputOnMouseUp(object sender, IMouseEventArgs args) { base.InputOnMouseUp(sender, args); if (args.Buttons != MouseButtons.Middle) { return; } MouseDownCameraInfo = default; MouseDownView = default; OrbitOrigin = default; }
/// <inheritdoc /> protected override void InputOnMouseDown(object sender, IMouseEventArgs args) { base.InputOnMouseDown(sender, args); if (args.Buttons != MouseButtons.Middle || args.ClickCount > 1) { return; } MouseDownCameraInfo = RenderHost.CameraInfo.Cloned(); MouseDownView = MouseDownCameraInfo.GetTransformationMatrix(Space.Screen, Space.View).Transform(args.Position.ToPoint3D()); OrbitOrigin = GetOrbitOrigin(MouseDownCameraInfo); }
void HandleMouseUp_OnDragEditing(IMouseEventArgs e) { int targetIndex; Point pos = e.Location; // do nothing if the document is read-only if (Document.IsReadOnly) { Plat.Inst.MessageBeep(); return; } // calculate target position where the selected text is moved to View.ScreenToVirtual(ref pos); targetIndex = View.GetIndexFromVirPos(pos); // move text Document.BeginUndo(); try { int begin, end; // remove current selection Document.GetSelection(out begin, out end); var selText = Document.GetTextInRange(begin, end); Document.Replace(""); if (end <= targetIndex) { targetIndex -= selText.Length; } else if (begin <= targetIndex) { targetIndex = begin; } /*NO_NEED// * else * targetIndex = targetIndex; */ // insert new text Document.Replace(selText, targetIndex, targetIndex); Document.SetSelection(targetIndex, targetIndex + selText.Length); } finally { Document.EndUndo(); } }
protected override void InputOnMouseMove(object sender, IMouseEventArgs args) { base.InputOnMouseMove(sender, args); if (!MouseDownView.HasValue || MouseDownCameraInfo == null || !OrbitOrigin.HasValue) { return; } var cameraInfo = RenderHost.CameraInfo; var mouseMoveView = cameraInfo.GetTransformationMatrix(Space.Screen, Space.View).Transform(args.Position.ToPoint3D()); Orbit(MouseDownCameraInfo, mouseMoveView - MouseDownView.Value, OrbitOrigin.Value, out var cameraPosition, out var cameraTarget); RenderHost.CameraInfo = new CameraInfo(cameraPosition, cameraTarget, cameraInfo.UpVector, cameraInfo.Projection.Cloned(), cameraInfo.Viewport); }
public override EventResult OnMouseMove(IMouseEventArgs e) { if (e.IsMiddle) { return(EventResult.Handled); } if (_step == Step.Step4_SpecifyPointOther) { _point = this.pointer.currentSnapPoint; this.UpdatePolygon(); } return(EventResult.Handled); }
public override IEventResult OnMouseMove(IMouseEventArgs e) { if (e.IsMiddlePressed) { return(EventResult.Handled); } if (_circle != null) { _circle.radius = (_circle.center - this.Pointer.CurrentSnapPoint).Length; _circle.Draw(); } return(EventResult.Handled); }
public override IEventResult OnMouseMove(IMouseEventArgs e) { if (e.IsMiddlePressed) { return(EventResult.Handled); } if (_currLine != null) { _currLine.endPoint = this.Pointer.CurrentSnapPoint; _currLine.Draw(); } return(EventResult.Handled); }
public override IEventResult OnMouseMove(IMouseEventArgs e) { if (e.IsMiddlePressed) { return(EventResult.Handled); } if (_step == Step.Step2_SpecifyPoint2nd) { _point2nd = this.Pointer.CurrentSnapPoint; this.UpdateRectangle(); _rectangle.Draw(); } return(EventResult.Handled); }
public IEventResult OnMouseMove(IMouseEventArgs e) { _pos.X = e.X; _pos.Y = e.Y; _loc = _drawing.CanvasToModel(_pos); switch (mode) { case PointerModes.Default: if (SelRect.Active) { SelRect.EndPoint = _pos; } else { CurrentSnapPoint = _anchorMgr.Snap(_pos); _loc = CurrentSnapPoint; } break; case PointerModes.Select: if (SelRect.Active) { SelRect.EndPoint = _pos; } else { _loc = _drawing.CanvasToModel(_pos); } break; case PointerModes.Locate: CurrentSnapPoint = _snapNodesMgr.Snap(_pos); _loc = CurrentSnapPoint; _snapNodesMgr.OnMouseMove(e); break; case PointerModes.Drag: break; default: break; } Draw(); return(null); }