示例#1
0
 internal void EnsureInlineStyles()
 {
     if (this.m_Styles.isShared)
     {
         this.m_Styles = new VisualElementStyles(this.m_Styles, false);
     }
 }
示例#2
0
        public void AdjustDragElement(float factor)
        {
            Rect position;

            if (factor >= 1f)
            {
                if (this.direction == Slider.Direction.Horizontal)
                {
                    position = new Rect(this.dragElement.position.x, this.dragElement.position.y, 0f, this.dragElement.height);
                }
                else
                {
                    position = new Rect(this.dragElement.position.x, this.dragElement.position.y, this.dragElement.width, 0f);
                }
            }
            else
            {
                VisualElementStyles styles = this.dragElement.styles;
                position = this.dragElement.position;
                if (this.direction == Slider.Direction.Horizontal)
                {
                    float specifiedValueOrDefault = styles.minWidth.GetSpecifiedValueOrDefault(0f);
                    position.width = Mathf.Max(base.position.width * factor, specifiedValueOrDefault);
                }
                else
                {
                    float specifiedValueOrDefault2 = styles.minHeight.GetSpecifiedValueOrDefault(0f);
                    position.height = Mathf.Max(base.position.height * factor, specifiedValueOrDefault2);
                }
            }
            this.dragElement.position = position;
        }
示例#3
0
        private void RenderElement(VisualElement element, RendererContext context)
        {
            VisualElementStyles styles = element.Styles;

            if (styles == null)
            {
                return;
            }

            styles.Background?.Render(element, context);
            styles.Border?.Render(element, context);
        }
示例#4
0
 internal void SetSharedStyles(VisualElementStyles styles)
 {
     Debug.Assert(styles.isShared);
     this.ClearDirty(ChangeType.Styles | ChangeType.StylesPath);
     if (styles != this.m_Styles)
     {
         if (!this.m_Styles.isShared)
         {
             this.m_Styles.Apply(styles, StylePropertyApplyMode.CopyIfNotInline);
         }
         else
         {
             this.m_Styles = styles;
         }
         if (this.onStylesResolved != null)
         {
             this.onStylesResolved(this.m_Styles);
         }
         this.OnStylesResolved(this.m_Styles);
         this.Dirty(ChangeType.Repaint);
     }
 }