示例#1
0
        public void MouseZoomRect(float mouseNowX, float mouseNowY, bool finalize = false)
        {
            float left   = Math.Min(MouseDownX, mouseNowX);
            float right  = Math.Max(MouseDownX, mouseNowX);
            float top    = Math.Min(MouseDownY, mouseNowY);
            float bottom = Math.Max(MouseDownY, mouseNowY);
            float width  = right - left;
            float height = bottom - top;

            if (finalize)
            {
                double x1 = XAxis.Dims.GetUnit(left);
                double x2 = XAxis.Dims.GetUnit(right);
                double y1 = YAxis.Dims.GetUnit(bottom);
                double y2 = YAxis.Dims.GetUnit(top);
                ZoomRectangle.Clear();
                AxisSet(x1, x2, y1, y2);
            }
            else
            {
                // TODO: dont require data offset shifting prior to calling this
                ZoomRectangle.Set(left - DataOffsetX, top - DataOffsetY, width, height);
            }
        }