mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Fix division by zero when resizing the window to 0 size
This commit is contained in:
parent
38caf46fe0
commit
d3e12cde87
@ -974,6 +974,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
xsize, ysize = self.getSize()
|
||||
self.pixel2d = self.render2d.attachNewNode(PGTop("pixel2d"))
|
||||
self.pixel2d.setPos(-1, 0, 1)
|
||||
if xsize > 0 and ysize > 0:
|
||||
self.pixel2d.setScale(2.0 / xsize, 1.0, 2.0 / ysize)
|
||||
|
||||
def setupRender2dp(self):
|
||||
@ -1046,6 +1047,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.pixel2dp = self.render2dp.attachNewNode(PGTop("pixel2dp"))
|
||||
self.pixel2dp.node().setStartSort(16384)
|
||||
self.pixel2dp.setPos(-1, 0, 1)
|
||||
if xsize > 0 and ysize > 0:
|
||||
self.pixel2dp.setScale(2.0 / xsize, 1.0, 2.0 / ysize)
|
||||
|
||||
def getAspectRatio(self, win = None):
|
||||
@ -2461,6 +2463,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# If anybody needs to update their GUI, put a callback on this event
|
||||
messenger.send("aspectRatioChanged")
|
||||
|
||||
if win.getXSize() > 0 and win.getYSize() > 0:
|
||||
self.pixel2d.setScale(2.0 / win.getXSize(), 1.0, 2.0 / win.getYSize())
|
||||
self.pixel2dp.setScale(2.0 / win.getXSize(), 1.0, 2.0 / win.getYSize())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user