Skip to content

Commit

Permalink
Animation editor: Fix crash when dragging frames.
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFreezed committed Aug 14, 2020
1 parent bec1111 commit 6c92eff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/gui.gloa
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ local register :: (state:State, el:Element, T:Type) -> Element {
return el
}

local unregisterTree :: (state:State, el:Element) {
do {
local unregisterTree :: (state:State, el:Element, updateInteractions:bool) {
if updateInteractions { -- @Hack!
if state.focusId == el.id state.blurFocus!(abort=false)
if state.activeId == el.id state.cancelMouseActions!()

Expand All @@ -269,7 +269,7 @@ local unregisterTree :: (state:State, el:Element) {
remove(state.scrollables, i)
}

for el unregisterTree(state, it)
for el unregisterTree(state, it, updateInteractions)
}


Expand Down Expand Up @@ -3383,22 +3383,22 @@ export hideContextMenu :: (state:State, mayDeactivateSubmenu=false) -> (success:



export delete :: (state:State, el:Element) {
export delete :: (state:State, el:Element, updateInteractions=true) {
updateLayoutIfNeeded(state) -- Needed for parents. @Speed

if el.type == Frame {
local frame = cast(Frame) el
local found, i = indexOf(state.frames, frame)
if not found return

unregisterTree(state, frame)
unregisterTree(state, frame, updateInteractions)
remove(state.frames, i)

} else {
local found, i = indexOf(el.parent, el)
if not found return

unregisterTree(state, el)
unregisterTree(state, el, updateInteractions)
remove(el.parent, i)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/guiSetup.gloa
Original file line number Diff line number Diff line change
Expand Up @@ -3687,7 +3687,7 @@ export setupGuiCallbacks :: () {
guiState.onRefresh.animation_frames = (vbox:gui.Vbox) {
local project, system = getCurrentProjectAndSystem()

for < vbox guiState.delete!(it)
for < vbox guiState.delete!(it, updateInteractions=false)

for system.frames {
local inputValue = format("%s %s %s %s", it.x, it.y, it.w, it.h)
Expand Down

0 comments on commit 6c92eff

Please sign in to comment.