}
float fitWidth = (Button.Icon.Size?.Width ?? 48) + dropDownStyle.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
fitWidth += (button.IconPadding.Start + button.IconPadding.End);
- button.Size.Width = Math.Max(button.Size.Width, fitWidth);
+ button.SizeWidth = Math.Max(button.Size.Width, fitWidth);
RelayoutRequest();
int numberOfItemsToAdd = adapter.GetItemCount();
*/
private Vector2 GetRectOfVisibleChildScrollAmount(FlexibleView parent, FlexibleViewViewHolder child)
{
- Vector2 ret = new Vector2(0, 0);
int parentLeft = PaddingLeft;
int parentTop = PaddingTop;
int parentRight = (int)Width - PaddingRight;
var offsetBottom = Math.Max(0, childBottom - parentBottom);
int dx = offsetStart != 0 ? offsetStart : Math.Min(childLeft - parentLeft, offsetEnd);
-
int dy = offsetTop != 0 ? offsetTop : Math.Min(childTop - parentTop, offsetBottom);
- ret.X = -dx;
- ret.Y = -dy;
-
- return ret;
+ return new Vector2(-dx, -dy);
}
private void OnScrollAnimationFinished(object sender, EventArgs e)
var instance = (Popup)bindable;
if (newValue != null && instance?.popupStyle?.Buttons?.Size != null)
{
- instance.popupStyle.Buttons.Size.Height = (int)newValue;
+ instance.popupStyle.Buttons.SizeHeight = (int)newValue;
instance.btGroup.Itemheight = (int)newValue;
instance.UpdateView();
}
{
if (popupStyle?.Title?.Size != null)
{
- popupStyle.Title.Size.Height = value;
+ popupStyle.Title.SizeHeight = value;
}
}
}
for (int i = 0; i < totalNum; i++)
{
preW = (itemList[i].TextItem.NaturalSize2D != null ? itemList[i].TextItem.NaturalSize2D.Width : 0);
- itemList[i].Position2D.X = preX;
- itemList[i].Size2D.Width = preW;
+ itemList[i].PositionX = preX;
+ itemList[i].SizeWidth = preW;
preX = itemList[i].Position2D.X + preW + itemSpace;
itemList[i].Index = i;
}
preW = (Size2D.Width - (int)tabStyle?.ItemPadding.Start - (int)tabStyle?.ItemPadding.End) / totalNum;
for (int i = 0; i < totalNum; i++)
{
- itemList[i].Position2D.X = preX;
- itemList[i].Size2D.Width = preW;
+ itemList[i].PositionX = preX;
+ itemList[i].SizeWidth = preW;
preX = itemList[i].Position2D.X + preW + itemSpace;
itemList[i].Index = i;
}
for (int i = 0; i < totalNum; i++)
{
preW = (itemList[i].NaturalSize2D != null ? itemList[i].NaturalSize2D.Width : 0);
- itemList[i].Position2D.X = w - preW - preX;
- itemList[i].Size2D.Width = preW;
+ itemList[i].PositionX = w - preW - preX;
+ itemList[i].SizeWidth = preW;
preX = w - itemList[i].Position2D.X + itemSpace;
itemList[i].Index = i;
}
preW = (Size2D.Width - (int)tabStyle?.ItemPadding.Start - (int)tabStyle?.ItemPadding.End) / totalNum;
for (int i = totalNum - 1; i >= 0; i--)
{
- itemList[i].Position2D.X = preX;
- itemList[i].Size2D.Width = preW;
+ itemList[i].PositionX = preX;
+ itemList[i].SizeWidth = preW;
preX = itemList[i].Position2D.X + preW + itemSpace;
itemList[i].Index = i;
}
item.TextItem.ApplyStyle(tabStyle.Text);
item.Text = itemData.Text;
- item.Size2D.Height = Size2D.Height - h - topSpace;
- item.Position2D.Y = topSpace;
+ item.SizeHeight = SizeHeight - h - topSpace;
+ item.PositionY = topSpace;
item.TouchEvent += ItemTouchEvent;
Add(item);
return;
}
- Underline.Size.Width = itemList[curIndex].Size2D.Width;
+ Underline.SizeWidth = itemList[curIndex].Size2D.Width;
underline.Size2D = new Size2D(itemList[curIndex].Size2D.Width, (int)Underline.Size.Height);
underline.BackgroundColor = tabStyle.UnderLine.BackgroundColor.All;
}
else
{
- underline.Position2D.X = itemList[curIndex].Position2D.X;
+ underline.PositionX = itemList[curIndex].PositionX;
isNeedAnimation = true;
}
{
window = win;
window.Add(this);
- this.Position.X = (window.Size.Width - this.Size.Width) / 2;
- this.Position.Y = (window.Size.Height - this.Size.Height) / 2;
+ this.PositionX = (window.Size.Width - this.Size.Width) / 2;
+ this.PositionY = (window.Size.Height - this.Size.Height) / 2;
timer.Start();
}
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual void SetIndicatorPosition(int index, Position position)
{
+ if (position == null)
+ {
+ throw new ArgumentNullException(nameof(position));
+ }
// Update odd / even Array and List by each converted index.
if (isOddNumber)
{
{
oddArray[(middleIndex - leftIndicatorCount) + index] = position;
}
- indicatorList[index].Position.X = position.X;
- indicatorList[index].Position.Y = position.Y;
+ indicatorList[index].Position = new Vector2(position.X, position.Y);
}
else // Only symmetry circular pagination can be even number.
{
evenArray[(middleIndex - (indicatorCount / 2) + index)] = position;
- indicatorList[index].Position.X = position.X;
- indicatorList[index].Position.Y = position.Y;
+ indicatorList[index].Position = new Vector2(position.X, position.Y);
}
UpdateVisual();
}
private void UpdateImage()
{
- leftImage.Size.Width = fadeOutWidth;
- rightImage.Size.Width = fadeOutWidth;
+ leftImage.SizeWidth = fadeOutWidth;
+ rightImage.SizeWidth = fadeOutWidth;
if (fadeOutWidth > 0)
{
if (viewStyle.size == null)
{
if ((float)newValue == 0) return;
- viewStyle.size = new Size();
}
- viewStyle.size.Width = (float)newValue;
+ viewStyle.size = new Size((float)newValue, viewStyle.size?.Height ?? 0);
}
},
defaultValueCreator: (bindable) =>
if (viewStyle.size == null)
{
if ((float)newValue == 0) return;
- viewStyle.size = new Size();
}
- viewStyle.size.Height = (float)newValue;
+ viewStyle.size = new Size(viewStyle.size?.Width ?? 0, (float)newValue);
}
},
defaultValueCreator: (bindable) =>
if (viewStyle.position == null)
{
if ((float)newValue == 0) return;
- viewStyle.position = new Position();
}
- viewStyle.position.X = (float)newValue;
+ viewStyle.position = new Position((float)newValue, viewStyle.position?.Y ?? 0);
}
},
defaultValueCreator: (bindable) =>
if (viewStyle.position == null)
{
if ((float)newValue == 0) return;
- viewStyle.position = new Position();
}
- viewStyle.position.Y = (float)newValue;
+ viewStyle.position = new Position(viewStyle.position?.X ?? 0, (float)newValue);
}
},
defaultValueCreator: (bindable) =>
if (viewStyle.position == null)
{
if ((float)newValue == 0) return;
- viewStyle.position = new Position();
}
- viewStyle.position.Z = (float)newValue;
+ viewStyle.position = new Position(viewStyle.Position?.X ?? 0, viewStyle.Position?.Y ?? 0, (float)newValue);
}
},
defaultValueCreator: (bindable) =>
if (viewStyle.scale == null)
{
if ((float)newValue == 1.0f) return;
- viewStyle.scale = new Vector3();
}
- viewStyle.scale.X = (float)newValue;
+ viewStyle.scale = new Vector3((float)newValue, viewStyle.scale?.Y ?? 0, viewStyle.scale?.Z ?? 0);
}
},
defaultValueCreator: (bindable) =>
if (viewStyle.scale == null)
{
if ((float)newValue == 1.0f) return;
- viewStyle.scale = new Vector3();
}
- viewStyle.scale.Y = (float)newValue;
+ viewStyle.scale = new Vector3(viewStyle.scale?.X ?? 0, (float)newValue, viewStyle.scale?.Z ?? 0);
}
},
defaultValueCreator: (bindable) =>
if (viewStyle.scale == null)
{
if ((float)newValue == 1.0f) return;
- viewStyle.scale = new Vector3();
}
- viewStyle.scale.Z = (float)newValue;
+ viewStyle.scale = new Vector3(viewStyle.scale?.X ?? 0, viewStyle.scale?.Y ?? 0, (float)newValue);
}
},
defaultValueCreator: (bindable) =>
get
{
Size2D temp = (Size2D)GetValue(Size2DProperty);
+ int width = temp.Width;
+ int height = temp.Height;
if (this.Layout == null)
{
- if (temp.Width < 0) { temp.Width = 0; }
- if (temp.Height < 0) { temp.Height = 0; }
+ if (width < 0) { width = 0; }
+ if (height < 0) { height = 0; }
}
- return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
+ return new Size2D(OnSize2DChanged, width, height);
}
set
{
internal static Color ValueCheck(Color color)
{
- if (color.R < 0.0f)
+ float r = color.R;
+ float g = color.G;
+ float b = color.B;
+ float a = color.A;
+
+ if (r < 0.0f)
{
- color.R = 0.0f;
+ r = 0.0f;
NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
- else if (color.R > 1.0f)
+ else if (r > 1.0f)
{
- color.R = 1.0f;
+ r = 1.0f;
NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
- if (color.G < 0.0f)
+ if (g < 0.0f)
{
- color.G = 0.0f;
+ g = 0.0f;
NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
- else if (color.G > 1.0f)
+ else if (g > 1.0f)
{
- color.G = 1.0f;
+ g = 1.0f;
NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
- if (color.B < 0.0f)
+ if (b < 0.0f)
{
- color.B = 0.0f;
+ b = 0.0f;
NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
- else if (color.B > 1.0f)
+ else if (b > 1.0f)
{
- color.B = 1.0f;
+ b = 1.0f;
NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
- if (color.A < 0.0f)
+ if (a < 0.0f)
{
- color.A = 0.0f;
+ a = 0.0f;
NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
- else if (color.A > 1.0f)
+ else if (a > 1.0f)
{
- color.A = 1.0f;
+ a = 1.0f;
NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
+ color = new Color(r, g, b, a);
return color;
}
}
set
{
- if (_visualOffsetPolicy == null)
- {
- _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
- }
+ float x = 0.0f;
switch (value)
{
case VisualTransformPolicyType.Relative:
- _visualOffsetPolicy.X = 0.0f;
+ x = 0.0f;
break;
case VisualTransformPolicyType.Absolute:
- _visualOffsetPolicy.X = 1.0f;
+ x = 1.0f;
break;
default:
- _visualOffsetPolicy.X = 0.0f;
+ x = 0.0f;
break;
}
+ _visualOffsetPolicy = new Vector2(x, _visualOffsetPolicy?.Y ?? 0);
UpdateVisual();
}
}
set
{
- if (_visualOffsetPolicy == null)
- {
- _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
- }
+ float y = 0.0f;
switch (value)
{
case VisualTransformPolicyType.Relative:
- _visualOffsetPolicy.Y = 0.0f;
+ y = 0.0f;
break;
case VisualTransformPolicyType.Absolute:
- _visualOffsetPolicy.Y = 1.0f;
+ y = 1.0f;
break;
default:
- _visualOffsetPolicy.Y = 0.0f;
+ y = 0.0f;
break;
}
+ _visualOffsetPolicy = new Vector2(_visualOffsetPolicy?.X ?? 0, y);
UpdateVisual();
}
}
}
set
{
- if (_visualSizePolicy == null)
- {
- _visualSizePolicy = new Vector2(0.0f, 0.0f);
- }
-
+ float width = 0.0f;
switch (value)
{
case VisualTransformPolicyType.Relative:
- _visualSizePolicy.Width = 0.0f;
+ width = 0.0f;
break;
case VisualTransformPolicyType.Absolute:
- _visualSizePolicy.Width = 1.0f;
+ width = 1.0f;
break;
default:
- _visualSizePolicy.Width = 0.0f;
+ width = 0.0f;
break;
}
+
+ _visualSizePolicy = new Vector2(width, _visualSizePolicy?.Height ?? 0);
UpdateVisual();
}
}
}
set
{
- if (_visualSizePolicy == null)
- {
- _visualSizePolicy = new Vector2(0.0f, 0.0f);
- }
+ float height = 0.0f;
switch (value)
{
case VisualTransformPolicyType.Relative:
- _visualSizePolicy.Height = 0.0f;
+ height = 0.0f;
break;
case VisualTransformPolicyType.Absolute:
- _visualSizePolicy.Height = 1.0f;
+ height = 1.0f;
break;
default:
- _visualSizePolicy.Height = 0.0f;
+ height = 0.0f;
break;
}
+ _visualSizePolicy = new Vector2(_visualSizePolicy?.Width ?? 0, height);
UpdateVisual();
}
}