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

🪲 Paste exactly where the mouse is #224

Merged
merged 1 commit into from
Jan 15, 2022
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
15 changes: 4 additions & 11 deletions pyflow/scene/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,10 @@ def _serializeSelected(self, delete=False) -> OrderedDict:
return data

def _find_bbox_center(self, blocks_data):
xmin, xmax, ymin, ymax = 0, 0, 0, 0
for block_data in blocks_data:
x, y = block_data["position"]
if x < xmin:
xmin = x
if x > xmax:
xmax = x
if y < ymin:
ymin = y
if y > ymax:
ymax = y
xmin = min(block["position"][0] for block in blocks_data)
xmax = max(block["position"][0] + block["width"] for block in blocks_data)
ymin = min(block["position"][1] for block in blocks_data)
ymax = max(block["position"][1] + block["height"] for block in blocks_data)
return (xmin + xmax) / 2, (ymin + ymax) / 2

def _deserializeData(self, data: OrderedDict, set_selected=True):
Expand Down