Canvas: change behavior of Item::preferred_size() for items without an intrinsic size
This commit is contained in:
parent
ea96798ee9
commit
61742ededf
@ -1211,28 +1211,22 @@ Item::preferred_size (Duple& minimum, Duple& natural) const
|
|||||||
|
|
||||||
if (_intrinsic_height < 0 && _intrinsic_width < 0) {
|
if (_intrinsic_height < 0 && _intrinsic_width < 0) {
|
||||||
|
|
||||||
/* intrinsic size untouched, use bounding box */
|
/* intrinsic size untouched ... fall back on
|
||||||
|
arbitrary default (small) sizes.
|
||||||
|
*/
|
||||||
|
|
||||||
Rect bb (bounding_box());
|
natural.x = 2;
|
||||||
|
natural.y = 2;
|
||||||
if (!bb) {
|
|
||||||
natural.x = 2;
|
|
||||||
natural.y = 2;
|
|
||||||
} else {
|
|
||||||
natural.x = bb.width();
|
|
||||||
natural.y = bb.height();
|
|
||||||
}
|
|
||||||
|
|
||||||
minimum.x = 1;
|
|
||||||
minimum.y = 1;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
natural.x = _intrinsic_width;
|
natural.x = _intrinsic_width;
|
||||||
natural.y = _intrinsic_height;
|
natural.y = _intrinsic_height;
|
||||||
|
|
||||||
minimum = natural;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minimum.x = 1;
|
||||||
|
minimum.y = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user