Skip to content
Snippets Groups Projects
Unverified Commit bac7e3a7 authored by Marcin Krzyzanowski's avatar Marcin Krzyzanowski
Browse files

Fix gutter view positioning and clipping

The gutter view now properly clips its contents and maintains correct positioning
when scrolling. This fixes positioning issues by using the frame's minX instead of
bounds.minX for line number cell placement and adds explicit setting of both x and y
coordinates when positioning the gutter view during layout.
parent a7d2e88e
Branches
Tags
No related merge requests found
......@@ -92,6 +92,7 @@ open class STGutterView: UIView {
markerContainerView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
super.init(frame: frame)
clipsToBounds = true
isUserInteractionEnabled = true
isOpaque = false
......
......@@ -35,7 +35,10 @@ extension STTextView {
internal func layoutGutter() {
if let gutterView {
gutterView.frame.origin = contentOffset
// gutter view floats on the edge
// the contentOffset is the adjustment to make it visible
gutterView.frame.origin.x = contentOffset.x
gutterView.frame.origin.y = contentOffset.y
gutterView.frame.size.height = visibleSize.height
layoutGutterLineNumbers()
}
......@@ -90,7 +93,7 @@ extension STTextView {
numberCell.frame = CGRect(
origin: CGPoint(
x: bounds.minX,
x: frame.minX,
y: selectionFrame.origin.y - contentOffset.y
),
size: CGSize(
......@@ -225,7 +228,7 @@ extension STTextView {
numberCell.frame = CGRect(
origin: CGPoint(
x: bounds.minX,
x: frame.minX,
y: lineFragmentFrame.origin.y
),
size: CGSize(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment