1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-21 14:45:24 +00:00

fix bug from PR#369 (#370)

* camera offset for ui panels :

added maprenderer viewport to be aligned left or right

calling alignement on keyPress in game_controls

* check if already aligned

* fix bugs

-forgot to assign alignement
-defaultScreenRect instead of screenRect because of issue mentionned in original comment

* remove config.json and replace go.mod line
This commit is contained in:
Haashi 2020-06-21 22:06:11 +02:00 committed by GitHub
parent afe4a3a25a
commit 7ba3cb702d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -98,7 +98,7 @@ func (v *Viewport) IsTileRectVisible(rect d2common.Rectangle) bool {
func (v *Viewport) IsOrthoRectVisible(x1, y1, x2, y2 float64) bool {
screenX1, screenY1 := v.OrthoToScreen(x1, y1)
screenX2, screenY2 := v.OrthoToScreen(x2, y2)
return !(screenX1 >= v.screenRect.Width || screenX2 < 0 || screenY1 >= v.screenRect.Height || screenY2 < 0)
return !(screenX1 >= v.defaultScreenRect.Width || screenX2 < 0 || screenY1 >= v.defaultScreenRect.Height || screenY2 < 0)
}
func (v *Viewport) GetTranslationOrtho() (float64, float64) {
@ -150,6 +150,7 @@ func (v *Viewport) toLeft() {
return
}
v.screenRect.Width = v.defaultScreenRect.Width / 2
v.align = left
}
func (v *Viewport) toRight() {
@ -158,6 +159,7 @@ func (v *Viewport) toRight() {
}
v.screenRect.Width = v.defaultScreenRect.Width / 2
v.screenRect.Left = v.defaultScreenRect.Left + v.defaultScreenRect.Width/2
v.align = right
}
func (v *Viewport) resetAlign() {
@ -166,4 +168,5 @@ func (v *Viewport) resetAlign() {
}
v.screenRect.Width = v.defaultScreenRect.Width
v.screenRect.Left = v.defaultScreenRect.Left
v.align = center
}

1
go.mod
View File

@ -15,3 +15,4 @@ require (
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/sourcemap.v1 v1.0.5 // indirect
)