mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-07-03 11:55:22 +00:00
Merge pull request #1033 from cardoso/fix/close_panel_viewport
Fix viewport and minipanel positions when closing panels via UI button
This commit is contained in:
commit
c0c8df6701
|
@ -574,7 +574,6 @@ func (g *GameControls) clearLeftScreenSide() {
|
||||||
|
|
||||||
g.questLog.Close()
|
g.questLog.Close()
|
||||||
g.hud.skillSelectMenu.ClosePanels()
|
g.hud.skillSelectMenu.ClosePanels()
|
||||||
g.hud.miniPanel.SetMovedRight(false)
|
|
||||||
g.updateLayout()
|
g.updateLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +581,6 @@ func (g *GameControls) clearRightScreenSide() {
|
||||||
g.inventory.Close()
|
g.inventory.Close()
|
||||||
g.skilltree.Close()
|
g.skilltree.Close()
|
||||||
g.hud.skillSelectMenu.ClosePanels()
|
g.hud.skillSelectMenu.ClosePanels()
|
||||||
g.hud.miniPanel.SetMovedLeft(false)
|
|
||||||
g.updateLayout()
|
g.updateLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +599,6 @@ func (g *GameControls) openLeftPanel(panel Panel) {
|
||||||
|
|
||||||
if !isOpen {
|
if !isOpen {
|
||||||
panel.Open()
|
panel.Open()
|
||||||
g.hud.miniPanel.SetMovedRight(true)
|
|
||||||
g.updateLayout()
|
g.updateLayout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -615,7 +612,6 @@ func (g *GameControls) openRightPanel(panel Panel) {
|
||||||
|
|
||||||
if !isOpen {
|
if !isOpen {
|
||||||
panel.Open()
|
panel.Open()
|
||||||
g.hud.miniPanel.SetMovedLeft(true)
|
|
||||||
g.updateLayout()
|
g.updateLayout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,6 +626,7 @@ func (g *GameControls) togglePartyPanel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameControls) onCloseHeroStatsPanel() {
|
func (g *GameControls) onCloseHeroStatsPanel() {
|
||||||
|
g.updateLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameControls) toggleLeftSkillPanel() {
|
func (g *GameControls) toggleLeftSkillPanel() {
|
||||||
|
@ -651,6 +648,7 @@ func (g *GameControls) toggleQuestLog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameControls) onCloseQuestLog() {
|
func (g *GameControls) onCloseQuestLog() {
|
||||||
|
g.updateLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameControls) toggleHelpOverlay() {
|
func (g *GameControls) toggleHelpOverlay() {
|
||||||
|
@ -668,6 +666,7 @@ func (g *GameControls) toggleInventoryPanel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameControls) onCloseInventory() {
|
func (g *GameControls) onCloseInventory() {
|
||||||
|
g.updateLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameControls) toggleSkilltreePanel() {
|
func (g *GameControls) toggleSkilltreePanel() {
|
||||||
|
@ -675,6 +674,7 @@ func (g *GameControls) toggleSkilltreePanel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameControls) onCloseSkilltree() {
|
func (g *GameControls) onCloseSkilltree() {
|
||||||
|
g.updateLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameControls) openEscMenu() {
|
func (g *GameControls) openEscMenu() {
|
||||||
|
@ -740,10 +740,13 @@ func (g *GameControls) updateLayout() {
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case isRightPanelOpen == isLeftPanelOpen:
|
case isRightPanelOpen == isLeftPanelOpen:
|
||||||
|
g.hud.miniPanel.ResetPosition()
|
||||||
g.mapRenderer.ViewportDefault()
|
g.mapRenderer.ViewportDefault()
|
||||||
case isRightPanelOpen:
|
case isRightPanelOpen:
|
||||||
|
g.hud.miniPanel.SetMovedRight(true)
|
||||||
g.mapRenderer.ViewportToLeft()
|
g.mapRenderer.ViewportToLeft()
|
||||||
case isLeftPanelOpen:
|
case isLeftPanelOpen:
|
||||||
|
g.hud.miniPanel.SetMovedLeft(true)
|
||||||
g.mapRenderer.ViewportToRight()
|
g.mapRenderer.ViewportToRight()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,6 +331,16 @@ func (m *miniPanel) SetMovedLeft(moveLeft bool) {
|
||||||
m.movedLeft = moveLeft
|
m.movedLeft = moveLeft
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *miniPanel) ResetPosition() {
|
||||||
|
if m.movedLeft {
|
||||||
|
m.undoMoveLeft()
|
||||||
|
m.movedLeft = false
|
||||||
|
} else if m.movedRight {
|
||||||
|
m.undoMoveRight()
|
||||||
|
m.movedRight = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (m *miniPanel) SetMovedRight(moveRight bool) {
|
func (m *miniPanel) SetMovedRight(moveRight bool) {
|
||||||
if m.movedRight == moveRight {
|
if m.movedRight == moveRight {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user