-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix: cursor lost when dragging clip view edges #4302
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
Conversation
There was a problem hiding this 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 :)
iina/CropBoxView.swift
Outdated
return NSMakeRect(x, y, w, h) | ||
} | ||
|
||
rectTop = makeRect(x, y-2, w, 4) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
iina/CropBoxView.swift
Outdated
rectRight = NSMakeRect(x+w-2, y+2, 4, h-4) | ||
let w = boxRect.size.width | ||
let h = boxRect.size.height | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove trailing spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks |
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 aboxRect: 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
andNSRect.height
are always positive, so the cursor rects (colored in red) are misplaced.Using
NSRect.size.width
andNSRect.size.height
should fix this problem.