Exemplo n.º 1
0
        /// <summary>Recalculates the tab size of a scroll bar.</summary>
        public virtual void RecalculateTab()
        {
            if (ScrollTab == null)
            {
                if (Element.childNodes.Count > 1)
                {
                    Element scrollTab = Element.childNodes[1];

                    if (scrollTab != null)
                    {
                        ScrollTab = ((ScrollTabTag)scrollTab.Handler);
                    }
                }
            }

            if (ScrollTab != null)
            {
                Element target = GetTarget();
                if (target == null)
                {
                    return;
                }
                ComputedStyle computed = target.style.Computed;

                bool         useX         = ScrollTab.UseX();
                OverflowType overflowMode = useX?computed.OverflowX : computed.OverflowY;
                float        visible      = useX?computed.VisiblePercentageX() : computed.VisiblePercentageY();

                if (visible > 1f)
                {
                    visible = 1f;
                }
                else if (visible < 0f)
                {
                    visible = 0f;
                }

                if (overflowMode == OverflowType.Auto)
                {
                    // Handle AUTO here.
                    // Hide the bar by directly setting it's display style if the whole thing is visible - i.e. visible = 1(00%).
                    ComputedStyle barStyle = Element.Style.Computed;
                    if (visible == 1f)
                    {
                        barStyle.DisplayNone();
                    }
                    else if (barStyle.Display == DisplayType.None)
                    {
                        // Make it visible again:
                        barStyle.Display = DisplayType.InlineBlock;
                    }
                }
                ScrollTab.ApplyTabSize(visible);
            }
        }
Exemplo n.º 2
0
		/// <summary>Recalculates the tab size of a scroll bar.</summary>
		public virtual void RecalculateTab(){
			if(ScrollTab==null){
				if(Element.childNodes.Count>1){
					Element scrollTab=Element.childNodes[1];
					
					if(scrollTab!=null){
						ScrollTab=((ScrollTabTag)scrollTab.Handler);
					}
				}
			}
			
			if(ScrollTab!=null){
				
				Element target=GetTarget();
				if(target==null){
					return;
				}
				ComputedStyle computed=target.style.Computed;
				
				bool useX=ScrollTab.UseX();
				OverflowType overflowMode=useX?computed.OverflowX : computed.OverflowY;
				float visible=useX?computed.VisiblePercentageX() : computed.VisiblePercentageY();
				
				if(visible>1f){
					visible=1f;
				}else if(visible<0f){
					visible=0f;
				}
				
				if(overflowMode==OverflowType.Auto){
					// Handle AUTO here.
					// Hide the bar by directly setting it's display style if the whole thing is visible - i.e. visible = 1(00%).
					ComputedStyle barStyle=Element.Style.Computed;
					if(visible==1f){
						barStyle.DisplayNone();
					}else if(barStyle.Display==DisplayType.None){
						// Make it visible again:
						barStyle.Display=DisplayType.InlineBlock;
					}
					
				}
				ScrollTab.ApplyTabSize(visible);
			}
		}