Custom buttons on hover on a dynamic macro using confluence connect

Hi, I have seen several apps like or Gliffy where there are buttons that appear when hovering on the preview of the diagram. How can I achieve that, and how can I add custom buttons?
I am using Atlassian Connect and this is a macro for confluence.