const float SCROLL_SPEED = 300.f;
const float SCROLL_DISTANCE = SCROLL_SPEED * SCROLL_TICK_INTERVAL * TO_SECONDS;
+const float CURSOR_WIDTH = 1.f;
+
/**
* structure to hold coordinates of each quad, which will make up the mesh.
*/
mActiveCursor( ACTIVE_CURSOR_NONE ),
mCursorBlinkInterval( CURSOR_BLINK_INTERVAL ),
mCursorBlinkDuration( 0.0f ),
+ mCursorWidth( CURSOR_WIDTH ),
mHandleScrolling( HANDLE_TYPE_COUNT ),
mScrollDirection( SCROLL_NONE ),
mScrollThreshold( SCROLL_THRESHOLD ),
mPrimaryCursor.SetPosition( position.x,
position.y );
- mPrimaryCursor.SetSize( Size( 1.0f, cursor.cursorHeight ) );
+ mPrimaryCursor.SetSize( Size( mCursorWidth, cursor.cursorHeight ) );
}
mPrimaryCursor.SetVisible( mPrimaryCursorVisible );
}
{
mSecondaryCursor.SetPosition( cursor.position.x,
cursor.position.y );
- mSecondaryCursor.SetSize( Size( 1.0f, cursor.cursorHeight ) );
+ mSecondaryCursor.SetSize( Size( mCursorWidth, cursor.cursorHeight ) );
}
mSecondaryCursor.SetVisible( mSecondaryCursorVisible );
}
CreateGrabHandle();
- grabHandle.actor.SetPosition( position.x,
+ grabHandle.actor.SetPosition( position.x - floor( 0.5f * mCursorWidth ),
position.y + grabHandle.lineHeight ); // TODO : Fix for multiline.
}
grabHandle.actor.SetVisible( isVisible );
cursor = CreateSolidColorActor( color );
cursor.SetSortModifier( DECORATION_DEPTH_INDEX );
cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one.
- cursor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+ cursor.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
}
// Add or Remove cursor(s) from parent
for( std::size_t v = 0; iter != endIter; ++iter,v+=4 )
{
-
QuadCoordinates& quad = *iter;
// top-left (v+0)
mHighlightQuadList.clear();
- mHighlightRenderer.SetDepthIndex( mTextDepth - 2u ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
+ if( mHighlightRenderer )
+ {
+ mHighlightRenderer.SetDepthIndex( mTextDepth - 2u ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
+ }
}
}
unsigned int mActiveCursor;
unsigned int mCursorBlinkInterval;
float mCursorBlinkDuration;
+ float mCursorWidth; ///< The width of the cursors in pixels.
HandleType mHandleScrolling; ///< The handle which is scrolling.
ScrollDirection mScrollDirection; ///< The direction of the scroll.
float mScrollThreshold; ///< Defines a square area inside the control, close to the edge. A cursor entering this area will trigger scroll events.
return mImpl->mCursorBlinkDuration;
}
+void Decorator::SetCursorWidth( int width )
+{
+ mImpl->mCursorWidth = static_cast<float>( width );
+}
+
+int Decorator::GetCursorWidth() const
+{
+ return static_cast<int>( mImpl->mCursorWidth );
+}
+
/** Handles **/
void Decorator::SetHandleActive( HandleType handleType, bool active )