//------------------------------------------------------------------------------------------------------------------------------ protected void updateSlider(float value) { mSliderValue = value; saturate(ref mSliderValue); if (mThumb != null) { LT.MOVE(mThumb, sliderValueToThumbPos(mSliderValue)); } if (mForeground != null) { if (mMode == SLIDER_MODE.SM_FILL) { mForeground.setFillPercent(mSliderValue); } else if (mMode == SLIDER_MODE.SM_SIZING) { if (mDirection == DRAG_DIRECTION.DD_HORIZONTAL) { float newWidth = mSliderValue * mOriginForegroundSize.x; Vector3 newForePos = mOriginForegroundPosition; newForePos.x = mOriginForegroundPosition.x - mOriginForegroundSize.x * 0.5f + newWidth * 0.5f; LT.MOVE(mForeground, newForePos); mForeground.setWindowSize(new Vector2(newWidth, mOriginForegroundSize.y)); } else if (mDirection == DRAG_DIRECTION.DD_VERTICAL) { float newHeight = mSliderValue * mOriginForegroundSize.y; Vector3 newForePos = mOriginForegroundPosition; newForePos.y = mOriginForegroundPosition.y - mOriginForegroundSize.y * 0.5f + newHeight * 0.5f; LT.MOVE(mForeground, newForePos); mForeground.setWindowSize(new Vector2(mOriginForegroundSize.x, newHeight)); } } } }