mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-05 15:28:29 +08:00
1 line
7.9 KiB
JavaScript
1 line
7.9 KiB
JavaScript
![]() |
(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{"+n1W":function(e,t,s){"use strict";s.r(t),s.d(t,"TextureView",(function(){return a}));var i=s("FXpb"),n=s("6cU9"),o=s("w6HN"),r=s("KUR2"),l=s("zsIO"),c=s("68q7");class a extends l.a{constructor(e,t){super(),this.element=Object(i.h)({className:"viewer_TextureView"}),this.open_file_button=new n.a({icon_left:i.a.File,text:"Open file...",accept:".afs, .xvm"}),this.tool_bar=this.add(new o.a(this.open_file_button)),this.renderer_view=this.add(new r.a(t)),this.element.append(this.tool_bar.element,this.renderer_view.element);const s=this.disposable(new c.a({visible:e.result_dialog_visible,result:e.result,problems_message:e.result_problems_message,error_message:e.result_error_message}));this.disposables(this.open_file_button.files.observe(({value:t})=>{t.length&&e.load_file(t[0])}),s.ondismiss.observe(e.dismiss_result_dialog)),this.finalize_construction()}activate(){this.renderer_view.start_rendering(),super.activate()}deactivate(){super.deactivate(),this.renderer_view.stop_rendering()}resize(e,t){return super.resize(e,t),this.renderer_view.resize(e,Math.max(0,t-this.tool_bar.height)),this}}},"68q7":function(e,t,s){"use strict";s.d(t,"a",(function(){return c}));var i=s("iUMt"),n=s("KVVN"),o=s("jJhE"),r=s("FXpb"),l=s("ouMO");class c extends i.a{constructor(e){const t=new n.a({text:"Dismiss"});super(Object.assign({footer:[t.element]},e));const s=Object(o.a)(e.result)?e.result:Object(l.e)(e.result);this.problems_message=Object(o.a)(e.problems_message)?e.problems_message:Object(l.e)(e.problems_message),this.error_message=Object(o.a)(e.error_message)?e.error_message:Object(l.e)(e.error_message),this.disposables(t,t.onclick.observe(e=>this._ondismiss.emit(e)),s.observe(({value:e})=>this.result_changed(e),{call_now:!0})),this.finalize_construction()}result_changed(e){e?(this.content.val=function(e){const t=Object(r.h)();t.style.overflow="auto",t.style.userSelect="text",t.style.height="100%",t.style.maxHeight="400px";const s=Object(r.B)(...e.problems.map(e=>Object(r.o)(e.ui_message)));return s.style.cursor="text",t.append(s),t}(e),e.success?e.problems.length&&(this.title.val="Problems",this.description.val=this.problems_message.val):(this.title.val="Error",this.description.val=this.error_message.val)):this.content.val=""}}},"6cU9":function(e,t,s){"use strict";s.d(t,"a",(function(){return l}));var i=s("ouMO"),n=s("KVVN"),o=s("iPoI"),r=function(e,t,s,i){return new(s||(s=Promise))((function(n,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function l(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,l)}c((i=i.apply(e,t||[])).next())}))};class l extends n.a{constructor(e){super(e),this._files=Object(i.e)([]),this.files=this._files,this.element.classList.add("core_FileButton"),this.disposables(this.onclick.observe(()=>r(this,void 0,void 0,(function*(){this._files.val=yield Object(o.a)(e)})))),this.finalize_construction()}}},KUR2:function(e,t,s){"use strict";s.d(t,"a",(function(){return o}));var i=s("nN8q"),n=s("FXpb");class o extends i.a{constructor(e){super(),this.renderer=e,this.element=Object(n.h)({className:"core_RendererWidget"}),this.children=[],this.element.append(e.canvas_element),this.disposable(e),this.finalize_construction()}start_rendering(){this.renderer.start_rendering()}stop_rendering(){this.renderer.stop_rendering()}resize(e,t){return super.resize(e,t),this.renderer.set_size(e,t),this}}},iPoI:function(e,t,s){"use strict";s.d(t,"a",(function(){return n})),s.d(t,"b",(function(){return o}));var i=s("FXpb");function n(e){return new Promise(t=>{var s,n,o,r;const l=Object(i.m)({type:"file"});l.accept=null!=(n=null===(s=e)||void 0===s?void 0:s.accept)?n:"",l.multiple=null!=(r=null===(o=e)||void 0===o?void 0:o.multiple)&&r,l.onchange=()=>{l.files&&l.files.length?t([...l.files]):t([])},l.click()})}function o(e){return new Promise((t,s)=>{const i=new FileReader;i.addEventListener("loadend",()=>{i.result instanceof ArrayBuffer?t(i.result):s(new Error("Couldn't read file."))}),i.readAsArrayBuf
|