Skip to content

Commit

Permalink
fixed 0 length unit character exception
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSimons committed Dec 9, 2024
1 parent 624ccc3 commit 98ba941
Showing 1 changed file with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ private void OnPositionChanged(string axisValue)
};

//remove the unit character and set the correct decimal separator
var xText = position.xField.Text.Replace(positionUnitCharacter, "").Replace(",", ".");
var yText = position.yField.Text.Replace(positionUnitCharacter, "").Replace(",", ".");
var zText = position.zField.Text.Replace(positionUnitCharacter, "").Replace(",", ".");
var xText = position.xField.Text.Replace(",", ".");
var yText = position.yField.Text.Replace(",", ".");
var zText = position.zField.Text.Replace(",", ".");
if (positionUnitCharacter.Length > 0)
{
xText = xText.Replace(positionUnitCharacter, "");
yText = yText.Replace(positionUnitCharacter, "");
zText = zText.Replace(positionUnitCharacter, "");
}


double.TryParse(xText, NumberStyles.Float, numberFormat, out var x);
double.TryParse(yText, NumberStyles.Float, numberFormat, out var y);
Expand All @@ -160,9 +167,16 @@ private void OnRotationChanged(string axisValue)
};

//remove the unit character and set the correct decimal separator
var xText = rotation.xField.Text.Replace(rotationUnitCharacter, "").Replace(",", ".");
var yText = rotation.yField.Text.Replace(rotationUnitCharacter, "").Replace(",", ".");
var zText = rotation.zField.Text.Replace(rotationUnitCharacter, "").Replace(",", ".");
var xText = rotation.xField.Text.Replace(",", ".");
var yText = rotation.yField.Text.Replace(",", ".");
var zText = rotation.zField.Text.Replace(",", ".");

if (rotationUnitCharacter.Length > 0)
{
xText = xText.Replace(rotationUnitCharacter, "");
yText = yText.Replace(rotationUnitCharacter, "");
zText = zText.Replace(rotationUnitCharacter, "");
}

float.TryParse(xText, NumberStyles.Float, numberFormat, out var x);
float.TryParse(yText, NumberStyles.Float, numberFormat, out var y);
Expand All @@ -179,9 +193,16 @@ private void OnScaleChanged(string axisValue)
};

//remove the unit character and set the correct decimal separator
var xText = scale.xField.Text.Replace(scaleUnitCharacter, "").Replace(",", ".");
var yText = scale.yField.Text.Replace(scaleUnitCharacter, "").Replace(",", ".");
var zText = scale.zField.Text.Replace(scaleUnitCharacter, "").Replace(",", ".");
var xText = scale.xField.Text.Replace(",", ".");
var yText = scale.yField.Text.Replace(",", ".");
var zText = scale.zField.Text.Replace(",", ".");

if (scaleUnitCharacter.Length > 0)
{
xText = xText.Replace(scaleUnitCharacter, "");
yText = yText.Replace(scaleUnitCharacter, "");
zText = zText.Replace(scaleUnitCharacter, "");
}

float.TryParse(xText, NumberStyles.Float, numberFormat, out var x);
float.TryParse(yText, NumberStyles.Float, numberFormat, out var y);
Expand Down

0 comments on commit 98ba941

Please sign in to comment.