mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Add support for hyperlinks
This commit is contained in:
@@ -196,12 +196,20 @@ function _assertClass(instance, klass) {
|
||||
/**
|
||||
* @param {State} state
|
||||
* @param {string} raw_input_json
|
||||
* @returns {string}
|
||||
*/
|
||||
__exports.run_gui = function(state, raw_input_json) {
|
||||
_assertClass(state, State);
|
||||
var ptr0 = passStringToWasm0(raw_input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.run_gui(state.ptr, ptr0, len0);
|
||||
try {
|
||||
_assertClass(state, State);
|
||||
var ptr0 = passStringToWasm0(raw_input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.run_gui(8, state.ptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[8 / 4 + 0];
|
||||
var r1 = getInt32Memory0()[8 / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
};
|
||||
|
||||
function isLikeNone(x) {
|
||||
|
||||
Binary file not shown.
@@ -56,8 +56,27 @@
|
||||
if (g_wasm_app === null) {
|
||||
g_wasm_app = wasm_bindgen.new_webgl_gui("canvas", pixels_per_point());
|
||||
}
|
||||
wasm_bindgen.run_gui(g_wasm_app, JSON.stringify(input));
|
||||
|
||||
let output = JSON.parse(wasm_bindgen.run_gui(g_wasm_app, JSON.stringify(input)));
|
||||
// console.log(`output: ${JSON.stringify(output)}`);
|
||||
document.body.style.cursor = from_emigui_cursor(output.cursor_icon);
|
||||
if (output.open_url) {
|
||||
window.open(output.open_url, "_self");
|
||||
}
|
||||
}
|
||||
|
||||
function from_emigui_cursor(cursor) {
|
||||
if (cursor == "no_drop") { return "no-drop"; }
|
||||
else if (cursor == "not_allowed") { return "not-allowed"; }
|
||||
else if (cursor == "resize_nw_se") { return "nwse-resize"; }
|
||||
else if (cursor == "pointing_hand") { return "pointer"; }
|
||||
// TODO: more
|
||||
else {
|
||||
// default, help, pointer, progress, wait, cell, crosshair, text, alias, copy, move, grab, grabbing,
|
||||
return cursor;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
var g_mouse_pos = null;
|
||||
var g_mouse_down = false;
|
||||
|
||||
Reference in New Issue
Block a user