void IMouseHandler.canvas_MouseDown(object sender, MouseEventArgs e) { this.lastBindingMouseButtons = this.BindingMouseButtons; if ((e.Button & this.lastBindingMouseButtons) != MouseButtons.None) { var control = sender as Control; this.SetBounds(control.Width, control.Height); if (!cameraState.IsSameState(this.camera)) { SetCamera(this.camera.Position, this.camera.Target, this.camera.UpVector); } this._startPosition = GetArcBallPosition(e.X, e.Y); mouseDownFlag = true; } }
/// <summary> /// 必须先调用<see cref="SetBounds"/>()方法。 /// </summary> /// <param name="x"></param> /// <param name="y"></param> public void MouseDown(int x, int y) { Debug.WriteLine(""); Debug.WriteLine("=================>MouseDown:", listenerName); if (!cameraState.IsSameState(this.Camera)) { SetCamera(this.Camera.Position, this.Camera.Target, this.Camera.UpVector); Debug.WriteLine(string.Format( "update camera state: {0}, {1}, {2}", this.cameraState.position, this.cameraState.target, this.cameraState.up), listenerName); } this._startPosition = GetArcBallPosition(x, y); Debug.WriteLine(string.Format("Start position: {0}", this._startPosition), listenerName); MouseDownFlag = true; Debug.WriteLine("-------------------MouseDown end.", listenerName); }