# TikZ “containing square” computation problem for a path (application: pdftooltips) [duplicate]

The "pdftooltip" command from the pdfcomment package requires rectangular trigger regions. This is problematic when annotating figures. Take for example:

\documentclass{article}
\usepackage{tikz}
\usepackage{pdfcomment}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}

\draw[fill=green] (0,0) -- (3,0) -- (1.5,3) -- cycle
let
\p1 = (current path bounding box.south west),
\p2 = (current path bounding box.north east)
innode at (current path bounding box)
{\pdftooltip{\rule{\dimexpr\x2-\x1\relax}{0pt}\rule{0pt}{\dimexpr\y2-\y1\relax}}%
{Green}};

\draw[fill=blue] (3,0) -- (1.5,3) -- (3,3) -- cycle
let
\p1 = (current path bounding box.south west),
\p2 = (current path bounding box.north east)
innode at (current path bounding box)
{\pdftooltip{\rule{\dimexpr\x2-\x1\relax}{0pt}\rule{0pt}{\dimexpr\y2-\y1\relax}}%
{Blue}};

\end{tikzpicture}
\end{document}


As the example describes two triangles, the tooltips overlap. This can lead to the situation that the user hovers over a triangle and gets the tooltip for the other triangle:

How can I use TikZ to compute something like an inner box for the current path and restrict the tooltip to be shown only when hovering over this inner box.

For example, computing the largest squares that still fit into the triangles and displaying the tooltips only when hovering over these squares would be suitable. In this way, all tooltips shown in Acrobat Reader at runtime are correct, and a good part of the triangles act as trigger regions to the tooltips.

The motivation for adding tooltips to figures is to enrich them in the PDFs with seldomly needed additional information that the reader can retrieve by hovering over the respective part of the figure (e.g., where the data points that are represented by the filled path actually come from when merging multiple data sets into a single figure).