I'm trying to have the button follow the mouse while within the output text cell. The scaling does not exactly work as intended (fails to follow mouse correctly).
Dynamic[Overlay[{txtO,
Button[Style["Button", Blue, Italic, 15], Print[1]]}, All, 2,
Alignment ->
Rescale[MousePosition["CellContentsScaled", {0, 0}], {0, 1}, {-1,
1}]]]
Additionally, how would I make the button 1) Snap to 0,0 when the mouse is not over the output text cell anymore; and 2) disappear completely when not within the boundaries of the text cell.
The Rescale for {0,1} -> {-1,1} helped a little, but it seems I am not using CellContentsScaled correctly, as the documentation says it should range from 0 to 1 over the cell only (occasional negative numbers pop up, and values are present with the mouse outside the cell)