internal override bool HasHeightConstraint(FigmaNode currentNode, NodeConverter converter) { if (currentNode.TryGetAttributeValue(HasHeightConstraintParameter, out var value)) { if (value == "true") { return(true); } if (value == "false") { return(false); } } return(base.HasHeightConstraint(currentNode, converter)); }
internal virtual bool HasConstraints(FigmaNode currentNode, NodeConverter converter) { if (currentNode.TryGetAttributeValue(HasConstraintsParameter, out var value)) { if (value == "true") { return(true); } if (value == "false") { return(false); } } return(true); }
internal static bool IsThemedImageViewNode(this FigmaNode node, out CocoaThemes theme) { if (node.Parent != null && node.Parent.HasNodeImageName()) { if (node.TryGetAttributeValue(themeNodeName, out var value)) { if (Enum.TryParse(value, true, out theme)) { return(true); } } } theme = default; return(false); }
public void ConfigureProperty(string propertyName, FigmaNode node, IView view) { var frame = (FigmaFrame)node; var stackView = (NSStackView)view.NativeObject; if (!node.visible) { stackView.Hidden = true; } if (propertyName == Properties.EdgeInsets) { stackView.EdgeInsets = new NSEdgeInsets( top: frame.verticalPadding, left: frame.horizontalPadding, bottom: frame.verticalPadding, right: frame.horizontalPadding ); return; } if (propertyName == Properties.Spacing) { stackView.Spacing = frame.itemSpacing; return; } if (propertyName == Properties.Orientation) { stackView.Orientation = frame.LayoutMode == FigmaLayoutMode.Horizontal ? NSUserInterfaceLayoutOrientation.Horizontal : NSUserInterfaceLayoutOrientation.Vertical; return; } if (propertyName == Properties.Distribution) { node.TryGetAttributeValue(DistributionPropertyName, out var value); NSStackViewDistribution distribution = NSStackViewDistribution.Fill; if (!string.IsNullOrEmpty(value)) { Enum.TryParse(value.ToCamelCase(), out distribution); } stackView.Distribution = distribution; return; } }
internal static bool HasThemedTitle(this FigmaNode node) => node.TryGetAttributeValue(themeNodeName, out _);