I am creating an interactive graphics that plots points on the canvas, and allows the user to move around the points:

 {pt1 = {-2, 1}, pt2 = {2, 2}, pt3 = {2, -2}}
    Dynamic[BezierCurve[{pt1, pt2, pt3}]]
   , PlotRange -> 3]

It works fine, but I noticed that if one misses a bit the click with the mouse to move one of the points, Mathematica mistakenly suggests to edit the Graphics object. It happens during the point movement in the following screenshot (Note the tooltip "Double Click to edit"):

enter image description here

Is there any way to disable editing for Graphics?


1 Answer 1

  • Deploy seems work.
DynamicModule[{pt1 = {-2, 1}, pt2 = {2, 2}, pt3 = {2, -2}}, 
   Framed@Graphics[{Locator[Dynamic@pt1], Locator[Dynamic@pt2], 
      Locator[Dynamic@pt3], Dynamic@BezierCurve[{pt1, pt2, pt3}]}, 
     PlotRange -> 3]]
  • Another way is use LocatorPane.
DynamicModule[{pts = {{-2, 1}, {2, 2}, {2, -2}}},
  Dynamic@Graphics[BezierCurve@pts, PlotRange -> 3, Frame -> True, 
    FrameTicks -> None]]]
  • $\begingroup$ Thank you very much indeed. Deloy does just that. But, now the user doesn't have the change of mouse appearance when hovering over the dynamic object. Is there anyway to retain the "default" behaviour? $\endgroup$
    – tush
    Jun 3, 2022 at 9:59
  • $\begingroup$ @tush that seems like an interesting question that you should make into a new question post entirely! $\endgroup$ Jun 4, 2022 at 19:53
  • $\begingroup$ All right then! $\endgroup$
    – tush
    Jun 4, 2022 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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