Elemental wrote at 2011-11-18 07:24:
I really like your ViewCube, but one of my collegues at work had an idea that makes it even beter (in my opinion ;-) )
When you click on one side of the cube it rotates to the side. The change is that it rotates to the opposite site on double click.
It an easy change and I thought maybe you want to add it to your library...
private DateTime lastClick = DateTime.MinValue;
void cube_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
DateTime currentTime = DateTime.Now;
Vector3D normalVector = this.m_dicNormalVectors[sender];
Vector3D upVector = this.m_dicUpVectors[sender];
//check if this was a double click or a normal click
if ((currentTime - lastClick).TotalSeconds < 0.5)
//this was a double click, so scroll to the opposite side of the cube
normalVector = this.m_dicOppositeNormalVectors[sender];
upVector = this.m_dicOppositeUpVectors[sender];
lastClick = currentTime;
var camera = this.MainViewport.Camera as ProjectionCamera;
Point3D target = camera.Position + camera.LookDirection;
double distance = camera.LookDirection.Length;
Vector3D lookDirection = -normalVector;
lookDirection = lookDirection * distance;
Point3D pos = target - lookDirection;
Vector3D upDirection = upVector;
Helper.AnimateTo(camera, pos, lookDirection, upDirection, 500);
objo wrote at 2011-11-18 19:00:
good idea! I added double-click to the ViewCube in change set 72415!
Elemental wrote at 2011-11-20 18:55:
Wow, I learn so much from your toolkit!
Didn't know the MouseButtonEventArgs has a ClickCount property :-)
Customer support service by UserEcho