public override void MouseUp (MouseEvent ev) { if (_handle != null) { _handle.InvokeEnd(ev); UpdateUndoActivity(); PushUndoActivity(); } }
public override void MouseDown(MouseEvent ev) { var view = ev.View; View = view; Gdk.EventType type = ev.GdkEvent.Type; SetAnchorCoords (ev.X, ev.Y); if (type != EventType.TwoButtonPress) { DefaultTool.MouseDown (ev); return; } // Split the line the mouse position var connection = (PolyLineFigure) Figure; connection.SplitSegment (ev.X, ev.Y); // Re-add the connector to the selection view.ClearSelection (); view.AddToSelection (Figure); // Change cursor for dragging handle = (PolyLineHandle) view.FindHandle (ev.X, ev.Y); ((Gtk.Widget) view).GdkWindow.Cursor = handle.CreateCursor (); handle.InvokeStart (ev.X, ev.Y, ev.View); // add new undo activity CreateUndoActivity(); }
public override void OnHtmlInputEvent(string href, MouseEvent e) { if (e == MouseEvent.Click) { if (href.Substring(0, 6) == "skill=" || href.Substring(0, 9) == "skillbtn=") { int skillIndex; if (!int.TryParse(href.Substring(href.IndexOf('=') + 1), out skillIndex)) return; m_World.Interaction.UseSkill(skillIndex); } else if (href.Substring(0, 10) == "skilllock=") { int skillIndex; if (!int.TryParse(href.Substring(10), out skillIndex)) return; m_World.Interaction.ChangeSkillLock(PlayerState.Skills.SkillEntryByIndex(skillIndex)); } } else if (e == MouseEvent.DragBegin) { if (href.Length >= 9 && href.Substring(0, 9) == "skillbtn=") { int skillIndex; if (!int.TryParse(href.Substring(9), out skillIndex)) return; SkillEntry skill = PlayerState.Skills.SkillEntryByIndex(skillIndex); InputManager input = ServiceRegistry.GetService<InputManager>(); UseSkillButtonGump gump = new UseSkillButtonGump(skill); UserInterface.AddControl(gump, input.MousePosition.X - 60, input.MousePosition.Y - 20); UserInterface.AttemptDragControl(gump, input.MousePosition, true); } } }
public override bool HandleMouse(MouseEvent MouseEvent) { base.HandleMouse(MouseEvent); if (MouseEvent.LB) { SaveConfig(); return true; } else if (MouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, MouseEvent)) { if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel >= 0) SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel); else if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel < 0) SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(0); SaveConfig(); return true; } else if (MouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, MouseEvent)) { if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel < SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues) SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel); else if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel >= SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues) SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues - 1); SaveConfig(); return true; } else if (MouseEvent.RB) { //CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); return false; } return true; }
void MouseClickListener.OnMouseClick(MouseEvent me) { if (me.button == MouseEvent.MOUSE_BUTTON_3 && selected) { HUD h = HUD.GetInstance(); MouseState ms = Mouse.GetState(); if (h != null) { if (h.draw) { Rectangle mr = new Rectangle(ms.X, ms.Y, 1, 1); if (!h.DefineRectangle().Contains(mr)) { this.setWaypoint(ms.X, ms.Y); } } } else { this.setWaypoint(ms.X, ms.Y); } } }
public void Update() { // Determine the current mouse state. var currentMouseState = new MouseButtonState(); // Project the screen location of the mouse to world coordinates var mouseEvent = new MouseEvent(); var mousePosition2d = new Vector2(Input.mousePosition.x, Input.mousePosition.y); mouseEvent.GlobalCoordinates = ScreenToGlobal(mousePosition2d); mouseEvent.ScreenCoordinates = mousePosition2d; for(int ii = 0; ii < 3; ii++) { var curButtonState = currentMouseState.Buttons[ii]; if (previousMouseState != null) { var prevButtonState = this.previousMouseState.Buttons[ii]; mouseEvent.MouseButton = (MouseButton)ii; if (curButtonState == ButtonState.Pressed && prevButtonState == ButtonState.Released) { this.mouseHandler.MousePressed(mouseEvent); } if (curButtonState == ButtonState.Released && prevButtonState == ButtonState.Pressed) { this.mouseHandler.MouseReleased(mouseEvent); this.mouseHandler.MouseClicked(mouseEvent); } } } previousMouseState = currentMouseState; }
public override void MouseDrag (MouseEvent ev) { DrawSelectionRect ((Gtk.Widget) ev.View, ev.GdkEvent.Window); PointD anchor = new PointD (AnchorX, AnchorY); PointD corner = new PointD (ev.X, ev.Y); _selectionRect = new RectangleD (anchor, corner); DrawSelectionRect ((Gtk.Widget) ev.View, ev.GdkEvent.Window); }
private void onMarsPress(MouseEvent e) { _mars.Height = 1; _mars.ScaleX = _mars.ScaleY; //mars is bottom-left registered, so put it at 5, 5 rather than 5.5, 5.5 _mars.SetPosition(5, 5); }
public override void MouseDown (MouseEvent ev) { base.MouseDown (ev); IDrawingView view = ev.View; if(IsRightButtonPressed (ev)) { DelegateTool = new PanTool(Editor, CursorFactory.GetCursorFromType(Gdk.CursorType.Arrow)); } else { IHandle handle = view.FindHandle (ev.X, ev.Y); if (handle != null) { DelegateTool = new HandleTracker (Editor, new UndoableHandle(handle)); } else { IFigure figure = view.Drawing.FindFigure (ev.X, ev.Y); if (figure != null) { DelegateTool = figure.CreateFigureTool (Editor, new DragTool (Editor, figure)); } else { DelegateTool = new SelectAreaTool (Editor); } } } if (DelegateTool != null) { DelegateTool.MouseDown (ev); } }
public void OnMouseClick(MouseEvent m_event) { foreach (ParentComponent pc in this.componentList) { pc.RequestFocusAt(m_event.location); } }
public MouseEventArgs(MouseButton button, Point old, Point @new, MouseEvent @event) { PressedButtons = button; OldPosition = old; NewPosition = @new; FiringEvent = @event; }
public void Show(MouseEvent evt, params object[] objects) { var ui = InvertApplication.Container.Resolve<ContextMenuUI>(); Signal<IContextMenuQuery>(_ => _.QueryContextMenu(ui, evt, objects)); ui.Go(); }
public override void MouseDown(MouseEvent ev) { IDrawingView view = ev.View; SetAnchorCoords (ev.X, ev.Y); View = view; Gdk.EventType type = ev.GdkEvent.Type; if (type == EventType.TwoButtonPress) { CreateUndoActivity(); _showingWidget = true; _textview.Buffer.Text = ((MultiLineTextFigure)Figure).Text; View.AddWidget(_textview, 0, 0); CalculateTextViewSize(); _textview.Show(); _textview.GrabFocus(); //selects all _textview.Buffer.SelectRange(_textview.Buffer.StartIter, _textview.Buffer.EndIter); return; } DefaultTool.MouseDown (ev); }
public MouseEventArgs(int x, int y, int wheelDelta, MouseEvent mouseEvent) { X = x; Y = y; WheelDelta = wheelDelta; MouseEvent = mouseEvent; }
private void MoveCardToTop(MouseEvent e) { var targetCard = (CinchSprite)e.Target; //adding something that has already been added will just float it to the top _cardsContainer.AddChild(targetCard); }
public override bool HandleMouse(MouseEvent MouseEvent) { base.HandleMouse(MouseEvent); if (MouseEvent.LB && IsMouseOver(MouseEvent)) { if (Buttons[htButtons(ButtonOptionsGame)].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsGame); if (Buttons[htButtons(ButtonOptionsSound)].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsSound); if (Buttons[htButtons(ButtonOptionsRecord)].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsRecord); if (Buttons[htButtons(ButtonOptionsVideo)].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsVideo); if (Buttons[htButtons(ButtonOptionsLyrics)].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); if (Buttons[htButtons(ButtonOptionsTheme)].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsTheme); } if (MouseEvent.RB) { CGraphics.FadeTo(EScreens.ScreenMain); } return true; }
private void onCardPress(MouseEvent e) { var me = (MouseEvent)e; var target = (CinchSprite)me.Target; _container.AddChild(target); target.StartDrag(); }
private void AddToSmartCherry(MouseEvent e) { CinchSprite target = (CinchSprite)e.Target; _smartCherry.AddChild(target); //and let's make them half-transparent target.Alpha = .5f; }
private void OnCardRelease(MouseEvent e) { var card = (CinchSprite)e.Target; card.StopDrag(); new Tween(card, "ScaleX", 1f, .35f, Easing.Cubic.EaseOut); new Tween(card, "ScaleY", 1f, .35f, Easing.Cubic.EaseOut); }
public InputStruct(MouseEvent mouseEvent) { this.Type=0; // INPUT_MOUSE this.Union=new InputUnion(); this.Union.Mouse.Flags=mouseEvent; //this.Union.mi.dx un dy neietekmē nospiešanas pozīciju, tāpēc netiek aizpildīti. this.Union.Mouse.Time=0; this.Union.Mouse.ExtraInfo=IntPtr.Zero; }
private void onMouseMove(MouseEvent e) { if (e.LocalPos != e.StagePos) Debug.Log ("MouseEvent: LocalPos and StagePos dont match, but should"); if (e.LocalPos != new Vector2(MouseX, MouseY)) Debug.Log ("MouseEvent: LocalPos and MouseX/Y dont match, but should"); }
public override void InvokeStep(MouseEvent ev) { RectangleD r = Owner.DisplayBox; PointD new_location = new PointD (Math.Min (r.X + r.Width, ev.X), r.Y); PointD new_corner = new PointD (r.X + r.Width, Math.Max (r.Y, ev.Y)); Owner.DisplayBox = new RectangleD (new_location, new_corner); }
public override void MouseUp (MouseEvent ev) { IDrawingView view = ev.View; Gdk.EventButton gdk_event = ev.GdkEvent as EventButton; DrawSelectionRect ((Gtk.Widget) view, gdk_event.Window); bool shift_pressed = (gdk_event.State & ModifierType.ShiftMask) != 0; SelectFiguresOnRect (view, shift_pressed); }
public override void MouseDrag (MouseEvent ev) { RectangleD r = Prototype.DisplayBox; r.X = ev.X; r.Y = ev.Y; Prototype.DisplayBox = r; }
public override void MouseDown(MouseEvent ev) { if (!Editor.View.IsFigureSelected (figure)) Editor.View.ClearSelection (); Editor.View.AddToSelection (figure); Editor.DisplayMenu (figure, ev); }
private void Play(MouseEvent e) { _gameplayContainer.Clock.Paused = false; _pause.Visible = true; _play.Visible = false; new Tween(_pause, "ScaleX", 1.5f, .3f, Easing.Cubic.EaseOut).ContinueTo(1f, .2f, Easing.Cubic.EaseIn); new Tween(_pause, "ScaleY", 1.5f, .3f, Easing.Cubic.EaseOut).ContinueTo(1f, .2f, Easing.Cubic.EaseIn); }
private void onPlayPress(MouseEvent e) { _play.Visible = false; _pause.Visible = true; _pause.ScaleX = _pause.ScaleY = .7f; new Tween(_pause, "ScaleX", 1f, .5f, Easing.None.EaseNone); new Tween(_pause, "ScaleY", 1f, .5f, Easing.None.EaseNone); _joesContainer.Clock.Paused = false; }
public override void MouseDown (MouseEvent ev) { IDrawingView view = ev.View; base.MouseDown (ev); view.Drawing.Add (Prototype); Prototype.MoveTo (ev.X, ev.Y); view.ClearSelection (); view.AddToSelection (Prototype); CreateUndoActivity(); }
private void OnMouseDown(MouseEvent e) { new Tween(_background, "ScaleX", 1.4f, .2f, Easing.Quart.EaseOut).ContinueTo(1f, .2f, Easing.Cubic.EaseIn, .2f); new Tween(_background, "ScaleY", 1.4f, .2f, Easing.Quart.EaseOut).ContinueTo(1f, .2f, Easing.Cubic.EaseIn, .2f); new Tween(_foreground, "ScaleX", 1.4f, .4f, Easing.Circle.EaseOut).ContinueTo(1f, .2f, Easing.Cubic.EaseIn); new Tween(_foreground, "ScaleY", 1.4f, .4f, Easing.Circle.EaseOut).ContinueTo(1f, .2f, Easing.Cubic.EaseIn); new Tween(_text, "ScaleX", 1.2f, .4f, Easing.Circle.EaseOut).ContinueTo(1f, .2f, Easing.Cubic.EaseIn); new Tween(_text, "ScaleY", 1.2f, .4f, Easing.Circle.EaseOut).ContinueTo(1f, .2f, Easing.Cubic.EaseIn); }
private void MouseHandler(MouseEvent obj) { Cursor.Current = Cursors.Hand; if (obj.Type == MouseEvent.EventType.Click) { Log.Debug("Button pressed!"); } }
public virtual void mousePressed(MouseEvent param1MouseEvent) { }
public override void OnMouseMove(MouseEvent e) { base.OnMouseMove(e); }
/// <summary> /// Responds to mouse exited events; does nothing. </summary> /// <param name="e"> the MouseEvent that happened. </param> public virtual void mouseExited(MouseEvent e) { }
static public uint ungetmouse(ref MouseEvent ev) => use_naked_driver?RegularCurses.ungetmouse(ref ev) : CursesLinux.ungetmouse(ref ev);
public override void OnMouseUp(MouseEvent e) { base.OnMouseUp(e); }
/// <summary> /// 滑鼠懸停事件處理函式 /// </summary> /// <param name="mouseEvent">滑鼠事件</param> /// <returns>下一個狀態</returns> public virtual TooltipState OnMouseOver(MouseEvent mouseEvent) { throw new UnexpectedEventException(); }
/// <summary> /// 計時器事件處理函式 /// </summary> /// <param name="mouseEvent">滑鼠事件</param> /// <returns>下一個狀態</returns> public virtual TooltipState OnTimeTicks(MouseEvent mouseEvent) { throw new UnexpectedEventException(); }
public override void InjectMouseReleased(MouseEvent arg, MouseButtonID id) { base.InjectMouseReleased(arg, id); Exit(); }
public override void InjectMouseMove(MouseEvent arg) { base.InjectMouseMove(arg); Exit(); }
private MouseActionRet GetMouseAction(MouseEventArgs e, MouseEvent mouseEvent) { MouseAction action = MouseAction.None; TreeChartPerson person = null; ExtPoint offsets = fModel.GetOffsets(); int aX = e.X - offsets.X; int aY = e.Y - offsets.Y; int num = fModel.Persons.Count; for (int i = 0; i < num; i++) { TreeChartPerson p = fModel.Persons[i]; ExtRect persRt = p.Rect; if (persRt.Contains(aX, aY)) { person = p; if (e.Button == MouseButtons.Left && mouseEvent == MouseEvent.meDown) { action = MouseAction.Select; break; } else if (e.Button == MouseButtons.Right && mouseEvent == MouseEvent.meUp) { action = MouseAction.Properties; break; } else if (mouseEvent == MouseEvent.meMove) { action = MouseAction.Highlight; break; } } ExtRect expRt = TreeChartModel.GetExpanderRect(persRt); if ((e.Button == MouseButtons.Left && mouseEvent == MouseEvent.meUp) && expRt.Contains(aX, aY)) { person = p; action = MouseAction.Expand; break; } expRt = TreeChartModel.GetPersonExpandRect(persRt); if ((e.Button == MouseButtons.Left && mouseEvent == MouseEvent.meUp) && expRt.Contains(aX, aY)) { person = p; action = MouseAction.PersonExpand; break; } ExtRect infoRt = TreeChartModel.GetInfoRect(persRt); if ((e.Button == MouseButtons.Left && mouseEvent == MouseEvent.meUp) && infoRt.Contains(aX, aY)) { person = p; action = MouseAction.Info; break; } } if (action == MouseAction.None && person == null) { if (e.Button == MouseButtons.Right && mouseEvent == MouseEvent.meDown) { action = MouseAction.Drag; } } return(new MouseActionRet(action, person)); }
/// <summary> /// Responds to mouse released events; checks to see if the __deleteRight button /// should be enabled or not. </summary> /// <param name="e"> the MouseEvent that happened. </param> public virtual void mouseReleased(MouseEvent e) { checkDeleteRightButton(); }
public override void OnMouseExit(MouseEvent e) { base.OnMouseExit(e); }
private void OnMouseEvent(AMouseHookEventArgs e) { MouseEvent?.Invoke(this, e); }
static public uint getmouse(out MouseEvent ev) => use_naked_driver?RegularCurses.getmouse(out ev) : CursesLinux.getmouse(out ev);
/// <summary> /// Gets the mouse-wheel motion delta, when handling mouse-wheel events cv::EVENT_MOUSEWHEEL and cv::EVENT_MOUSEHWHEEL. /// /// For regular mice with a scroll-wheel, delta will be a multiple of 120. The value 120 corresponds to /// a one notch rotation of the wheel or the threshold for action to be taken and one such action should /// occur for each delta.Some high-precision mice with higher-resolution freely-rotating wheels may /// generate smaller values. /// /// For cv::EVENT_MOUSEWHEEL positive and negative values mean forward and backward scrolling, /// respectively.For cv::EVENT_MOUSEHWHEEL, where available, positive and negative values mean right and /// left scrolling, respectively. /// </summary> /// <param name="flags">The mouse callback flags parameter.</param> /// <returns></returns> public static int GetMouseWheelDelta(MouseEvent flags) { return(NativeMethods.highgui_getMouseWheelDelta((int)flags)); }
public extern static uint ungetmouse(ref MouseEvent ev);
bool Mouse_MousePressed(MouseEvent arg, MouseButtonID id) { UIManager.Instance.InjectMouseDown(arg, id); return(true); }
public override void OnDrag(MouseEvent e) { base.OnDrag(e); }
public void Receive(MouseEvent @event) { Console.WriteLine(@event.Key); }
bool Mouse_MouseReleased(MouseEvent arg, MouseButtonID id) { UIManager.Instance.InjectMouseUp(arg, id); return(true); }
public extern static uint getmouse(out MouseEvent ev);
/// <summary> /// Processes mouse events, which are bubbled /// through the class' routed events, trigger /// certain actions (e.g. show a popup), or /// both. /// </summary> /// <param name="me">Event flag.</param> private void OnMouseEvent(MouseEvent me) { if (IsDisposed) { return; } switch (me) { case MouseEvent.MouseMove: RaiseTrayMouseMoveEvent(); //immediately return - there's nothing left to evaluate return; case MouseEvent.IconRightMouseDown: RaiseTrayRightMouseDownEvent(); break; case MouseEvent.IconLeftMouseDown: RaiseTrayLeftMouseDownEvent(); break; case MouseEvent.IconRightMouseUp: RaiseTrayRightMouseUpEvent(); break; case MouseEvent.IconLeftMouseUp: RaiseTrayLeftMouseUpEvent(); break; case MouseEvent.IconMiddleMouseDown: RaiseTrayMiddleMouseDownEvent(); break; case MouseEvent.IconMiddleMouseUp: RaiseTrayMiddleMouseUpEvent(); break; case MouseEvent.IconDoubleClick: //cancel single click timer singleClickTimer.Change(Timeout.Infinite, Timeout.Infinite); //bubble event RaiseTrayMouseDoubleClickEvent(); break; case MouseEvent.BalloonToolTipClicked: RaiseTrayBalloonTipClickedEvent(); break; default: throw new ArgumentOutOfRangeException("me", "Missing handler for mouse event flag: " + me); } //get mouse coordinates Point cursorPosition = new Point(); if (messageSink.Version == NotifyIconVersion.Vista) { //physical cursor position is supported for Vista and above WinApi.GetPhysicalCursorPos(ref cursorPosition); } else { WinApi.GetCursorPos(ref cursorPosition); } cursorPosition = TrayInfo.GetDeviceCoordinates(cursorPosition); bool isLeftClickCommandInvoked = false; //show popup, if requested if (me.IsMatch(PopupActivation)) { if (me == MouseEvent.IconLeftMouseUp) { //show popup once we are sure it's not a double click singleClickTimerAction = () => { LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this); ShowTrayPopup(cursorPosition); }; singleClickTimer.Change(DoubleClickWaitTime, Timeout.Infinite); isLeftClickCommandInvoked = true; } else { //show popup immediately ShowTrayPopup(cursorPosition); } } //show context menu, if requested if (me.IsMatch(MenuActivation)) { if (me == MouseEvent.IconLeftMouseUp) { //show context menu once we are sure it's not a double click singleClickTimerAction = () => { LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this); ShowContextMenu(cursorPosition); }; singleClickTimer.Change(DoubleClickWaitTime, Timeout.Infinite); isLeftClickCommandInvoked = true; } else { //show context menu immediately ShowContextMenu(cursorPosition); } } //make sure the left click command is invoked on mouse clicks if (me == MouseEvent.IconLeftMouseUp && !isLeftClickCommandInvoked) { //show context menu once we are sure it's not a double click singleClickTimerAction = () => { LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this); }; singleClickTimer.Change(DoubleClickWaitTime, Timeout.Infinite); } }
/// <summary> /// Responds to mouse entered events; does nothing. </summary> /// <param name="e"> the MouseEvent that happened. </param> public virtual void mouseEntered(MouseEvent e) { }
private void mouseCallback(MouseEvent e, int x, int y, MouseEvent args, IntPtr data) { // When the left mouse button is pressed, record its position and save it in ltConor if (e == MouseEvent.LButtonDown) { down = true; conor1.X = Math.Max(0, x); conor1.Y = Math.Max(0, y); } // When the left mouse button is released, record its position and save it in rbConor if (e == MouseEvent.LButtonUp) { up = true; conor2.X = Math.Max(0, Math.Min(x, srcImage.Width - 1)); conor2.Y = Math.Max(0, Math.Min(y, srcImage.Height - 1)); } // Update the box showing the selected region as the user drags the mouse if (down == true && up == false) { conor2.X = Math.Min(x, srcImage.Width - 1); conor2.Y = Math.Min(y, srcImage.Height - 1); srcImage.CopyTo(currentImage); if (conor1.X <= conor2.X && conor1.Y <= conor2.Y) { Cv2.Rectangle(currentImage, conor1, conor2, new Scalar(0, 0, 255), 3); } else if (conor1.X >= conor2.X && conor1.Y >= conor2.Y) { Cv2.Rectangle(currentImage, conor2, conor1, new Scalar(0, 0, 255), 3); } else if (conor1.X >= conor2.X && conor1.Y <= conor2.Y) { Cv2.Rectangle(currentImage, new OpenCvSharp.Point(conor2.X, conor1.Y), new OpenCvSharp.Point(conor1.X, conor2.Y), new Scalar(0, 0, 255), 3); } else { Cv2.Rectangle(currentImage, new OpenCvSharp.Point(conor1.X, conor2.Y), new OpenCvSharp.Point(conor2.X, conor1.Y), new Scalar(0, 0, 255), 3); } CroppingWindow.ShowImage(currentImage); } // Define ROI and crop it out when both corners have been selected // ROI : region of interest if (down == true && up == true) { down = false; up = false; box.Width = Math.Abs(conor1.X - conor2.X); box.Height = Math.Abs(conor1.Y - conor2.Y); box.X = Math.Min(conor1.X, conor2.X); box.Y = Math.Min(conor1.Y, conor2.Y); // region is too small if (box.Width < 20 || box.Height < 20) { CroppingWindow.ShowImage(srcImage); return; } // Make an image out of just the selected ROI and display it in a new window Mat croppedImage = new Mat(srcImage, box); srcImage = croppedImage; baseImage = srcImage.Clone(); CroppingWindow.ShowImage(srcImage); } }
/// <summary> /// Responds to mouse clicked events; does nothing. </summary> /// <param name="e"> the MouseEvent that happened. </param> public virtual void mouseClicked(MouseEvent e) { }
public override void OnMouseEnter(MouseEvent e) { base.OnMouseEnter(e); }
public void Subscribe(MouseEvent evt, MouseHandler handler, string name) { _mouseSubs[evt] = new NamedBind <MouseHandler>(handler, name); }
/// <summary> /// Responds to mouse pressed events; does nothing. </summary> /// <param name="e"> the MouseEvent that happened. </param> public virtual void mousePressed(MouseEvent e) { }
public void ImportMouseMotion(int mx, int my) { if (modalDialog != null) { if (modalDialog.IsIn(mx, my)) { if (modalDialog.isHover) { MouseEvent ev = new MouseEvent(modalDialog, (int)EMouseEventTypes.MOUSE_MOTION, mx, my, OpenTK.Input.MouseButton.Left); modalDialog.ProcessMouseMoved(ev); } else { MouseEvent ev = new MouseEvent(modalDialog, (int)EMouseEventTypes.MOUSE_ENTERED, mx, my, OpenTK.Input.MouseButton.Left); modalDialog.ProcessMouseEntered(ev); } } else { if (modalDialog.isHover) { MouseEvent ev = new MouseEvent(modalDialog, (int)EMouseEventTypes.MOUSE_EXITED, mx, my, OpenTK.Input.MouseButton.Left); modalDialog.ProcessMouseExited(ev); } } } else { if (modelessDialog.Count != 0) { Dialog currentActive = modelessDialog[modelessDialog.Count - 1]; if (currentActive.IsActive()) { if (currentActive.IsIn(mx, my)) { if (currentActive.isHover) { MouseEvent ev = new MouseEvent(currentActive, (int)EMouseEventTypes.MOUSE_MOTION, mx, my, OpenTK.Input.MouseButton.Left); currentActive.ProcessMouseMoved(ev); } else { MouseEvent ev = new MouseEvent(currentActive, (int)EMouseEventTypes.MOUSE_ENTERED, mx, my, OpenTK.Input.MouseButton.Left); currentActive.ProcessMouseEntered(ev); } } else { if (currentActive.isHover) { MouseEvent ev = new MouseEvent(currentActive, (int)EMouseEventTypes.MOUSE_EXITED, mx, my, OpenTK.Input.MouseButton.Left); currentActive.ProcessMouseExited(ev); } } } } } }
public void Subscribe(MouseEvent evt, MouseHandler handler) { Subscribe(evt, handler, null); }