Added support for GDK_SCROLL_SMOOTH in some widgets

see #4781, #4786
This commit is contained in:
Hombre
2018-09-15 21:14:48 +02:00
parent caffc3a23d
commit 0d61f14bae
9 changed files with 83 additions and 31 deletions

View File

@@ -267,15 +267,22 @@ void CropWindow::flawnOver (bool isFlawnOver)
this->isFlawnOver = isFlawnOver;
}
void CropWindow::scroll (int state, GdkScrollDirection direction, int x, int y)
void CropWindow::scroll (int state, GdkScrollDirection direction, int x, int y, double deltaX, double deltaY)
{
double delta = 0.0;
if (abs(deltaX) > abs(deltaY)) {
delta = deltaX;
} else {
delta = deltaY;
}
bool isUp = direction == GDK_SCROLL_UP || (direction == GDK_SCROLL_SMOOTH && delta < 0.0);
if ((state & GDK_CONTROL_MASK) && onArea(ColorPicker, x, y)) {
// resizing a color picker
if (direction == GDK_SCROLL_UP) {
if (isUp) {
hoveredPicker->incSize();
updateHoveredPicker();
iarea->redraw ();
}else if (direction == GDK_SCROLL_DOWN) {
} else {
hoveredPicker->decSize();
updateHoveredPicker();
iarea->redraw ();
@@ -287,9 +294,9 @@ void CropWindow::scroll (int state, GdkScrollDirection direction, int x, int y)
screenCoordToImage(newCenterX, newCenterY, newCenterX, newCenterY);
if (direction == GDK_SCROLL_UP && !isMaxZoom()) {
if (isUp && !isMaxZoom()) {
zoomIn (true, newCenterX, newCenterY);
} else if (direction == GDK_SCROLL_DOWN && !isMinZoom()) {
} else if (!isUp && !isMinZoom()) {
zoomOut (true, newCenterX, newCenterY);
}
}