This is related to the question i just asked here but not the same.
How could i create a manipulate that lets me move the graph to any position i want by clicking and dragging anywhere. Here is an example of what i want at desmos.com.
Answer
A version using Manipulate:
Manipulate[
Graphics[{}, Axes -> True, AxesOrigin -> {0, 0}, PlotRange -> pr,
GridLines -> Range @@@ Round@pr, GridLinesStyle -> LightGray],
{{p, {0, 0}}, Locator,
TrackingFunction -> {p = MousePosition[{"Graphics", Graphics}, {0, 0}]; &,
If[MousePosition["GraphicsScaled"] ∈ Rectangle[],
pr += p - MousePosition[{"Graphics", Graphics}, {0, 0}]]; &, None},
Appearance -> None},
{{pr, {{-5, 5}, {-5, 5}}}, None}]


Comments
Post a Comment