Commit 0a1ecdf4 authored by Michael Natterer's avatar Michael Natterer

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).
parent fc4add7c
......@@ -245,40 +245,48 @@ 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"))
{
gint off_x = 0;
gint off_y = 0;
gdouble min = lower;
gdouble max = upper;
if (HAS_KEY (pspec, "unit", "pixel-coordinate"))
{
off_x = area->x;
off_y = area->y;
}
/* limit pixel coordinate scales to the actual area */
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);
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);
}
}
}
}
}
else if (G_IS_PARAM_SPEC_STRING (pspec))
{
*label = g_param_spec_get_nick (pspec);
......
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