-
Notifications
You must be signed in to change notification settings - Fork 19
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
NS Scroll View Magnification #37
base: master
Are you sure you want to change the base?
Conversation
Fix issue where a layout manager's NSTextStorage could be `nil` at initialization but later set by introducing the `_setTextStorage:` method to NSTextView. Add stubs a for missing properties in NSTextView. Refactor `firstTextView` to properly find and return the first text view, or `nil` if there are no text views. Use 64-bit ready types where applicable. Relocate unrelated code from _setTextStorage
Adds code in `initWithData` to infer document format for RTF, HTML, and plaintext documents. Additionally refactors NSAttributedString to use the correct attribute types as described in Apple's documentation.
Add stubs for content size, frame size, and magnification size, and add basic implementations where feasible.
Implement NSTextTab handling based on the GNUStep implementation, with formatting and other adjustments.
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.
Haven't checked the changes in NSView.m
yet.
.vscode/settings.json
Outdated
{ | ||
"files.associations": { | ||
"*.embeddedhtml": "html", | ||
"type_traits": "cpp", | ||
"xtr1common": "cpp" | ||
} | ||
} |
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.
Looks like you accidentally commit your .vscode/settings.json
. Don't forget to remove it and rebase your changes.
_bounds.origin.x = _bounds.origin.x / size.width; | ||
_bounds.origin.y = _bounds.origin.y / 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.
Related to the above note, this would probably needs some adjustments to support negative values.
AppKit/NSScrollView.m
Outdated
// scale the content view centered at the given point | ||
NSRect frame = [_clipView frame]; | ||
NSSize scaledSize = NSMakeSize(frame.size.width*magnification, frame.size.height*magnification); | ||
NSPoint centeredOrigin = NSMakePoint(point.x - (newSize.width/2), point.y - (newSize.height/2)); | ||
[_clipView setFrame:NSMakeRect(centeredOrigin.x, centeredOrigin.y, scaledSize.width, scaledSize.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.
Were you able to verify that the contentView
does indeed get updated on macOS?
I'm having trouble verifying that it's frame get updated... =/
NSScrollView *_scrollView = [[NSScrollView alloc] init];
[_scrollView setFrame: NSMakeRect(0.0, 0.0, 480, 270)];
[[_scrollView documentView] setFrame: NSMakeRect(0.0, 0.0, 500, 1200)];
printFrame(_scrollView);
[scrollView minMagnification]: 0.250000
[scrollView maxMagnification]: 4.000000
[scrollView magnification]: 1.000000
[scrollView frame]->origin.x: 0.000000
[scrollView frame]->origin.y: 0.000000
[scrollView frame]->size.width: 480.000000
[scrollView frame]->size.height: 270.000000
[[scrollView contentView] frame]->origin.x: 0.000000
[[scrollView contentView] frame]->origin.y: 0.000000
[[scrollView contentView] frame]->size.width: 480.000000
[[scrollView contentView] frame]->size.height: 270.000000
[[scrollView documentView] frame]->origin.x: 0.000000
[[scrollView documentView] frame]->origin.y: 0.000000
[[scrollView documentView] frame]->size.width: 0.000000
[[scrollView documentView] frame]->size.height: 0.000000
[_scrollView setMagnification:10.0 centeredAtPoint:NSMakePoint(50, 50)];
printFrame(_scrollView);
[scrollView minMagnification]: 0.250000
[scrollView maxMagnification]: 4.000000
[scrollView magnification]: 4.000000
[scrollView frame]->origin.x: 0.000000
[scrollView frame]->origin.y: 0.000000
[scrollView frame]->size.width: 480.000000
[scrollView frame]->size.height: 270.000000
[[scrollView contentView] frame]->origin.x: 0.000000
[[scrollView contentView] frame]->origin.y: 0.000000
[[scrollView contentView] frame]->size.width: 480.000000
[[scrollView contentView] frame]->size.height: 270.000000
[[scrollView documentView] frame]->origin.x: 0.000000
[[scrollView documentView] frame]->origin.y: 0.000000
[[scrollView documentView] frame]->size.width: 0.000000
[[scrollView documentView] frame]->size.height: 0.000000
…tMagnfication through rect and point, and allowed negative values to be passed to scaleUnitSize
1ca619e
to
4ee3782
Compare
4ee3782
to
c190383
Compare
@CKegel @jvmespark Let me know when you are ready for me to review this PR. |
working to close:
https://github.com/users/CKegel/projects/1/views/1?pane=issue&itemId=51682446