Ejemplo n.º 1
0
        public void UpdateEditBoxShape()
        {
            this.Visibility = System.Windows.Visibility.Visible;
            var rect = GetBoundingBox();

            MinU        = rect.Left;
            MaxU        = rect.Right;
            MinV        = rect.Bottom;
            MaxV        = rect.Top;
            this.Height = Math.Abs(CurveEditor.vToY(MaxV) - CurveEditor.vToY(MinV));
            this.Width  = Math.Abs(CurveEditor.UToX(MaxU) - CurveEditor.UToX(MinU));
            App.Current.UpdateRequiredAfterUserInteraction = true;
            XMinULabel.Text = String.Format("{0:F3}", MinU);
            XMaxULabel.Text = String.Format("{0:F3}", MaxU);
            XMinVLabel.Text = String.Format("{0:F3}", MaxV);
            XMaxVLabel.Text = String.Format("{0:F3}", MinV);

            XDragHandle.Visibility = m_SelectionHandler.SelectedElements.Count == 1
                ? System.Windows.Visibility.Collapsed
                : System.Windows.Visibility.Visible;

            XMinULabel.Visibility = (MinU == MaxU)
                ? System.Windows.Visibility.Collapsed
                : System.Windows.Visibility.Visible;

            XMaxVLabel.Visibility = (MinV == MaxV)
                ? System.Windows.Visibility.Collapsed
                : System.Windows.Visibility.Visible;
        }
Ejemplo n.º 2
0
        /**
         * This function updates the TangetOrientation after changing the scale of the CurveEditor
         */
        public void UpdateControlTangents()
        {
            if (CurveEditor == null)
            {
                return;
            }

            var normVector           = new Vector(-Math.Cos(m_vdef.InTangentAngle), Math.Sin(m_vdef.InTangentAngle));
            var scaleCorrectedVector = LimitWeightTanget(new Vector(normVector.X * CurveEditor.UScale, CurveEditor.vToY(0) - CurveEditor.vToY(normVector.Y)));

            LeftTangentPosition = new Point(scaleCorrectedVector.X, scaleCorrectedVector.Y);

            normVector           = new Vector(-Math.Cos(m_vdef.OutTangentAngle), Math.Sin(m_vdef.OutTangentAngle));
            scaleCorrectedVector = LimitWeightTanget(new Vector(normVector.X * CurveEditor.UScale, CurveEditor.vToY(0) - CurveEditor.vToY(normVector.Y)));
            RightTangentPosition = new Point(scaleCorrectedVector.X, scaleCorrectedVector.Y);

            LeftInterpolationType  = m_vdef.InEditMode;
            RightInterpolationType = m_vdef.OutEditMode;
        }