Example #1
0
        //
        // X viewport
        //
        public int X_viewport(string X_string, int v_left, int v_width)
        {
            var X   = ConvertValue(X_string);
            var sub = Calc.Subtract(X, Min);

            //Console.Write("\n{0}: {4} + {3} * ({0} - {1}) / {2} = ", X, Min, Range, v_width, v_left);

            if (Comp.Greater(Range, ConvertValue("0")) && Comp.Not(sub, ConvertValue("0")))
            {
                // return Calc.Add(ConvertValue(v_left.ToString()),Calc.Multiply2Divide1(ConvertValue(v_width.ToString()),sub, Range));
                return(Calc.Viewport(X, Min, Range, ConvertValue(v_left.ToString()), ConvertValue(v_width.ToString())));
            }
            else
            {
                return(v_left);
            }
        }