Allow scrolling and up and down arrows for slider manipulation.
This commit is contained in:
@@ -172,7 +172,7 @@ BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask)
|
||||
|
||||
if( hasMouseCapture() )
|
||||
{
|
||||
gFocusMgr.setMouseCapture( NULL );
|
||||
gFocusMgr.setMouseCapture(nullptr );
|
||||
|
||||
if (mMouseUpSignal)
|
||||
(*mMouseUpSignal)( this, getValueF32() );
|
||||
@@ -229,15 +229,12 @@ BOOL LLSlider::handleKeyHere(KEY key, MASK mask)
|
||||
BOOL handled = FALSE;
|
||||
switch(key)
|
||||
{
|
||||
case KEY_UP:
|
||||
case KEY_DOWN:
|
||||
// eat up and down keys to be consistent
|
||||
handled = TRUE;
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
setValueAndCommit(getValueF32() - getIncrement());
|
||||
handled = TRUE;
|
||||
break;
|
||||
case KEY_UP:
|
||||
case KEY_RIGHT:
|
||||
setValueAndCommit(getValueF32() + getIncrement());
|
||||
handled = TRUE;
|
||||
@@ -248,6 +245,13 @@ BOOL LLSlider::handleKeyHere(KEY key, MASK mask)
|
||||
return handled;
|
||||
}
|
||||
|
||||
BOOL LLSlider::handleScrollWheel(S32 x, S32 y, S32 clicks)
|
||||
{
|
||||
F32 new_val = getValueF32() - clicks * getIncrement();
|
||||
setValueAndCommit(new_val);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLSlider::draw()
|
||||
{
|
||||
F32 alpha = getDrawContext().mAlpha;
|
||||
@@ -276,7 +280,7 @@ void LLSlider::draw()
|
||||
mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor() % alpha, gFocusMgr.getFocusFlashWidth());
|
||||
}
|
||||
|
||||
if( hasMouseCapture() )
|
||||
if( hasMouseCapture() ) // currently clicking on slider
|
||||
{
|
||||
// Show ghost where thumb was before dragging began.
|
||||
if (mThumbImage.notNull())
|
||||
|
||||
@@ -75,12 +75,12 @@ public:
|
||||
boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb );
|
||||
boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb );
|
||||
|
||||
|
||||
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
|
||||
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
||||
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
||||
virtual BOOL handleKeyHere(KEY key, MASK mask);
|
||||
virtual void draw();
|
||||
BOOL handleHover(S32 x, S32 y, MASK mask) override;
|
||||
BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
|
||||
BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
|
||||
BOOL handleKeyHere(KEY key, MASK mask) override;
|
||||
BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override;
|
||||
void draw() override;
|
||||
|
||||
private:
|
||||
void setValueAndCommit(F32 value);
|
||||
|
||||
Reference in New Issue
Block a user