[gimp] Issue #2540 - block width / height slider of the pixelize filter don't...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #2540 - block width / height slider of the pixelize filter don't...
- Date: Thu, 3 Jan 2019 21:22:35 +0000 (UTC)
commit 0a1ecdf4ee16b91915b8e4f4611246edcbc99103
Author: Michael Natterer <mitch gimp org>
Date: Thu Jan 3 22:19:48 2019 +0100
Issue #2540 - block width / height slider of the pixelize filter don't...
...have the same scaling
gimp_prop_widget_new_from_pspec(): when restricting the scale to the
actual op area for pixel-coordinate and pixel-distance properties,
only use the max value in the axis direction for pixel-coordinate; for
pixel-distance make sure we use the same value on both axes, simply
use MAX (area.width, area.height).
app/propgui/gimppropgui.c | 48 +++++++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/app/propgui/gimppropgui.c b/app/propgui/gimppropgui.c
index 0680b4dffc..1825570197 100644
--- a/app/propgui/gimppropgui.c
+++ b/app/propgui/gimppropgui.c
@@ -245,37 +245,45 @@ gimp_prop_widget_new_from_pspec (GObject *config,
{
gimp_prop_gui_bind_label (widget, widget);
- if (area)
+ if (area &&
+ (HAS_KEY (pspec, "unit", "pixel-coordinate") ||
+ HAS_KEY (pspec, "unit", "pixel-distance")) &&
+ (HAS_KEY (pspec, "axis", "x") ||
+ HAS_KEY (pspec, "axis", "y")))
{
- if (HAS_KEY (pspec, "unit", "pixel-coordinate") ||
- HAS_KEY (pspec, "unit", "pixel-distance"))
+ gdouble min = lower;
+ gdouble max = upper;
+
+ if (HAS_KEY (pspec, "unit", "pixel-coordinate"))
{
- gint off_x = 0;
- gint off_y = 0;
+ /* limit pixel coordinate scales to the actual area */
- if (HAS_KEY (pspec, "unit", "pixel-coordinate"))
- {
- off_x = area->x;
- off_y = area->y;
- }
+ gint off_x = area->x;
+ gint off_y = area->y;
if (HAS_KEY (pspec, "axis", "x"))
{
- gdouble min = MAX (lower, off_x);
- gdouble max = MIN (upper, off_x + area->width);
-
- gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (widget),
- min, max);
+ min = MAX (lower, off_x);
+ max = MIN (upper, off_x + area->width);
}
else if (HAS_KEY (pspec, "axis","y"))
{
- gdouble min = MAX (lower, off_y);
- gdouble max = MIN (upper, off_y + area->height);
-
- gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (widget),
- min, max);
+ min = MAX (lower, off_y);
+ max = MIN (upper, off_y + area->height);
}
}
+ else if (HAS_KEY (pspec, "unit", "pixel-distance"))
+ {
+ /* limit pixel distance scales to the same value on the
+ * x and y axes, so linked values have the same range,
+ * we use MAX (width, height), see issue #2540
+ */
+
+ max = MIN (upper, MAX (area->width, area->height));
+ }
+
+ gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (widget),
+ min, max);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]