123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- ////////////////////////////////////////////////////////////////////////////
- // System Pre-define Functions
- // 95099372-ef3e-11ea-9c81-bf848405c62e
- //Callback of data preparation stage before UI is fully loaded.
- function OnInitializeData(reload, preview) {
-
- PUI(()=>{
- //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
- //The 'pui' variable is valid in all functions of this document.
- //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
-
- });
- ui.stack_tool.index = 0;
- }
- //Callback after UI is fully loaded and displayed.
- function OnReady(reload, preview) {
-
- PUI(()=>{
- //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
- //The 'pui' variable is valid in all functions of this document.
- //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
-
- });
- //ui.stack_tool.visible = false;
- }
- function OnCloseForm() {
- }
- function OnException(err) {
- //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
- }
- //////////////////////////////////////////////////////////////////////////
- // Callback Functions.
- // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
- function OnUser(){
- unit.form.user.Show();
- }
- function OnTransform(idx) {
- ui.pb_pan.valid = ui.pb_rotate.valid = ui.pb_zoom.valid = ui.pb_zoom_window.valid = false;
- if (idx === 1) {
- ui.pb_pan.valid = true;
- unit.form.mainfrm.OnTransform(1);
- }
- if (idx === 2) {
- unit.form.mainfrm.OnTransform(2);
- ui.pb_rotate.valid = true;
- }
- }
- function On3DPosition(idx) {
- 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;
- if (idx === 1) {
- ui.pb_yox.valid = true;
- unit.form.mainfrm.On3DPosition(1);
- }
- if (idx === 2) {
- ui.pb_xoy.valid = true;
- unit.form.mainfrm.On3DPosition(2);
- }
- if (idx === 3) {
- ui.pb_zoy.valid = true;
- unit.form.mainfrm.On3DPosition(3);
- }
- if (idx === 4) {
- ui.pb_yoz.valid = true;
- unit.form.mainfrm.On3DPosition(4);
- }
- if (idx === 5) {
- ui.pb_xoz.valid = true;
- unit.form.mainfrm.On3DPosition(5);
- }
- if (idx === 6) {
- ui.pb_zox.valid = true;
- unit.form.mainfrm.On3DPosition(6);
- }
- }
- function OnTopMenu(idx) {
- ui.stack_tool.visible = true;
- ui.stack_tool.index = idx - 1;
- //ui.stack_tool.index = 0;
- ui.mp_btn.valid = ui.env_pb.valid = ui.seclect_pb.valid = false;
- //model.ide_info(idx);
- if (idx === 1) {
- ui.mp_btn.valid = true;
- }
- if (idx === 2) {
- ui.env_pb.valid = true;
- }
- if (idx === 3) {
- ui.seclect_pb.valid = true;
- }
- }
- function OnOpen(){
- ui.stack_switch.index = 0;
- ui.stack_tool.visible = true;
- }
- function OnClose(){
- ui.stack_switch.index = 1;
- ui.stack_tool.visible = false;
- }
- //The message corresponding callback executed by the docker pane.
- // when calling [side_pane].fireEvent(type,para) in the main form.
- function OnParentDockerMessage(type, para) {
- }
- //////////////////////////////////////////////////////////////////////////
- // Utils Functions.
- // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
- function onDragFile(filepath) {
- }
- function PUI(cb) {
- if(pui){cb();}
- }
- /*Usage of BLOCK_EVENT
- BLOCK_EVENT(()=>{
- ui.[name].[var] = ...;
- });
- */
- function BLOCK_EVENT(cb) {
- ui.block_event = true;
-
- cb();
-
- ui.block_event = false;
- }
- //////////////////////////////////////////////////////////////////////////
- // template codes for cw callback js.
- function CW_DeclareVariable(name, setter, getter) {
- if(typeof(__DeclareVariable) === 'function') {
- __DeclareVariable(name, setter, getter);
- }
- }
- function CW_DeclareOuterVariable(name) {
- if(typeof(__DeclareOuterVariable) === 'function') {
- __DeclareOuterVariable(name);
- }
- }
|