From 1b1973db151e8cedc5b3bf54980940f7ec6a061d Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 4 May 2017 16:49:14 -0600 Subject: [PATCH] Rename method to match old implementation --- spec/text-editor-component-spec.js | 16 ++++++++-------- src/text-editor-component.js | 2 +- src/text-editor-element.js | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/text-editor-component-spec.js b/spec/text-editor-component-spec.js index f4abd9544..3333c1d1d 100644 --- a/spec/text-editor-component-spec.js +++ b/spec/text-editor-component-spec.js @@ -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]) diff --git a/src/text-editor-component.js b/src/text-editor-component.js index bc32dd206..51da03222 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -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) { diff --git a/src/text-editor-element.js b/src/text-editor-element.js index 275b3b702..d56c5596b 100644 --- a/src/text-editor-element.js +++ b/src/text-editor-element.js @@ -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) {