Esempio n. 1
0
        public void UpdateUI(Lambda coordinate, CoordinateUI.LayoutInfo layoutInfo, Vector3 direction, float padding,
                             float gap,
                             CoordinateUIStyle.LambdaUIStyle style, bool showGridLine)
        {
            var state = coordinate.IsCurrentlyDrawn ? SketchStyle.State.Drawing : SketchStyle.State.Default;

            //todo: set style in initialize method
            _coordinate = coordinate;
            var labelString = "1 / 2"; // coordinate.Parameter.ToString("F");

            gameObject.name = $"Mue2D:{labelString}";

            var offset = layoutInfo.OrthogonalDirection * (layoutInfo.OrthogonalAnchor + layoutInfo.Index * gap - padding);
            var coordinateUIPositionWorld = direction * coordinate.Value + offset;

            var parent0CoordinateUIPositionWorld = direction * coordinate.ParentValue + offset;
            var parent1CoordinateUIPositionWorld = direction * coordinate.SecondaryParentValue + offset;
            var labelPosition = coordinateUIPositionWorld;

            _gridLineUI.UpdateUI(coordinateUIPositionWorld, layoutInfo.OrthogonalDirection, style.GridLineStyle, showGridLine);
            var directionWorld = parent1CoordinateUIPositionWorld - parent0CoordinateUIPositionWorld;

            _coordinateGizmoUI.UpdateUI(coordinateUIPositionWorld, directionWorld, style.CoordinateGizmoStyle, style.Colors,
                                        state, CoordinateGizmoUI.Type.Mark);
            _parent0GizmoUI.UpdateUI(parent0CoordinateUIPositionWorld, directionWorld, style.CoordinateGizmoStyle,
                                     style.Colors, state, CoordinateGizmoUI.Type.Circle);
            _parent1GizmoUI.UpdateUI(parent1CoordinateUIPositionWorld, directionWorld, style.CoordinateGizmoStyle,
                                     style.Colors, state, CoordinateGizmoUI.Type.Circle);
            _coordinateDimensionLineUI.UpdateUI(parent0CoordinateUIPositionWorld, parent1CoordinateUIPositionWorld,
                                                style.DimensionLineStyle, style.Colors, state);
            _coordinateLabelUI.UpdateUI(labelString, labelPosition, style.LabelStyle, style.Colors, state);
        }
Esempio n. 2
0
        public void UpdateUI(Origin coordinate, CoordinateUI.LayoutInfo layoutInfo, Vector3 direction, float padding,
                             float gap,
                             CoordinateUIStyle.OriginUIStyle style, bool showGridLine)
        {
            var state = SketchStyle.State.Default;

            _coordinate = coordinate;
            var labelString = coordinate.Parameter.Value.ToString("F");

            gameObject.name = $"Origin:{labelString}";

            var offset = layoutInfo.OrthogonalDirection * (layoutInfo.OrthogonalAnchor + layoutInfo.Index * gap - padding);
            var coordinateUIPositionWorld = direction * coordinate.Value + offset;

            _gridLineUI.UpdateUI(coordinateUIPositionWorld, layoutInfo.OrthogonalDirection, style.GridLineStyle, showGridLine);
            _coordinateGizmoUI.UpdateUI(coordinateUIPositionWorld, direction, style.CoordinateGizmoStyle, style.Colors,
                                        state, CoordinateGizmoUI.Type.Mark);
        }
Esempio n. 3
0
        public void UpdateUI(
            Mue coordinate,
            CoordinateUI.LayoutInfo layoutInfo,
            Vector3 direction,
            float padding,
            float gap,
            CoordinateUIStyle.MueUIStyle style,
            bool hasKeyboardInputSelection,
            bool isReferencesByOtherParameter,
            Coordinate draggedCoordinate, bool showGridLine
            )
        {
            SketchStyle.State state;

            if (coordinate.IsCurrentlyDrawn && hasKeyboardInputSelection || draggedCoordinate == coordinate)
            {
                state = SketchStyle.State.DraggedOrExplicitInput;
            }
            else if (isReferencesByOtherParameter || draggedCoordinate?.Parameter == coordinate.Parameter)
            {
                state = SketchStyle.State.HasParameterReference;
            }
            else if (coordinate.IsCurrentlyDrawn && !hasKeyboardInputSelection)
            {
                state = SketchStyle.State.Drawing;
            }
            else if (draggedCoordinate != null)
            {
                state = SketchStyle.State.OtherIsDragged;
            }
            else
            {
                state = SketchStyle.State.Default;
            }

            _coordinate = coordinate;
            var labelString = coordinate.Parameter.Value.ToString("F");

            gameObject.name = $"Mue2D:{labelString}";

            var offset = layoutInfo.OrthogonalDirection * (layoutInfo.OrthogonalAnchor + layoutInfo.Index * gap - padding);
            var coordinateUIPositionWorld       = direction * coordinate.Value + offset;
            var parentCoordinateUIPositionWorld = direction * coordinate.ParentValue + offset;
            var directionWorld = coordinateUIPositionWorld - parentCoordinateUIPositionWorld;
            var labelPosition  = (coordinateUIPositionWorld + parentCoordinateUIPositionWorld) * 0.5f;

            _gridLineUI.UpdateUI(coordinateUIPositionWorld, layoutInfo.OrthogonalDirection, style.GridLineStyle, showGridLine);

            _targetGizmo.UpdateUI(coordinateUIPositionWorld, directionWorld, style.CoordinateGizmoStyle, style.Colors,
                                  state,
                                  CoordinateGizmoUI.Type.Arrow);

            _parentGizmo.UpdateUI(parentCoordinateUIPositionWorld, directionWorld, style.CoordinateGizmoStyle, style.Colors,
                                  state,
                                  CoordinateGizmoUI.Type.Mark);

            _coordinateDimensionLineUI.UpdateUI(coordinateUIPositionWorld, parentCoordinateUIPositionWorld,
                                                style.DimensionLineStyle, style.Colors, state);

            _coordinateLabelUI.UpdateUI(labelString, labelPosition, style.LabelStyle, style.Colors, state);
        }