Where to see the syntax content or help?

I’ve opened a sample project named "catching-birds.saolapack ".
then I saw the content of function: first_bird of element bird_01.
then I saw many unknown syntax for me, such as:

getPositionPow(bird,shoot);
doc.getElement(“div_scores”).setText(doc.score);
shootMove(shoot);
loopBird(bird);

Q1 ) Where do user see the syntax content or syntax help?
Such as, where do user see the syntax content
or syntax help for getElement()? getPositionPow()? shootMove()? loopBird()?
Is there any keyboard shortcut or link about this?
;;
Q2 ) Can JavaScript detect the element position?
For example,
if I want to detect the element one whether touch the element two,
where do I see syntax for doing this?
;;
Thank you very much,
Afei

Hi afei,

Q1)
getPositionPow, shootMove, loopBird are functions that the author added to the project.
You can see this functions in Functions pane (click View > Functions if you don’t see this pane yet).

doc.getElement, element.setText are Saola Animate API functions to control the elements and animations. In the built-in script editor, you can click Options tool > Show API to show the documentation for these APIs.
You can also find them in Chapter 15: JavaScript > JavaScript APIs of the PDF user manual v3.

For more information about user functions and APIs, please see this tutorial:

Q2)
Saola Animate doesn’t provide APIs to detect the element position, but you can use plain JavaScript or a library to do that. For example, you can use getBoundingClientRect function

var element = doc.getElement('element name');
var elementNode = element.dom;
var elementRect = elementNode.getBoundingClientRect();

Regards

1 Like

Thank you very much for your detail and clearly answers!
Your reply help me so much, so, I, would like to give you a Five-star rating!
:star: :star: :star: :star: :star:

According to your help, I see a new issue (or say feature request) as below:

As you can see the font on content of “Show API”,
include the left-hand-side index pane, and the right-hand-side description pane,
The Font cannot be resized (too small), The Document index cannot be searched,
this is really hard to see for an programmer (specially old and with bad eyes),
please provide a “resizable API document” (for example, like a web page does).

Best regards,
Afei

Hi afei,

You can see the document for these APIs in the user manual (press F1 when not editing a function, or click Help > Help Contents): Chapter 15: JavaScript > JavaScript APIs

There are not many API functions so we don’t implement a search feature for them in the editor.
For the small text issue, you can change the font size by adding the following style to the UI stylesheet in <installation_folder>\resources\styles\saola_dark.qss file.

#FunctionEditDialogUI QTreeView,
#FunctionEditDialogUI QTextEdit
{
	font-size: 20px;
}

You can take a look at another thread regarding the UI stylesheet: Hope UI font size can be resize by the user

Regards

1 Like