Skip to content

Commit f195d4d

Browse files
committed
contributes from forum user to make DirectGui coordinate-system agnostic
1 parent 9d5325e commit f195d4d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

direct/src/gui/DirectGuiBase.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,22 @@ def setFrameSize(self, fClearFrame = 0):
931931
def getBounds(self, state = 0):
932932
self.stateNodePath[state].calcTightBounds(self.ll, self.ur)
933933
# Scale bounds to give a pad around graphics
934+
vec_right = Vec3.right()
935+
vec_up = Vec3.up()
936+
left = (vec_right[0] * self.ll[0]
937+
+ vec_right[1] * self.ll[1]
938+
+ vec_right[2] * self.ll[2])
939+
right = (vec_right[0] * self.ur[0]
940+
+ vec_right[1] * self.ur[1]
941+
+ vec_right[2] * self.ur[2])
942+
bottom = (vec_up[0] * self.ll[0]
943+
+ vec_up[1] * self.ll[1]
944+
+ vec_up[2] * self.ll[2])
945+
top = (vec_up[0] * self.ur[0]
946+
+ vec_up[1] * self.ur[1]
947+
+ vec_up[2] * self.ur[2])
948+
self.ll = Point3(left, 0.0, bottom)
949+
self.ur = Point3(right, 0.0, top)
934950
self.bounds = [self.ll[0] - self['pad'][0],
935951
self.ur[0] + self['pad'][0],
936952
self.ll[2] - self['pad'][1],

0 commit comments

Comments
 (0)