Hi! I am having trouble to zoom in and out in WebView. I have a subclass of WebView with the following zoom code:
- (void)zoomByFactor:(CGFloat)factor { WebFrameView *frameView = self.mainFrame.frameView; NSView <WebDocumentView> *const docView = frameView.documentView; NSScrollView *scrollView = docView.enclosingScrollView; NSClipView *clipView = scrollView.contentView; NSView *viewToScale = docView; NSSize oldScale = [viewToScale convertSize:UNIT_SIZE toView:nil]; NSSize newScale = NSMakeSize(oldScale.width * factor, oldScale.height * factor); [viewToScale scaleUnitSquareToSize:[viewToScale convertSize:UNIT_SIZE fromView:nil]]; [docView scaleUnitSquareToSize:newScale]; [docView setFrameSize:[docView convertSize:[docView bounds].size toView:nil]]; [docView setNeedsLayout:YES]; [self setNeedsDisplay:YES]; } where UNIT_SIZE = NSMakeSize(1, 1). Zooming out seems to work, however, zooming in does not work. The web page gets zoomed in, however, the page gets clipped on the right side. There is a white strip. Zooming in further makes that white strip wider. Am I missing some convenient method? If not, how can I properly zoom a WebView? Thanks in advance, Tae _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com