Ensure underlayer and overlayer are always the same width as lines

Also… simplify CSS rules for lines element. No display table or padding, instead we just set the min width when typing.
This commit is contained in:
Corey Johnson & Nathan Sobo
2012-11-09 11:12:33 -07:00
parent d739736997
commit 7c16c48e2a
3 changed files with 8 additions and 12 deletions

View File

@@ -819,8 +819,8 @@ fdescribe "Editor", ->
expect(region1.position().top).toBeCloseTo(2 * lineHeight)
expect(region1.position().left).toBeCloseTo(7 * charWidth)
expect(region1.height()).toBeCloseTo lineHeight
expect(region1.width()).toBeCloseTo(editor.renderedLines.outerWidth() - region1.position().left)
expect(region1.width()).toBeCloseTo(editor.renderedLines.outerWidth() - region1.position().left)
region2 = selectionView.regions[1]
expect(region2.position().top).toBeCloseTo(3 * lineHeight)
expect(region2.position().left).toBeCloseTo(0)
@@ -837,8 +837,8 @@ fdescribe "Editor", ->
expect(region1.position().top).toBeCloseTo(2 * lineHeight)
expect(region1.position().left).toBeCloseTo(7 * charWidth)
expect(region1.height()).toBeCloseTo lineHeight
expect(region1.width()).toBeCloseTo(editor.renderedLines.outerWidth() - region1.position().left)
expect(region1.width()).toBeCloseTo(editor.renderedLines.outerWidth() - region1.position().left)
region2 = selectionView.regions[1]
expect(region2.position().top).toBeCloseTo(3 * lineHeight)
expect(region2.position().left).toBeCloseTo(0)

View File

@@ -730,7 +730,7 @@ class Editor extends View
@renderedLines.css('padding-bottom', heightOfRenderedLines)
adjustMinWidthOfRenderedLines: ->
minWidth = @charWidth * @maxScreenLineLength()
minWidth = @charWidth * @maxScreenLineLength() + 20
unless @renderedLines.cachedMinWidth == minWidth
@renderedLines.css('min-width', minWidth)
@underlayer.css('min-width', minWidth)

View File

@@ -73,32 +73,28 @@
overflow-x: hidden;
}
.editor .underlayer, .editor .overlayer {
pointer-events: none;
position: absolute;
.editor .underlayer, .editor .lines, .editor .overlayer {
width: 100%;
height: 100%;
}
.editor .underlayer {
z-index: 0;
position: absolute;
}
.editor .lines {
position: relative;
display: table;
height: 100%;
width: 100%;
/*overflow: hidden; i'm worried this is causing rendering problems */
padding-right: 2em;
z-index: 1;
}
.editor .overlayer {
z-index: 2;
pointer-events: none;
position: absolute;
}
.editor .line span {
vertical-align: top;
}