Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPS-6163 Add new API docs for cutom tools and embeds #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions reference/modules/ROOT/pages/GeoGebra_Apps_API.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,23 @@ Arguments in square brackets can be omitted.

====

== [#Commands_and_Undo-Points]#Commands and Undo-Points#
== Creating objects

[cols=",^,",options="header",]
|===
|Method Signature |Since |Description
|boolean evalCommand(String cmdString) |3.0 |Evaluates the given string just like it would be evaluated when entered
into GeoGebra's input bar. Returns whether command evaluation was successful. From GeoGebra 3.2 you can pass multiple
commands at once by separating them with \n. Note: you must use English commands names
|boolean evalLaTex(String input)|5.0| Evaluates LaTeX string to a construction element. Basic syntaxes like `x^{2}` or `\frac` are supported.

|String evalCommandGetLabels(String cmdString) |5.0 |Like evalCommand(), but the return value is a String containing a
comma-separated list of the labels of the created objects eg `++"A,B,C"++`

|String evalCommandCAS(String string) |3.2 |Passes the string to GeoGebra's CAS and returns the result as a String.
|void insertEmbed(String type, String uri)|6.0 (Notes)| Inserts embedded element with specific type and URI.
Type and URI are then used to obtain the HTML code for the embed element, see `registerEmbedResolver`

|void setUndoPoint() |3.2 |Sets an undo point. Useful if you want the user to be able to undo that action of evalCommand
eg if you have made an HTML button to act as a custom tool
|===

== [#Setting_the_state_of_objects]#Setting the state of objects#
Expand Down Expand Up @@ -131,6 +132,7 @@ ggbApplet.writePNGtoFile("myImage.png", 1, false, 72);
|boolean isMoveable(String objName) |4.0 |checks if *objName* is is moveable

|void showAllObjects() |5.0 |Changes bounds of the Graphics View so that all visible objects are on screen.
|void registerEmbedResolver(String type, Function callback)| 6.0| Adds a resolving function for specific embedded element type. The function gets an ID of the embed and returns a promise that resolves to a HTML string.
|===

=== [#Automatic_Animation]#Automatic Animation#
Expand Down Expand Up @@ -296,6 +298,9 @@ the graphics windows 1 and 2.
|void setAxesVisible(int viewNumber, boolean xAxis, boolean yAxis, boolean zAxis) |5.0 a|
Shows or hides the x-, y- and z-axis of the coordinate system in given graphics window.

|void setUndoPoint() |3.2 |Sets an undo point. Useful if you want the user to be able to undo that action of evalCommand
eg if you have made an HTML button to act as a custom tool

[EXAMPLE]
====

Expand Down Expand Up @@ -351,6 +356,7 @@ whether grid is visible in the first graphics view.

|setCustomToolBar(String toolbar) |5.0 |Sets the layout of the main toolbar, see xref:Toolbar.adoc[toolbar
reference] for details
|addCustomTool(String name, String iconDataURL, Function callback, String category)|6.0 (Notes only)|Adds a custom tool with given name and icon (encoded as data URL) to the Notes toolbox. The `callback` function is called when user selects the tool, it may show custom UI and/or use object creation APIs to create new objects. The `category` parameter may be one of `upload`, `link` or `more` and specifies in which category to show the new tool; if omitted, the `more` category is used.

|showMenuBar(boolean show) |HTML5 |Sets visibility of menu bar

Expand Down