Browse Source

Mobile fixes

pull/1/head
Emil Ernerfeldt 6 years ago
parent
commit
391abda3d5
  1. 261
      docs/emigui_wasm.js
  2. BIN
      docs/emigui_wasm_bg.wasm
  3. 40
      docs/index.html
  4. 4
      emigui/src/fonts.rs
  5. 6
      emigui/src/layout.rs
  6. 10
      emigui/src/math.rs
  7. 2
      emigui_wasm/src/lib.rs

261
docs/emigui_wasm.js

@ -87,14 +87,10 @@ function isLikeNone(x) {
return x === undefined || x === null;
}
const __widl_f_get_element_by_id_Document_target = typeof Document === 'undefined' ? null : Document.prototype.getElementById || function() {
throw new Error(`wasm-bindgen: Document.getElementById does not exist`);
};
__exports.__widl_f_get_element_by_id_Document = function(arg0, arg1, arg2) {
let varg1 = getStringFromWasm(arg1, arg2);
const val = __widl_f_get_element_by_id_Document_target.call(getObject(arg0), varg1);
const val = getObject(arg0).getElementById(varg1);
return isLikeNone(val) ? 0 : addHeapObject(val);
};
@ -103,10 +99,6 @@ __exports.__widl_instanceof_HTMLCanvasElement = function(idx) {
return getObject(idx) instanceof HTMLCanvasElement ? 1 : 0;
};
const __widl_f_get_context_HTMLCanvasElement_target = typeof HTMLCanvasElement === 'undefined' ? null : HTMLCanvasElement.prototype.getContext || function() {
throw new Error(`wasm-bindgen: HTMLCanvasElement.getContext does not exist`);
};
let cachegetUint32Memory = null;
function getUint32Memory() {
if (cachegetUint32Memory === null || cachegetUint32Memory.buffer !== wasm.memory.buffer) {
@ -119,7 +111,7 @@ __exports.__widl_f_get_context_HTMLCanvasElement = function(arg0, arg1, arg2, ex
let varg1 = getStringFromWasm(arg1, arg2);
try {
const val = __widl_f_get_context_HTMLCanvasElement_target.call(getObject(arg0), varg1);
const val = getObject(arg0).getContext(varg1);
return isLikeNone(val) ? 0 : addHeapObject(val);
} catch (e) {
@ -130,63 +122,34 @@ __exports.__widl_f_get_context_HTMLCanvasElement = function(arg0, arg1, arg2, ex
}
};
function GetOwnOrInheritedPropertyDescriptor(obj, id) {
while (obj) {
let desc = Object.getOwnPropertyDescriptor(obj, id);
if (desc) return desc;
obj = Object.getPrototypeOf(obj);
}
return {}
}
const __widl_f_width_HTMLCanvasElement_target = GetOwnOrInheritedPropertyDescriptor(typeof HTMLCanvasElement === 'undefined' ? null : HTMLCanvasElement.prototype, 'width').get || function() {
throw new Error(`wasm-bindgen: HTMLCanvasElement.width does not exist`);
};
__exports.__widl_f_width_HTMLCanvasElement = function(arg0) {
return __widl_f_width_HTMLCanvasElement_target.call(getObject(arg0));
};
const __widl_f_height_HTMLCanvasElement_target = GetOwnOrInheritedPropertyDescriptor(typeof HTMLCanvasElement === 'undefined' ? null : HTMLCanvasElement.prototype, 'height').get || function() {
throw new Error(`wasm-bindgen: HTMLCanvasElement.height does not exist`);
return getObject(arg0).width;
};
__exports.__widl_f_height_HTMLCanvasElement = function(arg0) {
return __widl_f_height_HTMLCanvasElement_target.call(getObject(arg0));
};
const __widl_f_now_Performance_target = typeof Performance === 'undefined' ? null : Performance.prototype.now || function() {
throw new Error(`wasm-bindgen: Performance.now does not exist`);
return getObject(arg0).height;
};
__exports.__widl_f_now_Performance = function(arg0) {
return __widl_f_now_Performance_target.call(getObject(arg0));
return getObject(arg0).now();
};
__exports.__widl_instanceof_WebGLRenderingContext = function(idx) {
return getObject(idx) instanceof WebGLRenderingContext ? 1 : 0;
};
const __widl_f_buffer_data_with_array_buffer_view_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.bufferData || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.bufferData does not exist`);
};
__exports.__widl_f_buffer_data_with_array_buffer_view_WebGLRenderingContext = function(arg0, arg1, arg2, arg3) {
__widl_f_buffer_data_with_array_buffer_view_WebGLRenderingContext_target.call(getObject(arg0), arg1, getObject(arg2), arg3);
getObject(arg0).bufferData(arg1, getObject(arg2), arg3);
};
function getArrayU8FromWasm(ptr, len) {
return getUint8Memory().subarray(ptr / 1, ptr / 1 + len);
}
const __widl_f_tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.texImage2D || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.texImage2D does not exist`);
};
__exports.__widl_f_tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array_WebGLRenderingContext = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, exnptr) {
let varg9 = arg9 == 0 ? undefined : getArrayU8FromWasm(arg9, arg10);
try {
__widl_f_tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, varg9);
getObject(arg0).texImage2D(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, varg9);
} catch (e) {
const view = getUint32Memory();
view[exnptr / 4] = 1;
@ -195,153 +158,85 @@ __exports.__widl_f_tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and
}
};
const __widl_f_active_texture_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.activeTexture || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.activeTexture does not exist`);
};
__exports.__widl_f_active_texture_WebGLRenderingContext = function(arg0, arg1) {
__widl_f_active_texture_WebGLRenderingContext_target.call(getObject(arg0), arg1);
};
const __widl_f_attach_shader_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.attachShader || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.attachShader does not exist`);
getObject(arg0).activeTexture(arg1);
};
__exports.__widl_f_attach_shader_WebGLRenderingContext = function(arg0, arg1, arg2) {
__widl_f_attach_shader_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1), getObject(arg2));
};
const __widl_f_bind_buffer_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.bindBuffer || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.bindBuffer does not exist`);
getObject(arg0).attachShader(getObject(arg1), getObject(arg2));
};
__exports.__widl_f_bind_buffer_WebGLRenderingContext = function(arg0, arg1, arg2) {
__widl_f_bind_buffer_WebGLRenderingContext_target.call(getObject(arg0), arg1, getObject(arg2));
};
const __widl_f_bind_texture_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.bindTexture || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.bindTexture does not exist`);
getObject(arg0).bindBuffer(arg1, getObject(arg2));
};
__exports.__widl_f_bind_texture_WebGLRenderingContext = function(arg0, arg1, arg2) {
__widl_f_bind_texture_WebGLRenderingContext_target.call(getObject(arg0), arg1, getObject(arg2));
};
const __widl_f_blend_func_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.blendFunc || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.blendFunc does not exist`);
getObject(arg0).bindTexture(arg1, getObject(arg2));
};
__exports.__widl_f_blend_func_WebGLRenderingContext = function(arg0, arg1, arg2) {
__widl_f_blend_func_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2);
};
const __widl_f_clear_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.clear || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.clear does not exist`);
getObject(arg0).blendFunc(arg1, arg2);
};
__exports.__widl_f_clear_WebGLRenderingContext = function(arg0, arg1) {
__widl_f_clear_WebGLRenderingContext_target.call(getObject(arg0), arg1);
};
const __widl_f_clear_color_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.clearColor || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.clearColor does not exist`);
getObject(arg0).clear(arg1);
};
__exports.__widl_f_clear_color_WebGLRenderingContext = function(arg0, arg1, arg2, arg3, arg4) {
__widl_f_clear_color_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2, arg3, arg4);
};
const __widl_f_compile_shader_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.compileShader || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.compileShader does not exist`);
getObject(arg0).clearColor(arg1, arg2, arg3, arg4);
};
__exports.__widl_f_compile_shader_WebGLRenderingContext = function(arg0, arg1) {
__widl_f_compile_shader_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1));
};
const __widl_f_create_buffer_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.createBuffer || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.createBuffer does not exist`);
getObject(arg0).compileShader(getObject(arg1));
};
__exports.__widl_f_create_buffer_WebGLRenderingContext = function(arg0) {
const val = __widl_f_create_buffer_WebGLRenderingContext_target.call(getObject(arg0));
const val = getObject(arg0).createBuffer();
return isLikeNone(val) ? 0 : addHeapObject(val);
};
const __widl_f_create_program_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.createProgram || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.createProgram does not exist`);
};
__exports.__widl_f_create_program_WebGLRenderingContext = function(arg0) {
const val = __widl_f_create_program_WebGLRenderingContext_target.call(getObject(arg0));
const val = getObject(arg0).createProgram();
return isLikeNone(val) ? 0 : addHeapObject(val);
};
const __widl_f_create_shader_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.createShader || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.createShader does not exist`);
};
__exports.__widl_f_create_shader_WebGLRenderingContext = function(arg0, arg1) {
const val = __widl_f_create_shader_WebGLRenderingContext_target.call(getObject(arg0), arg1);
const val = getObject(arg0).createShader(arg1);
return isLikeNone(val) ? 0 : addHeapObject(val);
};
const __widl_f_create_texture_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.createTexture || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.createTexture does not exist`);
};
__exports.__widl_f_create_texture_WebGLRenderingContext = function(arg0) {
const val = __widl_f_create_texture_WebGLRenderingContext_target.call(getObject(arg0));
const val = getObject(arg0).createTexture();
return isLikeNone(val) ? 0 : addHeapObject(val);
};
const __widl_f_draw_elements_with_i32_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.drawElements || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.drawElements does not exist`);
};
__exports.__widl_f_draw_elements_with_i32_WebGLRenderingContext = function(arg0, arg1, arg2, arg3, arg4) {
__widl_f_draw_elements_with_i32_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2, arg3, arg4);
};
const __widl_f_enable_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.enable || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.enable does not exist`);
getObject(arg0).drawElements(arg1, arg2, arg3, arg4);
};
__exports.__widl_f_enable_WebGLRenderingContext = function(arg0, arg1) {
__widl_f_enable_WebGLRenderingContext_target.call(getObject(arg0), arg1);
};
const __widl_f_enable_vertex_attrib_array_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.enableVertexAttribArray || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.enableVertexAttribArray does not exist`);
getObject(arg0).enable(arg1);
};
__exports.__widl_f_enable_vertex_attrib_array_WebGLRenderingContext = function(arg0, arg1) {
__widl_f_enable_vertex_attrib_array_WebGLRenderingContext_target.call(getObject(arg0), arg1);
};
const __widl_f_get_attrib_location_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.getAttribLocation || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.getAttribLocation does not exist`);
getObject(arg0).enableVertexAttribArray(arg1);
};
__exports.__widl_f_get_attrib_location_WebGLRenderingContext = function(arg0, arg1, arg2, arg3) {
let varg2 = getStringFromWasm(arg2, arg3);
return __widl_f_get_attrib_location_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1), varg2);
};
const __widl_f_get_program_info_log_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.getProgramInfoLog || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.getProgramInfoLog does not exist`);
return getObject(arg0).getAttribLocation(getObject(arg1), varg2);
};
__exports.__widl_f_get_program_info_log_WebGLRenderingContext = function(ret, arg0, arg1) {
const val = __widl_f_get_program_info_log_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1));
const val = getObject(arg0).getProgramInfoLog(getObject(arg1));
const retptr = isLikeNone(val) ? [0, 0] : passStringToWasm(val);
const retlen = WASM_VECTOR_LEN;
const mem = getUint32Memory();
@ -350,20 +245,12 @@ __exports.__widl_f_get_program_info_log_WebGLRenderingContext = function(ret, ar
};
const __widl_f_get_program_parameter_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.getProgramParameter || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.getProgramParameter does not exist`);
};
__exports.__widl_f_get_program_parameter_WebGLRenderingContext = function(arg0, arg1, arg2) {
return addHeapObject(__widl_f_get_program_parameter_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1), arg2));
};
const __widl_f_get_shader_info_log_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.getShaderInfoLog || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.getShaderInfoLog does not exist`);
return addHeapObject(getObject(arg0).getProgramParameter(getObject(arg1), arg2));
};
__exports.__widl_f_get_shader_info_log_WebGLRenderingContext = function(ret, arg0, arg1) {
const val = __widl_f_get_shader_info_log_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1));
const val = getObject(arg0).getShaderInfoLog(getObject(arg1));
const retptr = isLikeNone(val) ? [0, 0] : passStringToWasm(val);
const retlen = WASM_VECTOR_LEN;
const mem = getUint32Memory();
@ -372,105 +259,57 @@ __exports.__widl_f_get_shader_info_log_WebGLRenderingContext = function(ret, arg
};
const __widl_f_get_shader_parameter_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.getShaderParameter || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.getShaderParameter does not exist`);
};
__exports.__widl_f_get_shader_parameter_WebGLRenderingContext = function(arg0, arg1, arg2) {
return addHeapObject(__widl_f_get_shader_parameter_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1), arg2));
};
const __widl_f_get_uniform_location_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.getUniformLocation || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.getUniformLocation does not exist`);
return addHeapObject(getObject(arg0).getShaderParameter(getObject(arg1), arg2));
};
__exports.__widl_f_get_uniform_location_WebGLRenderingContext = function(arg0, arg1, arg2, arg3) {
let varg2 = getStringFromWasm(arg2, arg3);
const val = __widl_f_get_uniform_location_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1), varg2);
const val = getObject(arg0).getUniformLocation(getObject(arg1), varg2);
return isLikeNone(val) ? 0 : addHeapObject(val);
};
const __widl_f_link_program_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.linkProgram || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.linkProgram does not exist`);
};
__exports.__widl_f_link_program_WebGLRenderingContext = function(arg0, arg1) {
__widl_f_link_program_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1));
};
const __widl_f_shader_source_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.shaderSource || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.shaderSource does not exist`);
getObject(arg0).linkProgram(getObject(arg1));
};
__exports.__widl_f_shader_source_WebGLRenderingContext = function(arg0, arg1, arg2, arg3) {
let varg2 = getStringFromWasm(arg2, arg3);
__widl_f_shader_source_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1), varg2);
};
const __widl_f_tex_parameteri_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.texParameteri || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.texParameteri does not exist`);
getObject(arg0).shaderSource(getObject(arg1), varg2);
};
__exports.__widl_f_tex_parameteri_WebGLRenderingContext = function(arg0, arg1, arg2, arg3) {
__widl_f_tex_parameteri_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2, arg3);
};
const __widl_f_uniform1i_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.uniform1i || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.uniform1i does not exist`);
getObject(arg0).texParameteri(arg1, arg2, arg3);
};
__exports.__widl_f_uniform1i_WebGLRenderingContext = function(arg0, arg1, arg2) {
__widl_f_uniform1i_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1), arg2);
};
const __widl_f_uniform2f_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.uniform2f || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.uniform2f does not exist`);
getObject(arg0).uniform1i(getObject(arg1), arg2);
};
__exports.__widl_f_uniform2f_WebGLRenderingContext = function(arg0, arg1, arg2, arg3) {
__widl_f_uniform2f_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1), arg2, arg3);
};
const __widl_f_use_program_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.useProgram || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.useProgram does not exist`);
getObject(arg0).uniform2f(getObject(arg1), arg2, arg3);
};
__exports.__widl_f_use_program_WebGLRenderingContext = function(arg0, arg1) {
__widl_f_use_program_WebGLRenderingContext_target.call(getObject(arg0), getObject(arg1));
};
const __widl_f_vertex_attrib_pointer_with_i32_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.vertexAttribPointer || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.vertexAttribPointer does not exist`);
getObject(arg0).useProgram(getObject(arg1));
};
__exports.__widl_f_vertex_attrib_pointer_with_i32_WebGLRenderingContext = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
__widl_f_vertex_attrib_pointer_with_i32_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2, arg3, arg4 !== 0, arg5, arg6);
};
const __widl_f_viewport_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.viewport || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.viewport does not exist`);
getObject(arg0).vertexAttribPointer(arg1, arg2, arg3, arg4 !== 0, arg5, arg6);
};
__exports.__widl_f_viewport_WebGLRenderingContext = function(arg0, arg1, arg2, arg3, arg4) {
__widl_f_viewport_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2, arg3, arg4);
};
const __widl_f_drawing_buffer_width_WebGLRenderingContext_target = GetOwnOrInheritedPropertyDescriptor(typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype, 'drawingBufferWidth').get || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.drawingBufferWidth does not exist`);
getObject(arg0).viewport(arg1, arg2, arg3, arg4);
};
__exports.__widl_f_drawing_buffer_width_WebGLRenderingContext = function(arg0) {
return __widl_f_drawing_buffer_width_WebGLRenderingContext_target.call(getObject(arg0));
};
const __widl_f_drawing_buffer_height_WebGLRenderingContext_target = GetOwnOrInheritedPropertyDescriptor(typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype, 'drawingBufferHeight').get || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.drawingBufferHeight does not exist`);
return getObject(arg0).drawingBufferWidth;
};
__exports.__widl_f_drawing_buffer_height_WebGLRenderingContext = function(arg0) {
return __widl_f_drawing_buffer_height_WebGLRenderingContext_target.call(getObject(arg0));
return getObject(arg0).drawingBufferHeight;
};
__exports.__widl_instanceof_Window = function(idx) {
@ -491,20 +330,20 @@ __exports.__widl_f_performance_Window = function(arg0) {
};
__exports.__wbg_new_c1b585153cd441ad = function(arg0) {
__exports.__wbg_new_1b06d86d496d7b40 = function(arg0) {
return addHeapObject(new Float32Array(getObject(arg0)));
};
__exports.__wbg_subarray_6bef35518c0617bd = function(arg0, arg1, arg2) {
__exports.__wbg_subarray_fe30ee182e9ec716 = function(arg0, arg1, arg2) {
return addHeapObject(getObject(arg0).subarray(arg1, arg2));
};
__exports.__wbg_newnoargs_6a80f84471205fc8 = function(arg0, arg1) {
__exports.__wbg_newnoargs_a6ad1b52f5989ea9 = function(arg0, arg1) {
let varg0 = getStringFromWasm(arg0, arg1);
return addHeapObject(new Function(varg0));
};
__exports.__wbg_call_582b20dfcad7fee4 = function(arg0, arg1, exnptr) {
__exports.__wbg_call_720151a19a4c6808 = function(arg0, arg1, exnptr) {
try {
return addHeapObject(getObject(arg0).call(getObject(arg1)));
} catch (e) {
@ -515,35 +354,35 @@ __exports.__wbg_call_582b20dfcad7fee4 = function(arg0, arg1, exnptr) {
}
};
__exports.__wbg_new_b192e0932f97e870 = function(arg0) {
__exports.__wbg_new_e9ac55ad4b35397d = function(arg0) {
return addHeapObject(new Int16Array(getObject(arg0)));
};
__exports.__wbg_subarray_46088290ce2ce733 = function(arg0, arg1, arg2) {
__exports.__wbg_subarray_930aeb4c907055d1 = function(arg0, arg1, arg2) {
return addHeapObject(getObject(arg0).subarray(arg1, arg2));
};
__exports.__wbg_new_bc68e7aae4d4f791 = function(arg0) {
__exports.__wbg_new_d90640b4228ff695 = function(arg0) {
return addHeapObject(new Uint8Array(getObject(arg0)));
};
__exports.__wbg_subarray_705096b76e15e94e = function(arg0, arg1, arg2) {
__exports.__wbg_subarray_ba3c433705738bca = function(arg0, arg1, arg2) {
return addHeapObject(getObject(arg0).subarray(arg1, arg2));
};
__exports.__wbg_new_3153ff3e90269012 = function(arg0) {
__exports.__wbg_new_1c85449424e3413d = function(arg0) {
return addHeapObject(new Uint16Array(getObject(arg0)));
};
__exports.__wbg_subarray_6f181829e5fd3854 = function(arg0, arg1, arg2) {
__exports.__wbg_subarray_08927d6d29836298 = function(arg0, arg1, arg2) {
return addHeapObject(getObject(arg0).subarray(arg1, arg2));
};
__exports.__wbg_instanceof_Memory_d223615e29613829 = function(idx) {
__exports.__wbg_instanceof_Memory_7db9a3f810fae661 = function(idx) {
return getObject(idx) instanceof WebAssembly.Memory ? 1 : 0;
};
__exports.__wbg_buffer_0413d5edaa0ff323 = function(arg0) {
__exports.__wbg_buffer_0346d756c794d630 = function(arg0) {
return addHeapObject(getObject(arg0).buffer);
};

BIN
docs/emigui_wasm_bg.wasm

Binary file not shown.

40
docs/index.html

@ -2,6 +2,11 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Disable zooming: -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<!-- TODO: read https://www.html5rocks.com/en/mobile/mobifying/#toc-meta-viewport -->
<head>
<title>Emigui – A experiment in an Immediate Mode GUI written in Rust</title>
<style>
@ -95,32 +100,59 @@
auto_resize_canvas(canvas);
paint_gui(canvas, get_input(canvas));
};
canvas.addEventListener("mousedown", function(event) {
g_mouse_pos = mouse_pos_from_event(canvas, event);
g_mouse_down = true;
repaint();
event.stopPropagation();
event.preventDefault();
});
canvas.addEventListener("mousemove", function(event) {
g_mouse_pos = mouse_pos_from_event(canvas, event);
repaint();
event.stopPropagation();
event.preventDefault();
});
canvas.addEventListener("mouseup", function(event) {
g_mouse_pos = mouse_pos_from_event(canvas, event);
g_mouse_down = false;
repaint();
event.stopPropagation();
event.preventDefault();
});
canvas.addEventListener("mouseleave", function(event) {
g_mouse_pos = { x: -1000.0, y: -1000.0 };
repaint();
event.stopPropagation();
event.preventDefault();
});
canvas.addEventListener("mousedown", function(event) {
g_mouse_pos = mouse_pos_from_event(canvas, event);
canvas.addEventListener("touchstart", function(event) {
// console.log(`touchstart ${JSON.stringify(event)}`);
g_mouse_pos = { x: event.touches[0].pageX, y: event.touches[0].pageY };
g_mouse_down = true;
repaint();
event.stopPropagation();
event.preventDefault();
});
canvas.addEventListener("mouseup", function(event) {
g_mouse_pos = mouse_pos_from_event(canvas, event);
canvas.addEventListener("touchmove", function(event) {
// console.log(`touchmove ${JSON.stringify(event)}`);
g_mouse_pos = { x: event.touches[0].pageX, y: event.touches[0].pageY };
repaint();
event.stopPropagation();
event.preventDefault();
});
canvas.addEventListener("touchend", function(event) {
// console.log(`touchend ${JSON.stringify(event)}`);
g_mouse_down = false;
repaint();
g_mouse_pos = { x: -1000.0, y: -1000.0 };
repaint();
event.stopPropagation();
event.preventDefault();
});
window.addEventListener("load", repaint);
window.addEventListener("pagehide", repaint);
window.addEventListener("pageshow", repaint);

4
emigui/src/fonts.rs

@ -29,8 +29,8 @@ pub struct Fonts {
impl Fonts {
pub fn new() -> Fonts {
let mut sizes = FontSizes::new();
sizes.insert(TextStyle::Body, 20.0);
sizes.insert(TextStyle::Button, 20.0);
sizes.insert(TextStyle::Body, 18.0);
sizes.insert(TextStyle::Button, 22.0);
sizes.insert(TextStyle::Heading, 30.0);
Fonts::from_sizes(sizes)
}

6
emigui/src/layout.rs

@ -299,6 +299,10 @@ impl Region {
&self.options
}
pub fn data(&self) -> &Arc<Data> {
&self.data
}
pub fn input(&self) -> &GuiInput {
self.data.input()
}
@ -329,7 +333,7 @@ impl Region {
);
let text: String = text.into();
let id = self.make_child_id(&text);
let text_style = TextStyle::Heading;
let text_style = TextStyle::Button;
let font = &self.fonts()[text_style];
let (text, text_size) = font.layout_multiline(&text, self.width());
let text_cursor = self.cursor + self.options().button_padding;

10
emigui/src/math.rs

@ -154,4 +154,14 @@ pub fn remap_clamp(from: f32, from_min: f32, from_max: f32, to_min: f32, to_max:
lerp(to_min, to_max, t)
}
pub fn clamp(x: f32, min: f32, max: f32) -> f32 {
if x <= min {
min
} else if x >= max {
max
} else {
x
}
}
pub const TAU: f32 = 2.0 * std::f32::consts::PI;

2
emigui_wasm/src/lib.rs

@ -44,7 +44,7 @@ impl State {
self.emigui.new_frame(raw_input);
let mut region = self.emigui.whole_screen_region();
let mut region = region.centered_column(480.0, Align::Min);
let mut region = region.centered_column(region.width().min(480.0), Align::Min);
self.app.show_gui(&mut region);
self.emigui.example(&mut region);

Loading…
Cancel
Save