This repository was archived by the owner on Sep 23, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Custom controls variables
Tran Khanh Duy edited this page Nov 18, 2020
·
5 revisions
Warning: this page is incomplete, variables may be incorrect and may be changed in the future.
-
screen_width: width of screen. -
screen_height: height of screen.
-
width: width of the control button itself. -
height: height of the control button itself.
-
top: top of screen, current is 0. -
left: left of screen, current is 0. -
right: right of screen, calculated as${screen_width} - ${width} - ${margin}. -
bottom: bottom of screen, calculated as${screen_height} - ${height} - ${margin}.
-
margin: margin, current is 2dp.
Currently, variables are only apply for Dynamic X and Y, which in format ${variable}.
For example
"dynamicX": "${screen_width} - ${width} * 2 + ${margin}"
With these given properties:
- Screen width: 1280
- Button width: 100
- Margin: 2dp, convert into pixels unit: 4px
It will be converted into
"dynamicX": "1280 - 100 * 2 + 4"
Then, the x field (stored in the memory when paste a control json) is being calculated from dynamicX use exp4j.
ControlData controlData = ...
controlData.x = new ExpressionBuilder(controlData.dynamicX)...;