File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ You can find its changes [documented below](#060---2020-06-01).
1313- Export ` Image ` and ` ImageData ` by default. ([ #1011 ] by [ @covercash2 ] )
1414- Re-export ` druid_shell::Scalable ` under ` druid ` namespace. ([ #1075 ] by [ @ForLoveOfCats ] )
1515- ` TextBox ` now supports ctrl and shift hotkeys. ([ #1076 ] by [ @vkahl ] )
16- - Added selection text color to textbox. ([ #1093 ] by [ @sysint64 ] )
16+ - Selection text color to textbox. ([ #1093 ] by [ @sysint64 ] )
17+ - ` BoxConstraints::UNBOUNDED ` constant. ([ #1126 ] by [ @danieldulaney ] )
1718- Close requests from the shell can now be intercepted ([ #1118 ] by [ @jneem ] )
1819
1920### Changed
@@ -386,6 +387,7 @@ Last release without a changelog :(
386387[ #1118 ] : https://github.com/linebender/druid/pull/1118
387388[ #1119 ] : https://github.com/linebender/druid/pull/1119
388389[ #1120 ] : https://github.com/linebender/druid/pull/1120
390+ [ #1126 ] : https://github.com/linebender/druid/pull/1120
389391
390392[ Unreleased ] : https://github.com/linebender/druid/compare/v0.6.0...master
391393[ 0.6.0 ] : https://github.com/linebender/druid/compare/v0.5.0...v0.6.0
Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ pub struct BoxConstraints {
4141}
4242
4343impl BoxConstraints {
44+ /// An unbounded box constraints object.
45+ ///
46+ /// Can be satisfied by any nonnegative size.
47+ pub const UNBOUNDED : BoxConstraints = BoxConstraints {
48+ min : Size :: ZERO ,
49+ max : Size :: new ( f64:: INFINITY , f64:: INFINITY ) ,
50+ } ;
51+
4452 /// Create a new box constraints object.
4553 ///
4654 /// Create constraints based on minimum and maximum size.
@@ -156,3 +164,16 @@ impl BoxConstraints {
156164 BoxConstraints :: new ( min, max)
157165 }
158166}
167+
168+ #[ cfg( test) ]
169+ mod tests {
170+ use super :: * ;
171+
172+ #[ test]
173+ fn unbounded ( ) {
174+ assert ! ( !BoxConstraints :: UNBOUNDED . is_width_bounded( ) ) ;
175+ assert ! ( !BoxConstraints :: UNBOUNDED . is_height_bounded( ) ) ;
176+
177+ assert_eq ! ( BoxConstraints :: UNBOUNDED . min( ) , Size :: ZERO ) ;
178+ }
179+ }
You can’t perform that action at this time.
0 commit comments