Skip to content

Conversation

yuxiqian
Copy link
Contributor

@yuxiqian yuxiqian commented Mar 28, 2023

Start IINA and play a video, open "Quick Settings" panel and select Crop - "Custom...". Drag the right edge over the left boundary and release. The cursor that should appear on the left edge will be lost.


Description:

In CropBoxView.swift, it uses a boxRect: NSRect to store currently selected clip region, and drew cursor rects around it to capture dragging events. boxRect.size can be negative, indicating that it expands southwest from its origin point.

However, NSRect.width and NSRect.height are always positive, so the cursor rects (colored in red) are misplaced.

A screenshot of misplaced cursor rects

Using NSRect.size.width and NSRect.size.height should fix this problem.

@low-batt low-batt linked an issue Mar 28, 2023 that may be closed by this pull request
1 task
@yuxiqian yuxiqian closed this Mar 28, 2023
Copy link
Member

@uiryuu uiryuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We always welcome new contributors! And I didn't notice that it's not needed to normalize after mouseUp, so your solution is actually better than mine! Please re-open your pull request if you want and follow the code review :)

return NSMakeRect(x, y, w, h)
}

rectTop = makeRect(x, y-2, w, 4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can call standardized after NSMakeRect, which does the exact same thing as your help function

Copy link
Contributor Author

@yuxiqian yuxiqian Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your advice! Reopened and cleaned up code.

@yuxiqian yuxiqian reopened this Mar 28, 2023
rectRight = NSMakeRect(x+w-2, y+2, 4, h-4)
let w = boxRect.size.width
let h = boxRect.size.height

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove trailing spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@uiryuu uiryuu requested a review from lhc70000 March 28, 2023 02:45
@uiryuu uiryuu merged commit b40f158 into iina:develop Mar 29, 2023
@uiryuu
Copy link
Member

uiryuu commented Mar 29, 2023

Thanks

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.

Custom crop view resize issues
2 participants