Fixed issue with opening files with Open button in web version
This commit is contained in:
parent
9cd9263afa
commit
f43e89161c
5 changed files with 17 additions and 12 deletions
|
|
@ -75,7 +75,7 @@ namespace CustomEvents {
|
|||
std::optional<std::filesystem::path> filePathSource;
|
||||
std::string netSource;
|
||||
std::string serverLocalID;
|
||||
std::string_view fileDataBuffer;
|
||||
std::string fileDataBuffer;
|
||||
};
|
||||
|
||||
struct AddFileToCanvasEvent {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,20 @@ bool DesktopDrawingProgramScreen::app_close_requested() {
|
|||
return toolbar.app_close_requested();
|
||||
}
|
||||
|
||||
void DesktopDrawingProgramScreen::input_drop_file_callback(const InputManager::DropCallbackArgs& drop) {
|
||||
if(std::filesystem::is_regular_file(drop.data)) {
|
||||
std::filesystem::path droppedFilePath(drop.data);
|
||||
if(droppedFilePath.has_extension() && droppedFilePath.extension().string() == std::string("." + World::FILE_EXTENSION)) {
|
||||
CustomEvents::emit_event<CustomEvents::OpenInfiniPaintFileEvent>({
|
||||
.isClient = false,
|
||||
.filePathSource = droppedFilePath
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
main.world->input_drop_file_callback(drop);
|
||||
}
|
||||
|
||||
void DesktopDrawingProgramScreen::input_key_callback(const InputManager::KeyCallbackArgs& key) {
|
||||
switch(key.key) {
|
||||
case InputManager::KEY_NOGUI: {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class DesktopDrawingProgramScreen : public DrawingProgramScreen {
|
|||
virtual void gui_layout_run() override;
|
||||
virtual bool app_close_requested() override;
|
||||
virtual void input_key_callback(const InputManager::KeyCallbackArgs& key) override;
|
||||
virtual void input_drop_file_callback(const InputManager::DropCallbackArgs& drop) override;
|
||||
virtual void input_text_key_callback(const InputManager::KeyCallbackArgs& key) override;
|
||||
virtual void open_file_selector(const std::string& filePickerName, const std::vector<ExtensionFilter>& extensionFilters, OpenFileSelectorCallback postSelectionFunc, const std::string& fileName = "", bool isSaving = false) override;
|
||||
virtual void on_tab_close() override;
|
||||
|
|
|
|||
|
|
@ -48,16 +48,6 @@ void DrawingProgramScreen::input_android_text_box_input_callback(const CustomEve
|
|||
}
|
||||
|
||||
void DrawingProgramScreen::input_drop_file_callback(const InputManager::DropCallbackArgs& drop) {
|
||||
if(std::filesystem::is_regular_file(drop.data)) {
|
||||
std::filesystem::path droppedFilePath(drop.data);
|
||||
if(droppedFilePath.has_extension() && droppedFilePath.extension().string() == std::string("." + World::FILE_EXTENSION)) {
|
||||
CustomEvents::emit_event<CustomEvents::OpenInfiniPaintFileEvent>({
|
||||
.isClient = false,
|
||||
.filePathSource = droppedFilePath
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
main.world->input_drop_file_callback(drop);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1278,7 +1278,7 @@ void Toolbar::open_world_file(bool isClient, const std::string& netSource, const
|
|||
.filePathSource = std::filesystem::path(fileName),
|
||||
.netSource = uD->nS,
|
||||
.serverLocalID = uD->sLID,
|
||||
.fileDataBuffer = buffer
|
||||
.fileDataBuffer = std::string(buffer)
|
||||
});
|
||||
}
|
||||
}, &uploadData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue