+ ApplyDisplacement(handle, yLocalPosition);
+ }
+
+ void ApplyDisplacement(HandleImpl& handle, float yLocalPosition)
+ {
+ if( handle.actor )
+ {
+ float adjustedDisplacementX = 0.0f;
+ float adjustedDisplacementY = 0.0f;
+ if (mSmoothHandlePanEnabled)
+ {
+ adjustedDisplacementX = CalculateAdjustedDisplacement(handle.position.x, handle.grabDisplacementX, mControlSize.x);
+ adjustedDisplacementY = CalculateAdjustedDisplacement(handle.position.y, handle.grabDisplacementY, (mControlSize.y - handle.lineHeight));
+ }
+ handle.actor.SetProperty(Actor::Property::POSITION,
+ Vector2(handle.position.x + floor(0.5f * mCursorWidth) + adjustedDisplacementX,
+ yLocalPosition + adjustedDisplacementY));
+ }
+ }
+
+ float CalculateAdjustedDisplacement(float position, float displacement, float edge)
+ {
+ //Apply the displacement (on the X-axis & the Y-axis)
+ //as long as it does not exceed the control's edge.
+ float adjustedDisplacement = 0.0f;
+ if(position + displacement < 0.0f)
+ {
+ // -position to cancel it out and relocate to 0.
+ adjustedDisplacement = -position;
+ }
+ else if(position + displacement > edge)