mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 07:58:04 +03:00
Return top and left values of 0 when not visible
This commit is contained in:
parent
8993258e74
commit
c7175c7e5f
@ -2037,6 +2037,25 @@ describe "Editor", ->
|
||||
runs ->
|
||||
expect(editor.getText()).toBe(originalPathText)
|
||||
|
||||
|
||||
describe ".pixelPositionForBufferPosition(position)", ->
|
||||
describe "when the editor is detached", ->
|
||||
it "returns top and left values of 0", ->
|
||||
expect(editor.isOnDom()).toBeFalsy()
|
||||
expect(editor.pixelPositionForBufferPosition([2,7])).toEqual top: 0, left: 0
|
||||
|
||||
describe "when the editor is invisible", ->
|
||||
it "returns top and left values of 0", ->
|
||||
editor.attachToDom()
|
||||
editor.hide()
|
||||
expect(editor.isVisible()).toBeFalsy()
|
||||
expect(editor.pixelPositionForBufferPosition([2,7])).toEqual top: 0, left: 0
|
||||
|
||||
describe "when the editor is attached and visible", ->
|
||||
it "returns the top and left pixel positions", ->
|
||||
editor.attachToDom()
|
||||
expect(editor.pixelPositionForBufferPosition([2,7])).toEqual top: 40, left: 70
|
||||
|
||||
describe "when clicking in the gutter", ->
|
||||
beforeEach ->
|
||||
editor.attachToDom()
|
||||
|
@ -1086,7 +1086,7 @@ class Editor extends View
|
||||
@pixelPositionForScreenPosition(@screenPositionForBufferPosition(position))
|
||||
|
||||
pixelPositionForScreenPosition: (position) ->
|
||||
return { top: 0, left: 0 } unless @isOnDom()
|
||||
return { top: 0, left: 0 } unless @isOnDom() and @isVisible()
|
||||
{row, column} = Point.fromObject(position)
|
||||
actualRow = Math.floor(row)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user