mirror of https://github.com/GNOME/gimp.git
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).
This commit is contained in:
parent
fc4add7c2b
commit
0a1ecdf4ee
|
@ -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"))
|
||||
{
|
||||
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;
|
||||
}
|
||||
if (HAS_KEY (pspec, "unit", "pixel-coordinate"))
|
||||
{
|
||||
/* 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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue