private static void GraphCanvas_PointerWheelChanged(object?sender, PointerWheelEventArgs e) { Zoom = Math.Min(Math.Max(Zoom * (1 - 0.1 * e.Delta.Y), 0.001), 200); TheMainWindow.FindControl <TextBlock>("tbInfo").Text = "Zoom: " + Math.Round(Zoom, 3).ToString(); UpdateCanvas(true); }
//Изменение отображаемого значения графика функции в зависимости от позиции мыши private static void GraphCanvas_PointerMoved(object?sender, PointerEventArgs e) { if (!mousePressed && expression != null) { TextBlock tbXCoord = TheMainWindow.FindControl <TextBlock>("tbXCoord"); TextBlock tbYCoord = TheMainWindow.FindControl <TextBlock>("tbYCoord"); var canvas = (Canvas)sender; double x = (e.GetPosition(canvas).X - GraphWidth / 2 - Offset.X) * Zoom; double y = rpn.GetNewRpnWithSetVariable(x).Calculate(); tbXCoord.Text = "x: " + Math.Round(x, 2).ToString(); tbYCoord.Text = "f(x): " + Math.Round(y, 2).ToString(); } }