I was unable to set any "mode" kinda value on pad since "v8_to_gvalue" cast any number type to gfloat. Forking and add the below code solves my issue, is there a better way of doing this?
if (v->IsNumber()) { auto number = v->ToNumber(Nan::GetCurrentContext()).ToLocalChecked(); if (number->IsInt32()) { g_value_init(gv, G_TYPE_INT); g_value_set_int(gv, number->ToInteger(Nan::GetCurrentContext()).ToLocalChecked()->Value()); } else { g_value_init(gv, G_TYPE_FLOAT); g_value_set_float(gv, number->Value()); } }
I was unable to set any "mode" kinda value on pad since "v8_to_gvalue" cast any number type to gfloat. Forking and add the below code solves my issue, is there a better way of doing this?
if (v->IsNumber()) { auto number = v->ToNumber(Nan::GetCurrentContext()).ToLocalChecked(); if (number->IsInt32()) { g_value_init(gv, G_TYPE_INT); g_value_set_int(gv, number->ToInteger(Nan::GetCurrentContext()).ToLocalChecked()->Value()); } else { g_value_init(gv, G_TYPE_FLOAT); g_value_set_float(gv, number->Value()); } }