void UISlider::Input(UIEvent *currentInput) { #if !defined(__DAVAENGINE_IPHONE__) && !defined(__DAVAENGINE_ANDROID__) if (currentInput->phase == UIEvent::PHASE_MOVE || currentInput->phase == UIEvent::PHASE_KEYCHAR) return; #endif const Rect & absRect = GetGeometricData().GetUnrotatedRect(); //absTouchPoint = currentInput->point; relTouchPoint = currentInput->point; relTouchPoint -= absRect.GetPosition(); float oldVal = currentValue; currentValue = Interpolation::Linear(minValue, maxValue, (float32)leftInactivePart, relTouchPoint.x, size.x - (float32)rightInactivePart); if(currentValue < minValue) { currentValue = minValue; } if(currentValue > maxValue) { currentValue = maxValue; } if (isEventsContinuos) // if continuos events { if(oldVal != currentValue) { PerformEvent(EVENT_VALUE_CHANGED); } }else if (currentInput->phase == UIEvent::PHASE_ENDED) { /* if not continuos always perform event because last move position almost always the same as end pos */ PerformEvent(EVENT_VALUE_CHANGED); } RecalcButtonPos(); }
void UISlider::SetMaxValue(float32 value) { maxValue = value; RecalcButtonPos(); }
void UISlider::SetSize(const DAVA::Vector2 &newSize) { UIControl::SetSize(newSize); RecalcButtonPos(); }
void UISlider::SetValue(float32 value) { currentValue = value; RecalcButtonPos(); }
void UISlider::SyncThumbWithSprite() { RecalcButtonPos(); }