geometry_mark_pane.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. //Callback of data preparation stage before UI is fully loaded.
  5. function OnInitializeData(reload, preview) {
  6. PUI(()=>{
  7. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  8. //The 'pui' variable is valid in all functions of this document.
  9. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  10. });
  11. }
  12. //Callback after UI is fully loaded and displayed.
  13. function OnReady(reload, preview) {
  14. PUI(()=>{
  15. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  16. //The 'pui' variable is valid in all functions of this document.
  17. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  18. });
  19. }
  20. function OnCloseForm() {
  21. }
  22. function OnException(err) {
  23. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  24. }
  25. //////////////////////////////////////////////////////////////////////////
  26. // Callback Functions.
  27. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  28. function OnReturn(){
  29. unit.form.mainfrm.menu(0);
  30. }
  31. function OnSend(){
  32. var id = parent.setTimeout(() => {
  33. unit.form.mainfrm.OnSend('0');
  34. }, 100);
  35. unit.form.mainfrm.OnSend('mark ' + ui.pb_name.value + ' ' + ui.pb_R.value + ' ' + ui.pb_G.value + ' ' + ui.pb_B.value + ' ' + ui.pb_size.value + ' ' + ui.pb_x.value + ' ' + ui.pb_y.value + ' ' + ui.pb_z.value);
  36. }
  37. //The message corresponding callback executed by the docker pane.
  38. // when calling [side_pane].fireEvent(type,para) in the main form.
  39. function OnParentDockerMessage(type, para) {
  40. }
  41. //////////////////////////////////////////////////////////////////////////
  42. // Utils Functions.
  43. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  44. function onDragFile(filepath) {
  45. }
  46. function PUI(cb) {
  47. if(pui){cb();}
  48. }
  49. CW_DeclareVariable("pb_x",
  50. val => {
  51. ui.pb_x.value = val;
  52. }, () => {});
  53. CW_DeclareVariable("pb_y",
  54. val => {
  55. ui.pb_y.value = val;
  56. }, () => {});
  57. CW_DeclareVariable("pb_z",
  58. val => {
  59. ui.pb_z.value = val;
  60. }, () => {});
  61. /*Usage of BLOCK_EVENT
  62. BLOCK_EVENT(()=>{
  63. ui.[name].[var] = ...;
  64. });
  65. */
  66. function BLOCK_EVENT(cb) {
  67. ui.block_event = true;
  68. cb();
  69. ui.block_event = false;
  70. }
  71. //////////////////////////////////////////////////////////////////////////
  72. // template codes for cw callback js.
  73. function CW_DeclareVariable(name, setter, getter) {
  74. if(typeof(__DeclareVariable) === 'function') {
  75. __DeclareVariable(name, setter, getter);
  76. }
  77. }
  78. function CW_DeclareOuterVariable(name) {
  79. if(typeof(__DeclareOuterVariable) === 'function') {
  80. __DeclareOuterVariable(name);
  81. }
  82. }