I try to plot this matrix (image) with this code but the shape of my equation has problem(second image) How I could correct it?

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{nicematrix}
\usepackage{amscd}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, matrix, quotes, positioning}
\begin{document}
\begin{equation}\label{key}
\left[ \left. \left( t_{A}\vert E_{\lambda_{i}}(A)\right)\right| X^{i}, X^{i} \right] =
\begin{tikzpicture}[LA/.style = {Straight Barb-Straight Barb,
shorten <=1pt, shorten >=1pt,
draw=blue}
]
\matrix (m) [matrix of math nodes,
left delimiter={[},
right delimiter={]}
]
{
\lambda_{i}&&0&\\
&\lambda_{i} &&\\
0 && \ddots &\\
&&& \lambda_{i}\\
};
%\draw (m-1-3.north east) -- (m-5-3.south east);
%\draw (m-4-1.north west) -- (m-4-5.north east);
%
\draw[LA] (m-3-1.south west |- m.south) to [" $d_{i}$ " '] (m-4-4.south east |- m.south);
%\draw[LA] (m-5-4.south west |- m.south) to ["2" '] (m-5-5.south east |- m.south);
%
\coordinate[right=5mm of m.east] (e);
\draw[LA] (m-1-3.north east -| e) to [" $d_{i}$ "] (m-4-4.south east -| e);
%\draw[LA] (m-4-5.north east -| e) to ["2"] (m-5-5.south east -| e);
\end{tikzpicture}
\end{equation}
\end{document}




baselinetotikzpictureoptions:\begin{tikzpicture}[baseline, ...]– Zarko Jan 04 '21 at 17:32