Skip to content

fixed images.hover#1876

Merged
z16 merged 2 commits intoWindower:devfrom
Tylas11:dev
May 9, 2020
Merged

fixed images.hover#1876
z16 merged 2 commits intoWindower:devfrom
Tylas11:dev

Conversation

@Tylas11
Copy link
Copy Markdown
Contributor

@Tylas11 Tylas11 commented May 9, 2020

There was an error in the bounds calculation. The right/bottom sides were compared to pos + extents. But the extents are already a combination of pos + size.
Tested this using the drag & drop functionality. Before the fix, you could drag images by clicking outside their bounds.

@z16
Copy link
Copy Markdown
Member

z16 commented May 9, 2020

Good catch! Though if the offsets are not really offsets, I feel we should change the name to match. How about start_pos_x, start_pos_y, end_pos_x and end_pos_y?

Also, feel free to delete the print statement.

@Tylas11
Copy link
Copy Markdown
Contributor Author

Tylas11 commented May 9, 2020

Sure, I could rename them.
I also just noticed in the texts.lua there is a similar setup for hover, but it uses windower.text.get_extents which only returns width / height according to the documentation. Images uses a custom get_extents. This is kind of inconsistent and probably the cause of the bug, but I didn't want to change the images.get_extents function, who knows who uses it and what it would break.
Thoughts?

@z16
Copy link
Copy Markdown
Member

z16 commented May 9, 2020

Good catch and good instincts. Changing it at this point would likely cause too much breakage. Let's leave it as it is and just adjust this part where it is used. This fits well into the rapidly growing "lesson learned for v5" category.

@z16 z16 merged commit 2932a1d into Windower:dev May 9, 2020
z16 added a commit that referenced this pull request Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants