toolAF_pane.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. ui.stack_tool.index = 0;
  12. }
  13. //Callback after UI is fully loaded and displayed.
  14. function OnReady(reload, preview) {
  15. PUI(()=>{
  16. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  17. //The 'pui' variable is valid in all functions of this document.
  18. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  19. });
  20. //ui.stack_tool.visible = false;
  21. }
  22. function OnCloseForm() {
  23. }
  24. function OnException(err) {
  25. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  26. }
  27. //////////////////////////////////////////////////////////////////////////
  28. // Callback Functions.
  29. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  30. function OnUser(){
  31. unit.form.user.Show();
  32. }
  33. function OnTransform(idx) {
  34. ui.pb_pan.valid = ui.pb_rotate.valid = ui.pb_zoom.valid = ui.pb_zoom_window.valid = false;
  35. if (idx === 1) {
  36. ui.pb_pan.valid = true;
  37. unit.form.mainfrm.OnTransform(1);
  38. }
  39. if (idx === 2) {
  40. unit.form.mainfrm.OnTransform(2);
  41. ui.pb_rotate.valid = true;
  42. }
  43. }
  44. function On3DPosition(idx) {
  45. ui.pb_yox.valid = ui.pb_xoy.valid = ui.pb_zoy.valid = ui.pb_yoz.valid = ui.pb_zox.valid = ui.pb_xoz.valid = false;
  46. if (idx === 1) {
  47. ui.pb_yox.valid = true;
  48. unit.form.mainfrm.On3DPosition(1);
  49. }
  50. if (idx === 2) {
  51. ui.pb_xoy.valid = true;
  52. unit.form.mainfrm.On3DPosition(2);
  53. }
  54. if (idx === 3) {
  55. ui.pb_zoy.valid = true;
  56. unit.form.mainfrm.On3DPosition(3);
  57. }
  58. if (idx === 4) {
  59. ui.pb_yoz.valid = true;
  60. unit.form.mainfrm.On3DPosition(4);
  61. }
  62. if (idx === 5) {
  63. ui.pb_xoz.valid = true;
  64. unit.form.mainfrm.On3DPosition(5);
  65. }
  66. if (idx === 6) {
  67. ui.pb_zox.valid = true;
  68. unit.form.mainfrm.On3DPosition(6);
  69. }
  70. }
  71. function OnTopMenu(idx) {
  72. ui.stack_tool.visible = true;
  73. ui.stack_tool.index = idx - 1;
  74. //ui.stack_tool.index = 0;
  75. ui.mp_btn.valid = ui.env_pb.valid = ui.seclect_pb.valid = false;
  76. //model.ide_info(idx);
  77. if (idx === 1) {
  78. ui.mp_btn.valid = true;
  79. }
  80. if (idx === 2) {
  81. ui.env_pb.valid = true;
  82. }
  83. if (idx === 3) {
  84. ui.seclect_pb.valid = true;
  85. }
  86. }
  87. function OnOpen(){
  88. ui.stack_switch.index = 0;
  89. ui.stack_tool.visible = true;
  90. }
  91. function OnClose(){
  92. ui.stack_switch.index = 1;
  93. ui.stack_tool.visible = false;
  94. }
  95. //The message corresponding callback executed by the docker pane.
  96. // when calling [side_pane].fireEvent(type,para) in the main form.
  97. function OnParentDockerMessage(type, para) {
  98. }
  99. //////////////////////////////////////////////////////////////////////////
  100. // Utils Functions.
  101. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  102. function onDragFile(filepath) {
  103. }
  104. function PUI(cb) {
  105. if(pui){cb();}
  106. }
  107. /*Usage of BLOCK_EVENT
  108. BLOCK_EVENT(()=>{
  109. ui.[name].[var] = ...;
  110. });
  111. */
  112. function BLOCK_EVENT(cb) {
  113. ui.block_event = true;
  114. cb();
  115. ui.block_event = false;
  116. }
  117. //////////////////////////////////////////////////////////////////////////
  118. // template codes for cw callback js.
  119. function CW_DeclareVariable(name, setter, getter) {
  120. if(typeof(__DeclareVariable) === 'function') {
  121. __DeclareVariable(name, setter, getter);
  122. }
  123. }
  124. function CW_DeclareOuterVariable(name) {
  125. if(typeof(__DeclareOuterVariable) === 'function') {
  126. __DeclareOuterVariable(name);
  127. }
  128. }