Skip to content

Commit

Permalink
Fixed issue with closing layers in Gaia.
Browse files Browse the repository at this point in the history
Former-commit-id: f3b20a8
  • Loading branch information
bryanedds committed Dec 31, 2016
1 parent 3511ea7 commit 62e7001
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Nu/Nu.Gaia/GaiaModule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ module Gaia =
layerCreationForm.StartPosition <- FormStartPosition.CenterParent
layerCreationForm.dispatcherTextBox.Text <- typeof<LayerDispatcher>.Name
layerCreationForm.specializationTextBox.Text <- Constants.Engine.VanillaSpecialization
layerCreationForm.depthTextBox.Text <- scstring 0.0f
layerCreationForm.okButton.Click.Add ^ fun _ ->
addWorldChanger ^ fun world ->
let world = pushPastWorld world world
Expand All @@ -524,7 +525,9 @@ module Gaia =
let layerDispatcher = layerCreationForm.dispatcherTextBox.Text
let layerSpecialization = layerCreationForm.specializationTextBox.Text
try if Name.length layerName = 0 then failwith "Layer name cannot be empty in Gaia due to WinForms limitations."
let world = World.createLayer5 layerDispatcher (Some layerSpecialization) (Some layerName) Simulants.EditorScreen world |> snd
let layerDepth = Single.Parse layerCreationForm.depthTextBox.Text
let (layer, world) = World.createLayer5 layerDispatcher (Some layerSpecialization) (Some layerName) Simulants.EditorScreen world
let world = layer.SetDepth layerDepth world
refreshLayerTabs form world
form.layerTabs.SelectTab (form.layerTabs.TabPages.IndexOfKey layerNameStr)
world
Expand Down Expand Up @@ -570,7 +573,11 @@ module Gaia =
let world = World.destroyLayerImmediate layer world
deselectEntity form world
form.layerTabs.TabPages.RemoveByKey ^ Name.getNameStr layer.LayerName
world
World.updateUserState (fun editorState ->
let layerTabs = form.layerTabs
let layerTab = layerTabs.SelectedTab
{ editorState with SelectedLayer = stol Simulants.EditorScreen !!layerTab.Text })
world

let private handleFormUndo (form : GaiaForm) (_ : EventArgs) =
addWorldChanger ^ fun world ->
Expand Down

0 comments on commit 62e7001

Please sign in to comment.