@ -152,7 +152,7 @@ namespace Avalonia
Rect . Width * size . Width ,
Rect . Width * size . Width ,
Rect . Height * size . Height ) ;
Rect . Height * size . Height ) ;
}
}
/// <summary>
/// <summary>
/// Converts a <see cref="RelativeRect"/> into pixels.
/// Converts a <see cref="RelativeRect"/> into pixels.
/// </summary>
/// </summary>
@ -178,18 +178,18 @@ namespace Avalonia
{
{
using ( var tokenizer = new StringTokenizer ( s , exceptionMessage : "Invalid RelativeRect." ) )
using ( var tokenizer = new StringTokenizer ( s , exceptionMessage : "Invalid RelativeRect." ) )
{
{
var x = tokenizer . ReadString ( ) ;
var x = tokenizer . ReadSpan ( ) ;
var y = tokenizer . ReadString ( ) ;
var y = tokenizer . ReadSpan ( ) ;
var width = tokenizer . ReadString ( ) ;
var width = tokenizer . ReadSpan ( ) ;
var height = tokenizer . ReadString ( ) ;
var height = tokenizer . ReadSpan ( ) ;
var unit = RelativeUnit . Absolute ;
var unit = RelativeUnit . Absolute ;
var scale = 1.0 ;
var scale = 1.0 ;
var xRelative = x . EndsWith ( "%" , StringComparison . Ordinal ) ;
var xRelative = x . EndsWith ( PercentChar , StringComparison . Ordinal ) ;
var yRelative = y . EndsWith ( "%" , StringComparison . Ordinal ) ;
var yRelative = y . EndsWith ( PercentChar , StringComparison . Ordinal ) ;
var widthRelative = width . EndsWith ( "%" , StringComparison . Ordinal ) ;
var widthRelative = width . EndsWith ( PercentChar , StringComparison . Ordinal ) ;
var heightRelative = height . EndsWith ( "%" , StringComparison . Ordinal ) ;
var heightRelative = height . EndsWith ( PercentChar , StringComparison . Ordinal ) ;
if ( xRelative & & yRelative & & widthRelative & & heightRelative )
if ( xRelative & & yRelative & & widthRelative & & heightRelative )
{
{
@ -207,10 +207,10 @@ namespace Avalonia
}
}
return new RelativeRect (
return new RelativeRect (
double . Parse ( x , CultureInfo . InvariantCulture ) * scale ,
SpanHelpers . ParseDoubl e ( x , CultureInfo . InvariantCulture ) * scale ,
double . Parse ( y , CultureInfo . InvariantCulture ) * scale ,
SpanHelpers . ParseDoubl e ( y , CultureInfo . InvariantCulture ) * scale ,
double . Parse ( width , CultureInfo . InvariantCulture ) * scale ,
SpanHelpers . ParseDoubl e ( width , CultureInfo . InvariantCulture ) * scale ,
double . Parse ( height , CultureInfo . InvariantCulture ) * scale ,
SpanHelpers . ParseDoubl e ( height , CultureInfo . InvariantCulture ) * scale ,
unit ) ;
unit ) ;
}
}
}
}