Fix (UI): closing UI cause state loss

This commit is contained in:
Oğuzhan Koral
2023-01-06 16:25:52 +03:00
committed by GitHub
+5 -1
View File
@@ -29,11 +29,12 @@ module SpeckleConnector
# Show dialog if it's not visible yet
def show
bring_to_front if html_dialog.visible?
return if html_dialog.visible?
# reset dialog only if it is marked ready, otherwise
# add_exec_callback is triggered twice upon first initialization
reset_dialog! if @ready
reset_dialog!
html_dialog.show
end
@@ -73,6 +74,9 @@ module SpeckleConnector
# @return [UI::HtmlDialog] the Sketchup interface to html dialog
def init_dialog
dialog = UI::HtmlDialog.new(@dialog_specs)
dialog.set_can_close do
true
end
File.exist?(@htm_file) ? dialog.set_file(@htm_file) : dialog.set_url('http://localhost:8081')
# dialog.set_url('http://localhost:8081') # uncomment this line if you want to use your local version of ui
add_exec_callback(dialog)