Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update origami.py #1

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions origami.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,20 @@ def _on_resize_panes(self, orientation, cells, relevant_index, orig_data, text):
layout = self._on_resize_panes_get_layout(orientation, cells, relevant_index, orig_data, text)
self.window.set_layout(layout)

def zoom_pane(self, fraction):
if fraction is None:
fraction = .9
def zoom_pane(self, auto_zoom):
# if fraction is None:
# fraction = .9
fraction = .9
height = .9
# if isinstance(auto_zoom, float|int):
if isinstance(auto_zoom, float) or isinstance(auto_zoom, int):
fraction = auto_zoom
elif isinstance(auto_zoom, list):
fraction = auto_zoom[0]
height = auto_zoom[1]

fraction = min(1, max(0, fraction))
height = min(1, max(0, height))

window = self.window
rows, cols, cells = self.get_layout()
Expand All @@ -334,7 +343,8 @@ def zoom_pane(self, fraction):
current_row = current_cell[1]
num_rows = len(rows) - 1

current_row_height = 1 if num_rows == 1 else fraction
# current_row_height = 1 if num_rows == 1 else fraction
current_row_height = 1 if num_rows == 1 else height
other_row_height = 0 if num_rows == 1 else (1 - current_row_height) / (num_rows - 1)
rows = [0.0]
for i in range(num_rows):
Expand Down