예제 #1
0
        protected override IView OnConvertToView(FigmaNode currentNode, ViewNode parentNode, ViewRenderService rendererService)
        {
            var colorWell = new NSColorWell()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            var frame = (FigmaFrame)currentNode;

            FigmaVector rectangle = frame.children
                                    .OfType <FigmaVector>()
                                    .FirstOrDefault(s => s.name == ComponentString.VALUE);

            foreach (var styleMap in rectangle?.styles)
            {
                if (rendererService.NodeProvider.TryGetStyle(styleMap.Value, out FigmaStyle style))
                {
                    if (styleMap.Key == "fill")
                    {
                        colorWell.Color = ColorService.GetNSColor(style.name);
                    }
                }
            }

            return(new View(colorWell));
        }
예제 #2
0
        void ReleaseDesignerOutlets()
        {
            if (colorWell != null) {
                colorWell.Dispose ();
                colorWell = null;
            }

            if (checkBox != null) {
                checkBox.Dispose ();
                checkBox = null;
            }
        }
예제 #3
0
        protected override IView OnConvertToView(FigmaNode currentNode, ProcessedNode parentNode, FigmaRendererService rendererService)
        {
            var colorWell = new NSColorWell();
            var frame     = (FigmaFrame)currentNode;

            FigmaVectorEntity rectangle = frame.children
                                          .OfType <FigmaVectorEntity>()
                                          .FirstOrDefault(s => s.name == ComponentString.VALUE);

            foreach (var styleMap in rectangle?.styles)
            {
                if (rendererService.FileProvider.TryGetStyle(styleMap.Value, out FigmaStyle style))
                {
                    if (styleMap.Key == "fill")
                    {
                        colorWell.Color = CocoaHelpers.GetNSColor(style.name);
                    }
                }
            }

            return(new View(colorWell));
        }
예제 #4
0
 /// <summary>
 /// The user chose a different text color from the "Text Color" color well
 /// </summary>
 /// <param name="sender">
 /// A <see cref="NSColorWell"/>
 /// </param>
 partial void setTextColor(NSColorWell sender)
 {
     datePickerControl.TextColor = sender.Color;
 }
예제 #5
0
 /// <summary>
 /// The user chose a different background color from the "Back Color" color well
 /// </summary>
 /// <param name="sender">
 /// A <see cref="NSColorWell"/>
 /// </param>
 partial void setBackgroundColor(NSColorWell sender)
 {
     datePickerControl.BackgroundColor = sender.Color;
 }
예제 #6
0
 /// <summary>
 /// The user chose a different text color from the "Text Color" color well
 /// </summary>
 /// <param name="sender">
 /// A <see cref="NSColorWell"/>
 /// </param>
 partial void setTextColor (NSColorWell sender)
 {
         datePickerControl.TextColor = sender.Color;
 }
예제 #7
0
 /// <summary>
 /// The user chose a different background color from the "Back Color" color well
 /// </summary>
 /// <param name="sender">
 /// A <see cref="NSColorWell"/>
 /// </param>
 partial void setBackgroundColor (NSColorWell sender)
 {
         datePickerControl.BackgroundColor = sender.Color;
 }
예제 #8
0
 public void TakeSelectionColorFrom(NSColorWell sender)
 {
     this.SelectionMarker.setColor(sender.Color);
     this.NeedsDisplay = true;
 }