phantasmal-world/14.b99164c8a80a88b3ae9d.js

1 line
3.4 KiB
JavaScript
Raw Normal View History

2020-01-05 07:55:24 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{HjM1:function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));var a=i("39ZU"),s=i("nN8q"),n=(i("4AvX"),i("FXpb"));const r=28;class o extends s.a{constructor(e,t){super(t),this.gui_store=e,this.tabs=[],this.bar_element=Object(n.h)({className:"core_TabContainer_Bar"}),this.panes_element=Object(n.h)({className:"core_TabContainer_Panes"}),this.element=Object(n.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(n.q)({className:"core_TabContainer_Tab",data:{key:e.key}},e.title);this.bar_element.append(t);const i=this.disposable(new a.a(e.create_view)),s=Object.assign(Object.assign({},e),{tab_element:t,lazy_view:i});this.tabs.push(s),this.panes_element.append(i.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=`${r}px`;const i=t-r;this.panes_element.style.width=`${e}px`,this.panes_element.style.height=`${i}px`;for(const t of this.tabs)t.lazy_view.resize(e,i);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,i){"use strict";i.r(t);var a=i("HjM1"),s=i("zsIO");class n extends s.a{constructor(e,t,i){super(),this.tab_container=this.add(new a.a(e,{class:"viewer_ViewerView",tabs:[{title:"Models",key:"models",path:"/models",create_view:t},{title:"Textures",key:"textures",path:"/textures",create_view:i}]})),this.finalize_construction()}get element(){return this.tab_container.element}resize(e,t){this.tab_container.resize(e,t)}}var r=i("Tpfs");i.d(t,"initialize_viewer",(function(){return l}));var o=function(e,t,i,a){return new(i||(i=Promise))((function(s,n){function r(e){try{l(a.next(e))}catch(e){n(e)}}function o(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,o)}l((a=a.apply(e,t||[])).next())}))};function l(e,t,a){const s=new r.a;return{view:new n(t,()=>o(this,void 0,void 0,(function*(){const{Model3DStore:n}=yield Promise.all([i.e(3),i.e(13)]).then(i.bind(null,"tyuj")),{Model3DView:r}=yield Promise.all([i.e(0),i.e(1),i.e(2),i.e(10)]).then(i.bind(null,"Hdaq")),{CharacterClassAssetLoader:o}=yield Promise.all([i.e(3),i.e(16)]).then(i.bind(null,"ZV42")),l=new n(s.add(new o(e)));return s.disposed?l.dispose():s.add(l),new r(t,l,a())})),()=>o(this,void 0,void 0,(function*(){const{TextureStore:e}=yield i.e(6).then(i.bind(null,"4/Uj")),{TextureView:t}=yield Promise.all([i.e(0),i.e(1),i.e(8)]).then(i.bind(null,"Za3H")),n=new e;return s.disposed?n.dispose():s.add(n),new t(n,a())}))),dispose(){s.dispose()}}}}}]);