Rename method to match old implementation

This commit is contained in:
Nathan Sobo
2017-05-04 16:49:14 -06:00
committed by Antonio Scandurra
parent c00ad62a0e
commit 1b1973db15
3 changed files with 11 additions and 11 deletions

View File

@@ -3091,7 +3091,7 @@ describe('TextEditorComponent', () => {
})
})
describe('pixelPositionForScreenPositionSync(point)', () => {
describe('pixelPositionForScreenPosition(point)', () => {
it('returns the pixel position for the given point, regardless of whether or not it is currently on screen', async () => {
const {component, element, editor} = buildComponent({rowsPerTile: 2, autoHeight: false})
await setEditorHeightInLines(component, 3)
@@ -3101,19 +3101,19 @@ describe('TextEditorComponent', () => {
const referenceContentRect = referenceComponent.refs.content.getBoundingClientRect()
{
const {top, left} = component.pixelPositionForScreenPositionSync({row: 0, column: 0})
const {top, left} = component.pixelPositionForScreenPosition({row: 0, column: 0})
expect(top).toBe(clientTopForLine(referenceComponent, 0) - referenceContentRect.top)
expect(left).toBe(clientLeftForCharacter(referenceComponent, 0, 0) - referenceContentRect.left)
}
{
const {top, left} = component.pixelPositionForScreenPositionSync({row: 0, column: 5})
const {top, left} = component.pixelPositionForScreenPosition({row: 0, column: 5})
expect(top).toBe(clientTopForLine(referenceComponent, 0) - referenceContentRect.top)
expect(left).toBe(clientLeftForCharacter(referenceComponent, 0, 5) - referenceContentRect.left)
}
{
const {top, left} = component.pixelPositionForScreenPositionSync({row: 12, column: 1})
const {top, left} = component.pixelPositionForScreenPosition({row: 12, column: 1})
expect(top).toBe(clientTopForLine(referenceComponent, 12) - referenceContentRect.top)
expect(left).toBe(clientLeftForCharacter(referenceComponent, 12, 1) - referenceContentRect.left)
}
@@ -3128,28 +3128,28 @@ describe('TextEditorComponent', () => {
const {component: referenceComponent} = buildComponent()
{
const pixelPosition = referenceComponent.pixelPositionForScreenPositionSync({row: 0, column: 0})
const pixelPosition = referenceComponent.pixelPositionForScreenPosition({row: 0, column: 0})
pixelPosition.top += component.getLineHeight() / 3
pixelPosition.left += component.getBaseCharacterWidth() / 3
expect(component.screenPositionForPixelPosition(pixelPosition)).toEqual([0, 0])
}
{
const pixelPosition = referenceComponent.pixelPositionForScreenPositionSync({row: 0, column: 5})
const pixelPosition = referenceComponent.pixelPositionForScreenPosition({row: 0, column: 5})
pixelPosition.top += component.getLineHeight() / 3
pixelPosition.left += component.getBaseCharacterWidth() / 3
expect(component.screenPositionForPixelPosition(pixelPosition)).toEqual([0, 5])
}
{
const pixelPosition = referenceComponent.pixelPositionForScreenPositionSync({row: 5, column: 7})
const pixelPosition = referenceComponent.pixelPositionForScreenPosition({row: 5, column: 7})
pixelPosition.top += component.getLineHeight() / 3
pixelPosition.left += component.getBaseCharacterWidth() / 3
expect(component.screenPositionForPixelPosition(pixelPosition)).toEqual([5, 7])
}
{
const pixelPosition = referenceComponent.pixelPositionForScreenPositionSync({row: 12, column: 1})
const pixelPosition = referenceComponent.pixelPositionForScreenPosition({row: 12, column: 1})
pixelPosition.top += component.getLineHeight() / 3
pixelPosition.left += component.getBaseCharacterWidth() / 3
expect(component.screenPositionForPixelPosition(pixelPosition)).toEqual([12, 1])

View File

@@ -165,7 +165,7 @@ class TextEditorComponent {
this.scheduleUpdate()
}
pixelPositionForScreenPositionSync ({row, column}) {
pixelPositionForScreenPosition ({row, column}) {
const top = this.pixelPositionAfterBlocksForRow(row)
let left = column === 0 ? 0 : this.pixelLeftForRowAndColumn(row, column)
if (left == null) {

View File

@@ -225,7 +225,7 @@ class TextEditorElement extends HTMLElement {
// pixel position.
pixelPositionForBufferPosition (bufferPosition) {
const screenPosition = this.getModel().screenPositionForBufferPosition(bufferPosition)
return this.getComponent().pixelPositionForScreenPositionSync(screenPosition)
return this.getComponent().pixelPositionForScreenPosition(screenPosition)
}
// Extended: Converts a screen position to a pixel position.
@@ -240,7 +240,7 @@ class TextEditorElement extends HTMLElement {
// pixel position.
pixelPositionForScreenPosition (screenPosition) {
screenPosition = this.getModel().clipScreenPosition(screenPosition)
return this.getComponent().pixelPositionForScreenPositionSync(screenPosition)
return this.getComponent().pixelPositionForScreenPosition(screenPosition)
}
screenPositionForPixelPosition (pixelPosition) {