1
$\begingroup$

I would like to change colour of the FilledCurve and display little table when mouse pointer goes over the area between curves. My code is shown below

pts = {{0, 1}, {-1, -(1/2)}, {1, -(1/2)}};
table = Grid[{{a, b, c}, {x, y^2, z^3}}, Frame -> All];

Tooltip[Mouseover @@ (Graphics[{#, 
   FilledCurve[{{Line[2 pts]}, {Line[pts]}}]}] & /@ {Red, 
 Green}), table]

The problem is that the colour should change only if the mouse pointer lies in the red region (region between curves) of the graphic object, but right now the colour changes and table display even if mouse is in the white region outside the curves. I will be grateful for any help.

$\endgroup$
1
$\begingroup$
pts = {{0, 1}, {-1, -(1/2)}, {1, -(1/2)}};
table = Grid[{{a, b, c}, {x, y^2, z^3}}, Frame -> All];

With[
 {fc = FilledCurve[{{Line[2 pts]}, {Line[pts]}}]},
 Graphics[Mouseover[{Red, fc}, Tooltip[{Green, fc}, table]]]]
$\endgroup$
  • $\begingroup$ This is exactly what I was looking for. Thank you! $\endgroup$ – Moonwalk Nov 10 '18 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.