Exemplo n.º 1
0
        //TODO: This
        protected void GenerateViewsRecursively(FigmaNode currentNode, ViewNode parent, ViewRenderServiceOptions options)
        {
            Console.WriteLine("[{0}.{1}] Processing {2}..", currentNode?.id, currentNode?.name, currentNode?.GetType());

            //if (currentNode.name.StartsWith ("#") || currentNode.name.StartsWith ("//")) {
            //    Console.WriteLine ("[{0}.{1}] Detected skipped flag in name.. Skipping...", currentNode?.id, currentNode?.name, currentNode?.GetType ());
            //    return;
            //}

            if (SkipsNode(currentNode, parent, options))
            {
                return;
            }

            var converter = GetConverter(currentNode);

            ViewNode currentProcessedNode = null;

            if (converter != null)
            {
                var currentView = options.IsToViewProcessed ? converter.ConvertToView(currentNode, parent, this) : null;
                currentProcessedNode = new ViewNode(currentNode, currentView, parent);
                NodesProcessed.Add(currentProcessedNode);
            }
            else
            {
                Console.WriteLine("[{1}.{2}] There is no Converter for this type: {0}", currentNode.GetType(), currentNode.id, currentNode.name);
            }

            if (NodeScansChildren(currentNode, converter, options))
            {
                foreach (var item in GetCurrentChildren(currentNode, parent?.Node, converter, options))
                {
                    GenerateViewsRecursively(item, currentProcessedNode ?? parent, options);
                }
            }
        }
Exemplo n.º 2
0
 protected virtual bool RendersConstraints(ViewNode currentNode, ViewNode parent, RenderService rendererService)
 {
     return(!((currentNode != null && firstNode == currentNode.Node) || (currentNode.Node is FigmaCanvas || currentNode.Node.Parent is FigmaCanvas)));
 }
Exemplo n.º 3
0
 protected virtual bool RendersSize(ViewNode currentNode, ViewNode parent, RenderService rendererService)
 {
     return(true);
 }
Exemplo n.º 4
0
 public ViewNode(FigmaNode figmaNode, IView view, ViewNode parentView = null) : base(figmaNode)
 {
     View       = view;
     ParentView = parentView;
 }