[gnome-builder/wip/slaf/colorpicker] gstyle-eyedropper: better zoom curve
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/slaf/colorpicker] gstyle-eyedropper: better zoom curve
- Date: Sun, 17 Jul 2016 21:27:06 +0000 (UTC)
commit 0ffa5001a0bce1b9d9da183cb91740c0099abdab
Author: Sebastien Lafargue <slafargue gnome org>
Date: Sun Jul 17 17:33:43 2016 +0200
gstyle-eyedropper: better zoom curve
contrib/gstyle/gstyle-eyedropper.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/contrib/gstyle/gstyle-eyedropper.c b/contrib/gstyle/gstyle-eyedropper.c
index 6a03353..e6a2c1e 100644
--- a/contrib/gstyle/gstyle-eyedropper.c
+++ b/contrib/gstyle/gstyle-eyedropper.c
@@ -42,9 +42,9 @@
#define ZOOM_AREA_SPOT_X -20
#define ZOOM_AREA_SPOT_Y -20
-#define DEFAULT_ZOOM_FACTOR 2
+#define DEFAULT_ZOOM_FACTOR 5
#define MIN_ZOOM_FACTOR 1
-#define MAX_ZOOM_FACTOR 20
+#define MAX_ZOOM_FACTOR MAX (ZOOM_AREA_WIDTH, ZOOM_AREA_HEIGHT) / 2
#define CURSOR_ALT_STEP 10
@@ -371,17 +371,23 @@ gstyle_eyedropper_pointer_pressed_cb (GstyleEyedropper *self,
static void
decrease_zoom_factor (GstyleEyedropper *self)
{
+ gdouble factor;
+
g_assert (GSTYLE_IS_EYEDROPPER (self));
- self->zoom_factor = CLAMP (self->zoom_factor - 0.5, MIN_ZOOM_FACTOR, MAX_ZOOM_FACTOR);
+ factor = (self->zoom_factor * self->zoom_factor) / 100;
+ self->zoom_factor = CLAMP (self->zoom_factor - factor, MIN_ZOOM_FACTOR, MAX_ZOOM_FACTOR);
}
static void
increase_zoom_factor (GstyleEyedropper *self)
{
+ gdouble factor;
+
g_assert (GSTYLE_IS_EYEDROPPER (self));
- self->zoom_factor = CLAMP (self->zoom_factor + 0.5, MIN_ZOOM_FACTOR, MAX_ZOOM_FACTOR);
+ factor = (self->zoom_factor * self->zoom_factor) / 100;
+ self->zoom_factor = CLAMP (self->zoom_factor + factor, MIN_ZOOM_FACTOR, MAX_ZOOM_FACTOR);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]