bool nuiHugeImage::MouseClicked(const nglMouseInfo& rInfo) { if ((rInfo.Buttons & nglMouseInfo::ButtonLeft) && (rInfo.Buttons & nglMouseInfo::ButtonDoubleClick)) { float zoom = 0; int32 x = mX; int32 y = mY; if (mZoom == mMinZoom) { zoom = mMaxZoom; } else { zoom = mMinZoom; x += (rInfo.X - (mRect.GetWidth() / 2)) / mZoom; y += (rInfo.Y - (mRect.GetHeight() / 2)) / mZoom; } StopAnimation(_T("Zoom")); mpZoom->SetEndValue(zoom); StartAnimation(_T("Zoom")); if (mX != x) { StopAnimation(_T("PanX")); mpPanX->SetEndValue(x); StartAnimation(_T("PanX")); } if (mY != y) { StopAnimation(_T("PanY")); mpPanY->SetEndValue(y); StartAnimation(_T("PanY")); } Invalidate(); } else if (rInfo.Buttons & nglMouseInfo::ButtonLeft) { mClicked = true; mLastX = rInfo.X; mLastY = rInfo.Y; } else if (rInfo.Buttons & nglMouseInfo::ButtonWheelUp) { SetZoom(nuiClamp(mZoom * WHEEL_ZOOM, mMinZoom, mMaxZoom)); } else if (rInfo.Buttons & nglMouseInfo::ButtonWheelDown) { SetZoom(nuiClamp(mZoom / WHEEL_ZOOM, mMinZoom, mMaxZoom)); } return false; }
void nuiRange::SetUnitValue(double Value) { NGL_ASSERT(IsValid()); NGL_ASSERT(finite(Value)); SetValue(ConvertFromUnit(nuiClamp(Value, 0.0, 1.0))); }
void nuiHugeImage::SetMaxZoom(float set) { mMaxZoom = set; mZoom = nuiClamp(mZoom, mMinZoom, mMaxZoom); Invalidate(); }
void nuiHugeImage::SetZoom(float zoom) { mZoom = nuiClamp(zoom, mMinZoom, mMaxZoom); Invalidate(); }