コード例 #1
0
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();
}
コード例 #2
0
void UISlider::SetMaxValue(float32 value)
{
    maxValue = value;
    RecalcButtonPos();
}
コード例 #3
0
ファイル: UISlider.cpp プロジェクト: galek/dava.framework
void UISlider::SetSize(const DAVA::Vector2 &newSize)
{
    UIControl::SetSize(newSize);
    RecalcButtonPos();
}
コード例 #4
0
void UISlider::SetValue(float32 value)
{
	currentValue = value;
	RecalcButtonPos();
}
コード例 #5
0
ファイル: UISlider.cpp プロジェクト: galek/dava.framework
void UISlider::SyncThumbWithSprite()
{
    RecalcButtonPos();
}