mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-05 15:28:29 +08:00
1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
![]() |
(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{483:function(e,t,s){"use strict";s.d(t,"a",(function(){return i})),s.d(t,"b",(function(){return o}));var n=s(2);function i(e){return new Promise(t=>{var s,i;const o=Object(n.m)({type:"file"});o.accept=null!==(s=null==e?void 0:e.accept)&&void 0!==s?s:"",o.multiple=null!==(i=null==e?void 0:e.multiple)&&void 0!==i&&i,o.onchange=()=>{o.files&&o.files.length?t([...o.files]):t([])},o.click()})}function o(e){return new Promise((t,s)=>{const n=new FileReader;n.addEventListener("loadend",()=>{n.result instanceof ArrayBuffer?t(n.result):s(new Error("Couldn't read file."))}),n.readAsArrayBuffer(e)})}},495:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var n=s(42),i=(s(544),s(138)),o=s(2);class r extends n.a{constructor(e,...t){super(e instanceof n.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 n.a?[e,...t]:t;for(const e of this.children)if(this.disposable(e),e instanceof i.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}}},499:function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));var n=s(138),i=s(17),o=(s(500),s(32)),r=s(2);class a extends n.a{constructor(e,t,s,n,i){super(i),this.element=Object(r.s)({className:`${t} core_Input`}),this._value=new o.a(this,e,this.set_value),this.value=this._value,this.input_element=Object(r.m)({className:`${n} core_Input_inner`}),this.input_element.type=s,this.input_element.addEventListener("change",()=>{this._value.set_val(this.get_value(),{silent:!1})}),this.input_element.addEventListener("keydown",e=>{"Enter"===e.key&&this._value.set_val(this.get_value(),{silent:!1})}),i&&i.readonly&&this.set_attr("readOnly",!0),this.element.append(this.input_element)}set_enabled(e){super.set_enabled(e),this.input_element.disabled=!e}set_attr(e,t,s){if(null==t)return;const n=this.input_element,o=s||(e=>e);Object(i.a)(t)?(n[e]=o(t.val),this.disposable(t.observe(({value:t})=>n[e]=o(t)))):n[e]=o(t)}}},500:function(e,t,s){},508:function(e,t,s){"use strict";s.d(t,"a",(function(){return i}));var n=s(499);s(533);class i extends n.a{constructor(e=0,t){if(super(e,"core_NumberInput","number","core_NumberInput_inner",t),this.preferred_label_position="left",t){const{min:e,max:s,step:n,width:i}=t;this.set_attr("min",e,String),this.set_attr("max",s,String),this.input_element.step="any",this.set_attr("step",n,String),null!=i&&(this.element.style.width=`${i}px`)}t&&null!=t.round_to&&t.round_to>=0?this.rounding_factor=Math.pow(10,t.round_to):this.rounding_factor=1,this.set_value(e),this.finalize_construction()}get_value(){return parseFloat(this.input_element.value)}set_value(e){this.input_element.valueAsNumber=Math.round(this.rounding_factor*e)/this.rounding_factor}}},530:function(e,t,s){"use strict";s.d(t,"a",(function(){return h}));var n=s(142),i=s(2),o=(s(547),s(17)),r=s(32),a=s(14);const l=500,c=500;class h extends n.a{constructor(e){var t;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(a.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.prevent
|