Bugfix: Don't draw in the level behind open windows
* With the Window Manager update you can open the Level Settings window while editing a level, to change its wallpaper or page type. But you could "draw" in the level "through" the opened window. This bug is now fixed: if the cursor is on top of a managed UI window, the Canvas loop is not called.
This commit is contained in:
parent
f0101ba048
commit
d615619aba
|
@ -273,7 +273,8 @@ func (u *EditorUI) Loop(ev *event.State) error {
|
|||
u.ToolBar.Compute(u.d.Engine)
|
||||
|
||||
// Only forward events to the Canvas if the UI hasn't stopped them.
|
||||
if !stopPropagation {
|
||||
// Also ignore events if a managed ui.Window is overlapping the canvas.
|
||||
if !(stopPropagation || u.Supervisor.IsPointInWindow(u.cursor)) {
|
||||
u.Canvas.Loop(ev)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -29,15 +29,18 @@ func NewAddEditLevel(config AddEditLevel) *ui.Window {
|
|||
newPageType = level.Bounded.String()
|
||||
newWallpaper = "notebook.png"
|
||||
isNewLevel = config.EditLevel == nil
|
||||
title = "New Drawing"
|
||||
)
|
||||
|
||||
// Given a level to edit?
|
||||
if config.EditLevel != nil {
|
||||
newPageType = config.EditLevel.PageType.String()
|
||||
newWallpaper = config.EditLevel.Wallpaper
|
||||
title = "Page Settings"
|
||||
}
|
||||
|
||||
window := ui.NewWindow("New Drawing")
|
||||
window := ui.NewWindow(title)
|
||||
window.SetButtons(ui.CloseButton)
|
||||
window.Configure(ui.Config{
|
||||
Width: 540,
|
||||
Height: 350,
|
||||
|
@ -119,9 +122,8 @@ func NewAddEditLevel(config AddEditLevel) *ui.Window {
|
|||
******************/
|
||||
|
||||
label2 := ui.NewLabel(ui.Label{
|
||||
// Text: "Wallpaper",
|
||||
TextVariable: &newWallpaper,
|
||||
Font: balance.LabelFont,
|
||||
Text: "Wallpaper",
|
||||
Font: balance.LabelFont,
|
||||
})
|
||||
frame.Pack(label2, ui.Pack{
|
||||
Side: ui.N,
|
||||
|
@ -170,12 +172,6 @@ func NewAddEditLevel(config AddEditLevel) *ui.Window {
|
|||
******************/
|
||||
|
||||
bottomFrame := ui.NewFrame("Button Frame")
|
||||
// bottomFrame.Configure(ui.Config{
|
||||
// BorderSize: 1,
|
||||
// BorderStyle: ui.BorderSunken,
|
||||
// BorderColor: render.Black,
|
||||
// })
|
||||
// bottomFrame.SetBackground(render.Grey)
|
||||
frame.Pack(bottomFrame, ui.Pack{
|
||||
Side: ui.N,
|
||||
FillX: true,
|
||||
|
@ -221,7 +217,7 @@ func NewAddEditLevel(config AddEditLevel) *ui.Window {
|
|||
}
|
||||
for _, t := range buttons {
|
||||
// If we're editing settings on an existing level, skip the Continue.
|
||||
if isNewLevel && t.Label == "OK" {
|
||||
if (isNewLevel && t.Label == "OK") || (!isNewLevel && t.Label != "OK") {
|
||||
continue
|
||||
}
|
||||
btn := ui.NewButton(t.Label, ui.NewLabel(ui.Label{
|
||||
|
|
Loading…
Reference in New Issue
Block a user