Exemplo n.º 1
0
        public VDPointThumb(Token token, string x, string y, Action update, bool notBound = false)
        {
            Token     = token;
            PropertyX = token.GetType().GetProperty(x);
            PropertyY = token.GetType().GetProperty(y);
            NotBound  = notBound;

            X = (double)PropertyX.GetValue(token);
            Y = (double)PropertyY.GetValue(token);

            DragDelta += OnDrag;

            if (update != null)
            {
                Updated += update;
            }
        }
Exemplo n.º 2
0
        private void Update(double h, double v)
        {
            double dX = (double)PropertyX.GetValue(Token) + h;
            double dY = (double)PropertyY.GetValue(Token) + v;

            if (0.0 <= dX && dX <= Bounds.Width || NotBound)
            {
                X = dX;
            }
            if (0.0 <= dY && dY <= Bounds.Height || NotBound)
            {
                Y = dY;
            }

            PropertyX.SetValue(Token, X);
            PropertyY.SetValue(Token, Y);

            Updated?.Invoke();
        }