public override void OnMouseEvent(MouseEvent mouseEvent) { TPoint currentOffset = mouseEvent.Info.position - mouseEvent.PreviousPosition; switch ( mouseEvent.State ) { case MouseEvent.EventState.Move: { Move(currentOffset, m_controls); m_offset += currentOffset; } break; case MouseEvent.EventState.LUp: { Move(-m_offset,m_controls); m_offset += currentOffset; ICommand command = new MoveControl(m_controls, m_offset); m_commandManager.CurrentCommand = command; m_commandManager.Execute(); m_stateManager.ChangeState( StateType.Idle ); } break; } }
public MouseEvent MouseUp(MouseEventArgs e) { MouseEvent.MouseInfo mouseInfo = new MouseEvent.MouseInfo(false, false, new TPoint(e.X, e.Y)); InheritButtonStatesFromPreviousMouseEvent(ref mouseInfo); if (e.Button == MouseButtons.Left) { mouseInfo.leftButton = false; MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.LUp, mouseInfo, m_previousEvent.Info.position); m_previousEvent = mouseEvent; return mouseEvent; } else if (e.Button == MouseButtons.Middle) { mouseInfo.middleButton = false; MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.MUp, mouseInfo, m_previousEvent.Info.position); m_previousEvent = mouseEvent; return mouseEvent; } else if (e.Button == MouseButtons.Right) { mouseInfo.rightButton = false; MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.RUp, mouseInfo, m_previousEvent.Info.position); m_previousEvent = mouseEvent; return mouseEvent; } return null; }
public MouseEvent MouseMove(MouseEventArgs e) { MouseEvent.MouseInfo mouseInfo = new MouseEvent.MouseInfo(false, false, new TPoint(e.X, e.Y)); InheritButtonStatesFromPreviousMouseEvent(ref mouseInfo); MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.Move, mouseInfo, m_previousEvent.Info.position); m_previousEvent = mouseEvent; return mouseEvent; }
public override void OnMouseEvent(MouseEvent mouseEvent) { switch(mouseEvent.State) { case MouseEvent.EventState.LDown: { m_startPosition = mouseEvent.Info.position; } break; case MouseEvent.EventState.LUp: { if (CanControlAdd(m_createCommand.CheckImage) == false) { return; } m_createCommand.StartPosition = m_startPosition; m_createCommand.EndPosition = mouseEvent.Info.position; m_commandManager.CurrentCommand = m_createCommand; m_commandManager.Execute(); m_stateManager.ChangeState( StateType.Idle ); } break; } }
public MouseEvent MouseWheel(MouseEventArgs e) { MouseEvent.MouseInfo mouseInfo = new MouseEvent.MouseInfo(false, false, false, new TPoint(e.X, e.Y), e.Delta); InheritButtonStatesFromPreviousMouseEvent(ref mouseInfo); MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.Wheel, mouseInfo); m_previousEvent = mouseEvent; return mouseEvent; }
public MouseEventTranslator() { m_previousEvent = new MouseEvent(); }
private void InheritButtonStatesFromPreviousMouseEvent(ref MouseEvent.MouseInfo mouseInfo) { if (m_previousEvent != null) { mouseInfo.leftButton = m_previousEvent.Info.leftButton; mouseInfo.middleButton = m_previousEvent.Info.middleButton; mouseInfo.rightButton = m_previousEvent.Info.rightButton; } }
public override void OnMouseEvent(MouseEvent mouseEvent) { if (m_editPanel.LayerInfo == null) return; TPoint curPoint = mouseEvent.Info.position; switch (mouseEvent.State) { case MouseEvent.EventState.LDown: { ControlBase control = m_editPanel.LayerInfo.FindControl(curPoint); if (m_editPanel.ModifyController.ExistsAnchorUnder(curPoint ) == false) { SelectEditor(control); } m_mouseDragStartPoint = curPoint; LDownProcess(curPoint,control); } break; case MouseEvent.EventState.Move: if (mouseEvent.Info.leftButton == false) return; m_editPanel.MouseDragRect = new Rect(m_mouseDragStartPoint, curPoint); break; case MouseEvent.EventState.LUp: if (m_mouseDragStartPoint != curPoint) { SelectDragEditor(); } m_editPanel.MouseDragRect = new Rect(0, 0, 0, 0); break; } }
public void OnMouseEvent(MouseEvent mouseEvent) { if (mouseEvent == null) return; m_stateManager.CurrentState.OnMouseEvent(mouseEvent); }
public abstract void OnMouseEvent(MouseEvent mouseEvent);