/*--------------------------------------------------------------------------------------------*/ public virtual Vector3 GetNearestWorldPosition(Ray pFromWorldRay, out RaycastResult pRaycast) { if (ButtonRenderer != null) { return(ButtonRenderer.GetNearestWorldPosition(pFromWorldRay, out pRaycast)); } if (SliderRenderer != null) { return(SliderRenderer.GetNearestWorldPosition(pFromWorldRay, out pRaycast)); } throw new Exception("No button or slider renderer."); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public virtual Vector3 GetNearestWorldPosition(Vector3 pFromWorldPosition) { if (ButtonRenderer != null) { return(ButtonRenderer.GetNearestWorldPosition(pFromWorldPosition)); } if (SliderRenderer != null) { return(SliderRenderer.GetNearestWorldPosition(pFromWorldPosition)); } throw new Exception("No button or slider renderer."); }
/*--------------------------------------------------------------------------------------------*/ private void UpdateSliderSettings(HoverItem pHoverItem, HoverItemHighlightState pHighState) { HoverItemDataSlider data = (HoverItemDataSlider)pHoverItem.Data; HoverItemHighlightState.Highlight?high = pHighState.NearestHighlight; float highProg = pHighState.MaxHighlightProgress; bool isNearest = pHighState.IsNearestAcrossAllItemsForAnyCursor; SliderRenderer.Controllers.Set(HoverRendererSlider.JumpValueName, this); SliderRenderer.Controllers.Set(HoverRendererSlider.ShowButtonEdgesName, this); SliderRenderer.ShowButtonEdges = (isNearest && highProg > 0); if (high == null || highProg <= 0 || !isNearest) { data.HoverValue = null; SliderRenderer.JumpValue = -1; return; } float value = SliderRenderer.GetValueViaNearestWorldPosition(high.Value.NearestWorldPos); data.HoverValue = value; float snapValue = (float)data.SnappedHoverValue; //float easePower = (1-high.Value.Progress)*5+1; //gets "snappier" as you pull away float showValue = DisplayUtil.GetEasedValue(data.Snaps, value, snapValue, 3); SliderRenderer.JumpValue = showValue; if (data.IsStickySelected) { data.Value = value; SliderRenderer.Controllers.Set(HoverRendererSlider.HandleValueName, this); SliderRenderer.HandleValue = showValue; } }
/// <summary> /// Renders the supplied Slider_t as XAML. /// </summary> /// <param name="control">Slider_t to render.</param> public void Visit(Slider_t control) { SliderRenderer.Render(_writer, control); }