phantasmal-world/13.5b6998041dd6d76a1d0d.js

1 line
7.8 KiB
JavaScript
Raw Normal View History

2020-01-29 20:34:43 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{481:function(e,t,s){"use strict";s.d(t,"a",(function(){return n})),s.d(t,"b",(function(){return o}));var i=s(2);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.readAsArrayBuffer(e)})}},494:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var i=s(41),n=(s(539),s(135)),o=s(2);class r extends i.a{constructor(e,...t){super(e instanceof i.a?void 0:e),this.element=Object(o.h)({className:"core_ToolBar"}),this.height=33,this.element.style.height=`${this.height}px`,this.children=e instanceof i.a?[e,...t]:t;for(const e of this.children)if(this.disposable(e),e instanceof n.a&&e.label){const t=Object(o.h)({className:"core_ToolBar_group"});"left"===e.preferred_label_position||"top"===e.preferred_label_position?t.append(e.label.element,e.element):t.append(e.element,e.label.element),this.element.append(t)}else this.element.append(e.element);this.finalize_construction()}set_enabled(e){super.set_enabled(e);for(const t of this.children)t.enabled.val=e}}},530:function(e,t,s){"use strict";s.d(t,"a",(function(){return o}));var i=s(139),n=s(2);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}}},539:function(e,t,s){},541:function(e,t,s){"use strict";s.d(t,"a",(function(){return l}));var i=s(14),n=s(137),o=s(481),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()}}},542:function(e,t,s){"use strict";s.d(t,"a",(function(){return h}));var i=s(139),n=s(2),o=(s(543),s(19)),r=s(31),l=s(14);const c=500,a=500;class h extends i.a{constructor(e){var t,s;super(e),this.x=0,this.y=0,this.prev_mouse_x=0,this.prev_mouse_y=0,this._title=new r.a(this,"",this.set_title),this._description=new r.a(this,"",this.set_description),this._content=new r.a(this,"",this.set_content),this._ondismiss=Object(l.a)(),this.children=[],this.title=this._title,this.description=this._description,this.content=this._content,this.ondismiss=this._ondismiss,this.mousedown=e=>{this.prev_mouse_x=e.clientX,this.prev_mouse_y=e.clientY,window.addEventListener("mousemove",this.window_mousemove),window.addEventListener("mouseup",this.window_mouseup)},this.window_mousemove=e=>{e.preventDefault(),this.set_position(this.x+e.clientX-this.prev_mouse_x,this.y+e.clientY-this.prev_mouse_y),this.prev_mouse_x=e.clientX,this.prev_mouse_y=e.clientY},this.window_mouseup=e=>{e.preventDefault(),window.removeEventListener("mousemove",this.window_mousemove),window.removeEventListener("mouseup",this.window_mouseup)},this.element=Object(n.q)({className:"core_Dialog",tabIndex:0},this.header_element=Object(n.i)(),this.description_element=Object(n.h)({className:"core_Dialog_description"}),this.content_element=Object(n.h)({className:"core_Dialog_body"}),Object(n.h)({className:"core_Dialog_footer"},...(s=null===(t=e)||void 0===t?void 0:t.footer,null!=s?s:[]))),this.element.s