0

I am trying to create a LocatorPane on the Wolfram cloud, but am hitting a snag. The LocatorPane needs a couple of helper functions. When run locally, everything works fine. When I deploy it to the cloud, these helper functions are not evaluated.

Here is a toy example that shows the issue

CloudDeploy[
dog[pt_]:=Norm[pt];
DynamicModule[{pt={1,1}/2},
{LocatorPane[Dynamic[pt],Dynamic@If[Norm[pt]<1.,Graphics[{Gray,Disk[]}],Graphics[{Red,Disk[]}]]],Dynamic[pt],Dynamic[dog[pt]]}]
,Permissions->"Public"]

In addition to displaying a disk, this should also display the coordinates of the locator and evaluate the function dog. Instead, the dog function is not evaluated. Any suggestions would be appreciated.

Output of code

Jack McInerney
  • 395
  • 1
  • 10
  • Let me know if the linked answer does not fit your needs. – Kuba Nov 16 '20 at 09:32
  • Thanks for the suggestion, Kuba. I would prefer not Manipulate. CloudDeploy has an option IncludeDefinitions ->True, which I thought would guarantee the helper functions would be included. – Jack McInerney Nov 16 '20 at 18:29
  • DynamicModule has the SaveDefinitions option as well. Sorry for not being clear. – Kuba Nov 16 '20 at 18:31
  • 1
    Thanks, Kuba! I didn't realize DynamicModule had that option. I just tried it and it works perfectly. – Jack McInerney Nov 16 '20 at 18:35

0 Answers0