public void OnGUI(Rect drawRect)
        {
            m_unscaledRect = drawRect;

//            HandleEvents (Event.current);

            OnBeforeCanvasGUI();
            onBeforeCanvasGUI?.Invoke();

            m_scaledRect = GUIScaler.BeginScaleArea(m_unscaledRect, m_offset, m_zoom, window);
            OnCanvasGUI();
            onCanvasGUI?.Invoke();
            GUIScaler.EndScaleArea();

            OnAfterCanvasGUI();
            onAfterCanvasGUI?.Invoke();

            HandleEvents(Event.current);
        }
 /// <summary>
 /// Transforms position from canvas space into screen space.
 /// </summary>
 public Vector2 CanvasToScreenPoint(Vector2 canvasPoint)
 {
     return(GUIScaler.ScaledToUnscaledPoint(canvasPoint, m_scaledRect, m_offset, m_zoom, window));
 }
 /// <summary>
 /// Transforms position from screen space into canvas space.
 /// </summary>
 public Vector2 ScreenToCanvasPoint(Vector2 screenPoint)
 {
     return(GUIScaler.UnscaledToScaledPoint(screenPoint, m_unscaledRect, m_offset, m_zoom));
 }