Skip to content

Commit

Permalink
Add a small hack to ensure Window resets properly in non-primary moni…
Browse files Browse the repository at this point in the history
…tors
  • Loading branch information
3b1b committed Nov 6, 2023
1 parent 246a010 commit 8a4d7b4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions manimlib/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(
self,
scene: Scene,
size: tuple[int, int] = (1280, 720),
samples = 0
samples: int = 0
):
scene.window = self
super().__init__(size=size, samples=samples)
Expand All @@ -47,9 +47,12 @@ def __init__(
self.to_default_position()

def to_default_position(self):
self.size = self.default_size
self.position = self.default_position
self.swap_buffers()
# Hack. Sometimes, namely when configured to open in a separate window,
# the window needs to be resized to display correctly.
w, h = self.default_size
self.size = (w - 1, h - 1)
self.size = (w, h)

def find_initial_position(self, size: tuple[int, int]) -> tuple[int, int]:
custom_position = get_customization()["window_position"]
Expand Down

0 comments on commit 8a4d7b4

Please sign in to comment.