fix gui.cpp
This commit is contained in:
parent
849c85cd7a
commit
05acefd683
|
@ -40,16 +40,14 @@ JSC_CCALL(imgui_mainmenubar,
|
|||
}
|
||||
)
|
||||
|
||||
const char* imempty = "##empty";
|
||||
|
||||
JSC_CCALL(imgui_menuitem,
|
||||
char *name = !JS_Is(argv[0]) ? imempty : js2strdup(argv[0]);
|
||||
char *name = js2strdup(argv[0]);
|
||||
char *keyfn = JS_IsUndefined(argv[1]) ? NULL : js2strdup(argv[1]);
|
||||
bool on = JS_IsUndefined(argv[3]) ? false : js2boolean(argv[3]);
|
||||
if (ImGui::MenuItem(name,keyfn, &on))
|
||||
if (ImGui::MenuItem(JS_Is(argv[0]) ? name : "##empty" ,keyfn, &on))
|
||||
script_call_sym(argv[2], 0, NULL);
|
||||
|
||||
if (name != imempty) free(name);
|
||||
if (JS_Is(argv[0])) free(name);
|
||||
if (keyfn) free(keyfn);
|
||||
|
||||
return boolean2js(on);
|
||||
|
|
|
@ -412,7 +412,10 @@ HMM_Vec3 js2vec3(JSValue v)
|
|||
HMM_Vec3 js2vec3f(JSValue v)
|
||||
{
|
||||
HMM_Vec3 vec;
|
||||
vec.x = vec.y = vec.z = js2number(v);
|
||||
if (JS_IsArray(js, v))
|
||||
return js2vec3(v);
|
||||
else
|
||||
vec.x = vec.y = vec.z = js2number(v);
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue