private void OnSceneGUI(SceneView sceneView) // нажатия на кнопки мыши { CheckSelectedElements(); DrawNodes(/*highlightHovered: true*/); DrawPolyLine(highlightHovered: selectedNodeIndex == -1);// подсвечиваем выбранную линию если нет выбранной ручки Event currentEvent = Event.current; if (selectedLineIndex != -1) { HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive)); if (currentEvent.type == EventType.MouseDown) { if (currentEvent.button == 0 && currentEvent.clickCount == 2) { Vector2 mousePos = HandleUtility.GUIPointToWorldRay(currentEvent.mousePosition).origin; Undo.RecordObject(path, "Insert new node"); polyLine.InsertNode(selectedLineIndex + 1, mousePos); UpdatePath(); } } } if (selectedNodeIndex != -1) { HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive)); if (currentEvent.type == EventType.MouseDown) { if (currentEvent.button == 1 && currentEvent.clickCount == 2 && polyLine.NodesCount > 2) { Undo.RecordObject(path, "Remove node"); polyLine.RemoveNode(selectedNodeIndex); UpdatePath(); //SceneView.RepaintAll(); } } } }