Commit c9c89708 authored by Sven Langkamp's avatar Sven Langkamp

improved cursor movement on level filter slider

*cursors don't overlap anymore
*cursor positions are not mirrowed at the left edge

slightly modified patch form antiquark

svn path=/trunk/koffice/; revision=904271
parent b4d5fe71
......@@ -160,7 +160,7 @@ void KGradientSlider::mousePressEvent(QMouseEvent * e)
m_blackcursor = x;
m_grab_cursor = closest_cursor;
m_leftmost = 0;
m_rightmost = m_whitecursor;
m_rightmost = m_whitecursor - 1;
if (m_gammaEnabled) {
double delta = (double)(m_whitecursor - m_blackcursor) / 2.0;
double mid = (double)m_blackcursor + delta;
......@@ -171,7 +171,7 @@ void KGradientSlider::mousePressEvent(QMouseEvent * e)
case WhiteCursor:
m_whitecursor = x;
m_grab_cursor = closest_cursor;
m_leftmost = m_blackcursor;
m_leftmost = m_blackcursor + 1;
m_rightmost = 255;
if (m_gammaEnabled) {
double delta = (double)(m_whitecursor - m_blackcursor) / 2.0;
......@@ -218,7 +218,7 @@ void KGradientSlider::mouseReleaseEvent(QMouseEvent * e)
void KGradientSlider::mouseMoveEvent(QMouseEvent * e)
{
unsigned int x = abs(e->pos().x());
int x = e->pos().x();
if (m_dragging == true) { // Else, drag the selected point
if (x <= m_leftmost)
......@@ -227,12 +227,6 @@ void KGradientSlider::mouseMoveEvent(QMouseEvent * e)
if (x >= m_rightmost)
x = m_rightmost;
/*if(x > 255)
x = 255;
if(x < 0)
x = 0;*/
switch (m_grab_cursor) {
case BlackCursor:
if (m_blackcursor != x) {
......
......@@ -66,15 +66,15 @@ public:
double getGamma(void);
private:
unsigned int m_leftmost;
unsigned int m_rightmost;
int m_leftmost;
int m_rightmost;
eCursor m_grab_cursor;
unsigned int m_grab_index;
bool m_dragging;
unsigned int m_blackcursor;
unsigned int m_whitecursor;
unsigned int m_gammacursor;
int m_blackcursor;
int m_whitecursor;
int m_gammacursor;
bool m_gammaEnabled;
double m_gamma;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment