/// <summary> /// Update orientation of tick marks based on slider axis orientation /// </summary> private void UpdateTickMarks() { if (TickMarks) { TickMarks.transform.localPosition = Vector3.zero; TickMarks.transform.localRotation = Quaternion.identity; var grid = TickMarks.GetComponent <Utilities.GridObjectCollection>(); if (grid) { // Update cellwidth or cellheight depending on what was the previous axis set to var previousAxis = grid.Layout; if (previousAxis == Utilities.LayoutOrder.Vertical) { grid.CellWidth = grid.CellHeight; } else { grid.CellHeight = grid.CellWidth; } grid.Layout = (sliderAxis == SliderAxis.YAxis) ? Utilities.LayoutOrder.Vertical : Utilities.LayoutOrder.Horizontal; grid.UpdateCollection(); } if (sliderAxis == SliderAxis.ZAxis) { TickMarks.transform.localRotation = Quaternion.Euler(0.0f, 90.0f, 0.0f); } } }
private void BuildTickMarks() { double tickSize = 10; double tickXPos = ComputeTickXPos(1, tickSize); double tickYPos = ComputeTickYPos(1, tickSize); double tickRayAngle = ComputeRayAngle(1) * (180.0 / Math.PI); double tickLabelPadding = 25; CircleTickMarkViewModel startTick = new CircleTickMarkViewModel(tickXPos, tickYPos, 1, tickSize); CircleTickLabelViewModel startTickLabel = new CircleTickLabelViewModel(tickXPos, tickYPos, tickLabelPadding, tickRayAngle, 1); TickMarks.Add(startTick); TickLabels.Add(startTickLabel); int tickIncrement = ComputeTickIncrement(); int currentTickIndex = tickIncrement; do { tickXPos = ComputeTickXPos(currentTickIndex, tickSize); tickYPos = ComputeTickYPos(currentTickIndex, tickSize); tickRayAngle = ComputeRayAngle(currentTickIndex) * (180.0 / Math.PI); CircleTickMarkViewModel tick = new CircleTickMarkViewModel(tickXPos, tickYPos, currentTickIndex, 10); CircleTickLabelViewModel label = new CircleTickLabelViewModel(tickXPos, tickYPos, tickLabelPadding, tickRayAngle, currentTickIndex); TickMarks.Add(tick); TickLabels.Add(label); currentTickIndex += tickIncrement; } while (currentTickIndex <= _sequence.RawData.Count); }