phantasmal-world/21.a5e62013a2f23a67ca71.js

1 line
4.6 KiB
JavaScript
Raw Normal View History

2020-01-29 20:24:47 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[21],{HjM1:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var i=n("39ZU"),a=n("nN8q"),s=(n("4AvX"),n("FXpb"));const l=28;class r extends a.a{constructor(e,t){super(t),this.gui_store=e,this.tabs=[],this.bar_element=Object(s.h)({className:"core_TabContainer_Bar"}),this.panes_element=Object(s.h)({className:"core_TabContainer_Panes"}),this.element=Object(s.h)({className:"core_TabContainer"}),this.bar_mousedown=e=>{if(e.target instanceof HTMLElement){const t=e.target.dataset.key;t&&this.activate_key(t)}},this.bar_element.onmousedown=this.bar_mousedown;for(const e of t.tabs){const t=Object(s.s)({className:"core_TabContainer_Tab",data:{key:e.key}},e.title);this.bar_element.append(t);const n=this.disposable(new i.a(e.create_view)),a=Object.assign(Object.assign({},e),{tab_element:t,lazy_view:n});this.tabs.push(a),this.panes_element.append(n.element)}this.element.append(this.bar_element,this.panes_element),this.finalize_construction()}get children(){return this.tabs.flatMap(e=>e.lazy_view.children)}resize(e,t){super.resize(e,t),this.bar_element.style.width=`${e}px`,this.bar_element.style.height=`${l}px`;const n=t-l;this.panes_element.style.width=`${e}px`,this.panes_element.style.height=`${n}px`;for(const t of this.tabs)t.lazy_view.resize(e,n);return this}activate(){if(this.active_tab)this.activate_tab(this.active_tab);else{let e;for(const t of this.tabs)null!=t.path&&this.gui_store.path.val.startsWith(t.path)&&(e=t);e?this.activate_tab(e):this.tabs.length&&this.activate_tab(this.tabs[0])}}activate_key(e){for(const t of this.tabs)if(t.key===e){this.activate_tab(t);break}}activate_tab(e){this.active_tab!==e&&(this.active_tab&&(this.active_tab.tab_element.classList.remove("active"),this.active_tab.lazy_view.visible.val=!1,this.active_tab.lazy_view.deactivate()),this.active_tab=e,e.tab_element.classList.add("active"),e.lazy_view.visible.val=!0),null!=e.path&&(this.gui_store.set_path_prefix(e.path),e.lazy_view.activate())}}},U6CM:function(e,t,n){"use strict";n.r(t);var i=n("HjM1"),a=n("zsIO");class s extends a.a{constructor(e,t,n){super(),this.tab_container=this.add(new i.a(e,{class:"viewer_ViewerView",tabs:[{title:"Models",key:"model",path:"/models",create_view:t},{title:"Textures",key:"texture",path:"/textures",create_view:n}]})),this.finalize_construction()}get element(){return this.tab_container.element}resize(e,t){this.tab_container.resize(e,t)}}var l=n("Tpfs");n.d(t,"initialize_viewer",(function(){return o}));var r=function(e,t,n,i){return new(n||(n=Promise))((function(a,s){function l(e){try{o(i.next(e))}catch(e){s(e)}}function r(e){try{o(i.throw(e))}catch(e){s(e)}}function o(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,r)}o((i=i.apply(e,t||[])).next())}))};function o(e,t,i,a){const o=new l.a;return{view:new s(i,()=>r(this,void 0,void 0,(function*(){const{ModelController:s}=yield n.e(24).then(n.bind(null,"UwGQ")),{ModelView:l}=yield Promise.all([n.e(1),n.e(20)]).then(n.bind(null,"puLw")),{CharacterClassAssetLoader:r}=yield Promise.all([n.e(2),n.e(13)]).then(n.bind(null,"ZV42")),{ModelToolBarView:c}=yield Promise.all([n.e(1),n.e(2),n.e(11)]).then(n.bind(null,"i7j/")),{ModelStore:h}=yield Promise.all([n.e(2),n.e(19)]).then(n.bind(null,"HF44")),{ModelToolBarController:d}=yield Promise.all([n.e(2),n.e(10)]).then(n.bind(null,"Ea9h")),{CharacterClassOptionsView:b}=yield Promise.all([n.e(1),n.e(25)]).then(n.bind(null,"Utg3")),{CharacterClassOptionsController:u}=yield n.e(23).then(n.bind(null,"n/YL")),_=o.add(new r(e)),w=o.add(new h(i,_,t)),v=new s(w),p=new d(w),f=new u(w);let y;if(i.feature_active("webgpu")){const{WebgpuRenderer:t}=yield n.e(5).then(n.bind(null,"Ye55")),{ModelGfxRenderer:i}=yield n.e(3).then(n.bind(null,"GfTf"));y=new i(w,new t(!0,e))}else if(i.feature_active("webgl")){const{WebglRenderer:e}=yield n.e(4).then(n.bind(null,"/QjG")),{ModelGfxRenderer:t}=yield n.e(3).then(n.bind(null,"GfTf"));y=new t(w,new e(!0))}else{const{ModelRenderer:e}=yield Promise.all([n.e(0),n.e(2),n.e(12)]).then(n.bind(null,"zaf9"));y=n