fix floating panels and iOS export picking
This commit is contained in:
@@ -194,25 +194,31 @@ void App::pick_file(std::vector<std::string> types, std::function<void (std::str
|
||||
}
|
||||
|
||||
#if __IOS__
|
||||
void App::pick_file_save(const std::string& type, std::function<void(std::string)> writer)
|
||||
void App::pick_file_save(const std::string& type, std::function<void(std::string)> writer,
|
||||
std::function<void(bool saved)> callback)
|
||||
{
|
||||
redraw = true;
|
||||
std::thread([=]{
|
||||
auto mb = input_box("Insert", "File name");
|
||||
std::string placeholder = "name." + type;
|
||||
mb->m_field_text->set_text(placeholder.c_str());
|
||||
mb->on_submit = [this, writer, type] (Node* target, std::string name) {
|
||||
std::string ext = "." + type;
|
||||
std::string path = data_path + "/" + name;
|
||||
if (name.find(ext) == std::string::npos)
|
||||
path += ext;
|
||||
auto mb = input_box("Insert", "File name");
|
||||
std::string placeholder = "name." + type;
|
||||
mb->m_field_text->set_text(placeholder.c_str());
|
||||
mb->on_submit = [this, writer, type, callback] (Node* target, std::string name) {
|
||||
std::string ext = "." + type;
|
||||
std::string path = data_path + "/" + name;
|
||||
if (name.find(ext) == std::string::npos)
|
||||
path += ext;
|
||||
std::thread([=]{
|
||||
writer(path);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[ios_view pick_file_save:path];
|
||||
});
|
||||
target->destroy();
|
||||
};
|
||||
}).detach();
|
||||
callback(true);
|
||||
}).detach();
|
||||
};
|
||||
mb->btn_cancel->on_click = [=] (Node* target) {
|
||||
callback(false);
|
||||
target->destroy();
|
||||
};
|
||||
}
|
||||
#else
|
||||
void App::pick_file_save(std::vector<std::string> types, std::function<void (std::string)> callback)
|
||||
|
||||
Reference in New Issue
Block a user