summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-03-18 20:42:48 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2018-03-18 20:42:48 +0100
commit81cdd02735b4cd43f5f45419624ba3d062241b57 (patch)
treea545dee6b7b3f5814c090171711e32ab63468688
parentb6d2ddc0770f29152cabf3de4020daa51d987c1f (diff)
Fix power curve coordinates and mouse cursor behavior.
-rw-r--r--src/samplesorter.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/samplesorter.cc b/src/samplesorter.cc
index ede42f6..6158bfa 100644
--- a/src/samplesorter.cc
+++ b/src/samplesorter.cc
@@ -126,7 +126,6 @@ void SampleSorter::relayout()
max = 0.0;
{
-
QVector<sel_id_t> ids = selections.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
@@ -172,7 +171,7 @@ void SampleSorter::relayout()
#define MAP(p) (height()-(int)(p*((float)height()/(float)width())))
-#define unmapX(x) ((double)x/(double)(width()-1))
+#define unmapX(x) ((double)x/(double)(width()-1)*(1.0/0.9))
#define unmapY(x) x
#define mapX(x) (((double)x)*(width()-1))
#define mapY(x) x
@@ -254,7 +253,7 @@ sel_id_t SampleSorter::getSelectionByCoordinate(int px, int py)
Selection sel = selections.get(*i);
float x = (sel.energy/max);
x = sqrt(x);
- x *= (float)width();
+ x *= (float)width() * 0.9;
if(px < (x + hit_r) &&
px > (x - hit_r) &&
py < (MAP(x) + hit_r) &&
@@ -290,7 +289,7 @@ void SampleSorter::mouseMoveEvent(QMouseEvent* event)
sel_id_t psel = getSelectionByCoordinate(event->x(), event->y());
if(psel != SEL_NONE)
{
- setCursor(Qt::UpArrowCursor);
+ setCursor(Qt::OpenHandCursor);
}
else
{
@@ -308,7 +307,7 @@ void SampleSorter::mousePressEvent(QMouseEvent* event)
selections.setActive(psel);
if(psel != SEL_NONE)
{
- setCursor(Qt::UpArrowCursor);
+ setCursor(Qt::ClosedHandCursor);
}
}
}
@@ -318,6 +317,14 @@ void SampleSorter::mouseReleaseEvent(QMouseEvent* event)
if(event->button() == Qt::LeftButton)
{
sel_moving = SEL_NONE;
- setCursor(Qt::ArrowCursor);
+ sel_id_t psel = getSelectionByCoordinate(event->x(), event->y());
+ if(psel != SEL_NONE)
+ {
+ setCursor(Qt::OpenHandCursor);
+ }
+ else
+ {
+ setCursor(Qt::ArrowCursor);
+ }
}
}