示例#1
0
        public GizmoPlaneSlider2D(Gizmo gizmo, int handleId)
            : base(gizmo, handleId)
        {
            _quadIndex    = Handle.Add2DShape(_quad);
            _circleIndex  = Handle.Add2DShape(_circle);
            _polygonIndex = Handle.Add2DShape(_polygon);

            _quadBorder    = new GizmoQuad2DBorder(this, Handle, _quad);
            _circleBorder  = new GizmoCircle2DBorder(this, Handle, _circle);
            _polygonBorder = new GizmoPolygon2DBorder(this, Handle, _polygon);

            _controllerData.Gizmo         = Gizmo;
            _controllerData.Slider        = this;
            _controllerData.SliderHandle  = Handle;
            _controllerData.QuadBorder    = _quadBorder;
            _controllerData.Quad          = _quad;
            _controllerData.QuadIndex     = _quadIndex;
            _controllerData.CircleBorder  = _circleBorder;
            _controllerData.Circle        = _circle;
            _controllerData.CircleIndex   = _circleIndex;
            _controllerData.PolygonBorder = _polygonBorder;
            _controllerData.Polygon       = _polygon;
            _controllerData.PolygonIndex  = _polygonIndex;

            _controllers[(int)GizmoPlane2DType.Quad]    = new GizmoQuadPlaneSlider2DController(_controllerData);
            _controllers[(int)GizmoPlane2DType.Circle]  = new GizmoCirclePlaneSlider2DController(_controllerData);
            _controllers[(int)GizmoPlane2DType.Polygon] = new GizmoPolygonPlaneSlider2DController(_controllerData);

            _transform.Changed        += OnTransformChanged;
            Gizmo.PreUpdateBegin      += OnGizmoPreUpdateBegin;
            Gizmo.PreDragBeginAttempt += OnGizmoAttemptHandleDragBegin;
            Gizmo.PreDragUpdate       += OnGizmoHandleDragUpdate;
            Gizmo.PostEnabled         += OnGizmoPostEnabled;

            AddTargetTransform(_transform);
            AddTargetTransform(Gizmo.Transform);
            _transform.SetParent(Gizmo.Transform);
            SetDragChannel(GizmoDragChannel.Offset);
        }
        public GizmoLineSlider2D(Gizmo gizmo, int handleId, int capHandleId)
            : base(gizmo, handleId)
        {
            _segmentIndex = Handle.Add2DShape(_segment);
            _quadIndex    = Handle.Add2DShape(_quad);

            _controllerData.Gizmo        = Gizmo;
            _controllerData.Slider       = this;
            _controllerData.SliderHandle = Handle;
            _controllerData.Segment      = _segment;
            _controllerData.SegmentIndex = _segmentIndex;
            _controllerData.Quad         = _quad;
            _controllerData.QuadIndex    = _quadIndex;

            _controllers[(int)GizmoLine2DType.Thin] = new GizmoThinLineSlider2DController(_controllerData);
            _controllers[(int)GizmoLine2DType.Box]  = new GizmoBoxLineSlider2DController(_controllerData);

            _cap2D = new GizmoCap2D(gizmo, capHandleId);
            SetupSharedLookAndFeel();

            SetDragChannel(GizmoDragChannel.Offset);
            AddTargetTransform(Gizmo.Transform);
            AddTargetTransform(_transform);
            _cap2D.RegisterTransformAsDragTarget(_offsetDrag);
            _cap2D.RegisterTransformAsDragTarget(_rotationDrag);

            _transform.Changed += OnTransformChanged;
            _transform.SetParent(gizmo.Transform);

            Gizmo.PreUpdateBegin      += OnGizmoPreUpdateBegin;
            Gizmo.PreDragUpdate       += OnGizmoHandleDragUpdate;
            Gizmo.PreDragBeginAttempt += OnGizmoAttemptHandleDragBegin;
            Gizmo.PreHoverEnter       += OnGizmoHandleHoverEnter;
            Gizmo.PreHoverExit        += OnGizmoHandleHoverExit;
            Gizmo.PostEnabled         += OnGizmoPostEnabled;
        }