mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
ui: More precise space calc
This commit is contained in:
parent
d5a2bdd7ac
commit
c5fc7ea0ab
@ -263,7 +263,7 @@ func (u *userInterface) setScreenSize(width, height, scale int) bool {
|
|||||||
canvasStyle.Set("width", strconv.Itoa(cssWidth)+"px")
|
canvasStyle.Set("width", strconv.Itoa(cssWidth)+"px")
|
||||||
canvasStyle.Set("height", strconv.Itoa(cssHeight)+"px")
|
canvasStyle.Set("height", strconv.Itoa(cssHeight)+"px")
|
||||||
// CSS calc requires space chars.
|
// CSS calc requires space chars.
|
||||||
canvasStyle.Set("left", "calc(50% - "+strconv.Itoa(cssWidth/2)+"px)")
|
canvasStyle.Set("left", "calc((100% - "+strconv.Itoa(cssWidth)+"px) / 2)")
|
||||||
canvasStyle.Set("top", "calc(50% - "+strconv.Itoa(cssHeight/2)+"px)")
|
canvasStyle.Set("top", "calc((100% - "+strconv.Itoa(cssHeight)+"px) / 2)")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user