, __currentBgColor(0)
, __pFont(null)
, __pTitleTextObject(null)
- , __sliderX(0)
, __handleX(0)
, __prevSliderValue(0)
+ , __handleOffset(0)
, __isSliderPressed(false)
+ , __isSetValue(true)
, __isFocusModeStateChanged(false)
, __isNeedToBeUpdated(true)
, __isResourceLoaded(false)
float sliderY = 0.0f;
float iconWidth = 0.0f;
float iconSideMargin = 0.0f;
- float offset = 0.0f;
float minimumHeight = 0.0f;
float minimumWidth = 0.0f;
float iconRightMargin = 0.0f;
if (!__isCustomHandle)
{
- r = GET_SHAPE_CONFIG(SLIDER::HANDLE_OFFSET, orientation, offset);
+ r = GET_SHAPE_CONFIG(SLIDER::HANDLE_OFFSET, orientation, __handleOffset);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
r = GET_SHAPE_CONFIG(SLIDER::HANDLE_WIDTH, orientation, __handleRect.width);
{
titleTextBounds = GetTitleTextBounds();
sliderY = titleTextBounds.y + titleTextBounds.height;
- __touchRect = FloatRectangle(barLeftMargin - offset, sliderY + (__rect.height - (sliderY + __handleRect.height)) / 2.0f,
- __rect.width - (barLeftMargin + barRightMargin) + (2.0f * offset), __handleRect.height);
+ __touchRect = FloatRectangle(barLeftMargin - __handleOffset , sliderY + (__rect.height - (sliderY + __handleRect.height)) / 2.0f,
+ __rect.width - (barLeftMargin + barRightMargin) + (2.0f * __handleOffset) , __handleRect.height);
}
else
{
- __touchRect = FloatRectangle(barLeftMargin - offset, (__rect.height - __handleRect.height) / 2.0f,
- (__rect.width - (barLeftMargin + barRightMargin)) + (2.0f * offset), __handleRect.height);
+ __touchRect = FloatRectangle(barLeftMargin - __handleOffset, (__rect.height - __handleRect.height) / 2.0f,
+ (__rect.width - (barLeftMargin + barRightMargin)) + (2.0f * __handleOffset) , __handleRect.height);
}
if (__pSlider->GetIcon(ICON_POSITION_LEFT) != null)
__touchRect.width = __touchRect.width - (iconWidth + iconSideMargin + iconRightMargin);
}
- __barBgRect = FloatRectangle(__touchRect.x + offset, __touchRect.y +
- ((__handleRect.height - barHeight) / 2.0f), __touchRect.width - (2.0f * offset), barHeight);
+ __barBgRect = FloatRectangle(__touchRect.x + __handleOffset, __touchRect.y +
+ ((__handleRect.height - barHeight) / 2.0f), __touchRect.width - (2.0f * __handleOffset), barHeight);
FloatRectangle absBounds = __pSlider->GetAbsoluteBoundsF();
__pSliderOverlay->SetSliderRect(absBounds, __touchRect);
if (positionX <= __touchRect.x + offsetX)
{
- __sliderX = 0;
__handleX = 0;
return minValue;
}
if (positionX >= (__touchRect.x + __touchRect.width) - offsetX)
{
- __sliderX = __barBgRect.width - __handleRect.width - (2.0f * __barOffset);
__handleX = __touchRect.width - __handleRect.width;
return maxValue;
}
return minValue;
}
- __sliderX = positionX - (__barBgRect.x + offsetX) - (2.0f * __barOffset);
__handleX = positionX - (__touchRect.x + offsetX);
__handleRect.x = __touchRect.x + __handleX;
if ( __isSliderPressed == true)
{
- __sliderX = ((__barBgRect.width - ( __handleRect.width + (2.0f * __barOffset))) * (__pSliderModel->GetValue() - minValue)) / (maxValue - minValue);
__handleX = ((__touchRect.width - __handleRect.width) * (__pSliderModel->GetValue() - minValue)) / (maxValue - minValue);
__pSlider->Invalidate();
}
float bitmapPositionX = 0.0f;
float bitmapPositionY = 0.0f;
int opacity = 0;
- float offset = 0.0f;
Bitmap* pReplacementBitmap = null;
Bitmap* pHandleBitmap = null;
Bitmap* pHandleEffectBitmap = null;
bool isCustomHandleBitmap = false;
bool isCustomBarBitmap = false;
- _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
-
- r = GET_SHAPE_CONFIG(SLIDER::HANDLE_OFFSET, orientation, offset);
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
if (__pSlider->IsEnabled() == false) // disabled
{
pHandleBitmap = __pHandleDisabledBitmap;
int minValue = __pSliderModel->GetMinValue();
int maxValue = __pSliderModel->GetMaxValue();
- __barRect = FloatRectangle(__barBgRect.x + __barOffset, __barBgRect.y, __sliderX, __barBgRect.height);
+ __barRect = FloatRectangle(__barBgRect.x + __barOffset, __barBgRect.y, __handleRect.x , __barBgRect.height);
- if (__isSliderPressed == false && (maxValue - minValue) != 0)
+ if (__isSetValue == true && __isSliderPressed == false && (maxValue - minValue) != 0)
{
- __barRect.width = ((__barBgRect.width - ( __handleRect.width + (2.0f * __barOffset))) * (__pSliderModel->GetValue() - minValue)) / (maxValue - minValue);
__handleX = ((__touchRect.width - __handleRect.width) * (__pSliderModel->GetValue() - minValue)) / (maxValue - minValue);
}
+ __handleRect.x = __touchRect.x + __handleX;
+ __handleRect.y = __touchRect.y;
+
+ if (__handleRect.x < __touchRect.x )
+ {
+ __handleRect.x = __touchRect.x;
+ }
+
+ if (__handleRect.x + __handleRect.width > __touchRect.x + __touchRect.width )
+ {
+ __handleRect.x = __touchRect.x + __touchRect.width - __handleRect.width;
+ }
+
+ __barRect.width = __handleRect.x - __barRect.x + (__handleRect.width / 2);
+
if (__pSlider->GetBarBackgroundColor() != __currentBarBgColor)
{
pReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*__pResourceBarBgBitmap, Color::GetColor(COLOR_ID_MAGENTA), __pSlider->GetBarBackgroundColor());
}
isCustomBarBitmap = IS_CUSTOM_BITMAP(SLIDER::BAR_NORMAL);
- DrawBitmap(canvas, FloatRectangle(__barRect.x, __barRect.y, (__barRect.width + __handleRect.width / 2), __barRect.height), __pBarColorReplacementBitmap);
+ DrawBitmap(canvas, __barRect, __pBarColorReplacementBitmap);
if (isCustomBarBitmap == false)
{
- DrawBitmap(canvas, FloatRectangle(__barRect.x, __barRect.y, (__barRect.width + __handleRect.width / 2), __barRect.height), __pBarResourceEffectBitmap);
- }
-
- __handleRect.x = __touchRect.x + __handleX;
- __handleRect.y = __touchRect.y;
-
- if (__handleRect.x < __touchRect.x )
- {
- __handleRect.x = __touchRect.x;
- }
-
- if (__handleRect.x + __handleRect.width > __touchRect.x + __touchRect.width )
- {
- __handleRect.x = __touchRect.x + __touchRect.width - __handleRect.width;
+ DrawBitmap(canvas, __barRect, __pBarResourceEffectBitmap);
}
Canvas* pHandleCanvas = __pSlider->GetHandleCanvasN();
if (__handleRect.Contains(point) == true)
{
__isSliderPressed = true;
+ __isSetValue = false;
int candidateValue = CalculateSliderValue(point.x, point.x - __handleRect.x);
__prevSliderValue = candidateValue;
{
PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pSlider);
__isSliderPressed = false;
+ __isSetValue = false;
int candidateValue = 0;
value = minValue;
}
+ __isSetValue = true;
+
__pSliderModel->SetValue(value);
return;
_VisualElement* pHandle = __pSlider->GetHandle();
pHandle->SetBounds(FloatRectangle(__handleRect.x, __handleRect.y, __handleRect.width, __handleRect.height));
+ __handleOffset = __handleRect.width / 2;
__isCustomHandle = true;
break;