mirror of
https://github.com/atom/atom.git
synced 2026-02-03 19:25:06 -05:00
🎨 Rename to ::onWillNeedMeasurements
This commit is contained in:
@@ -224,12 +224,12 @@ describe "TextEditorPresenter", ->
|
||||
presenter = buildPresenter()
|
||||
expectNoStateUpdate presenter, -> presenter.getState()
|
||||
|
||||
it "triggers ::onWillMeasure events before computing any state that needs measurement", ->
|
||||
it "triggers ::onWillNeedMeasurements events before computing any state that needs measurement", ->
|
||||
editor.setCursorBufferPosition([0, 0])
|
||||
cursorLine = editor.tokenizedLineForScreenRow(0)
|
||||
called = false
|
||||
|
||||
onWillMeasureSpy = (state) ->
|
||||
onWillNeedMeasurementsSpy = (state) ->
|
||||
called = true
|
||||
expect(Object.keys(state.content.tiles).length).toBeGreaterThan(0)
|
||||
for tile, tileState of state.content.tiles
|
||||
@@ -245,7 +245,7 @@ describe "TextEditorPresenter", ->
|
||||
|
||||
presenter = buildPresenter(explicitHeight: 6, scrollTop: 0, lineHeight: 1, tileSize: 2)
|
||||
|
||||
presenter.onWillMeasure(onWillMeasureSpy)
|
||||
presenter.onWillNeedMeasurements(onWillNeedMeasurementsSpy)
|
||||
presenter.getState()
|
||||
|
||||
expect(called).toBe(true)
|
||||
|
||||
@@ -83,7 +83,7 @@ class TextEditorComponent
|
||||
|
||||
@linesYardstick = new LinesYardstick(@editor, this)
|
||||
@presenter.setLinesYardstick(@linesYardstick)
|
||||
@presenter.onWillMeasure(@updateLinesComponentSync)
|
||||
@presenter.onWillNeedMeasurements(@updateLinesComponentSync)
|
||||
|
||||
@horizontalScrollbarComponent = new ScrollbarComponent({orientation: 'horizontal', onScroll: @onHorizontalScroll})
|
||||
@scrollViewNode.appendChild(@horizontalScrollbarComponent.getDomNode())
|
||||
|
||||
@@ -44,8 +44,8 @@ class TextEditorPresenter
|
||||
@disposables.dispose()
|
||||
|
||||
# Calls your `callback` while performing ::getState(), before computing any state that needs measurements.
|
||||
onWillMeasure: (callback) ->
|
||||
@emitter.on "will-measure", callback
|
||||
onWillNeedMeasurements: (callback) ->
|
||||
@emitter.on "will-need-measurements", callback
|
||||
|
||||
# Calls your `callback` when some changes in the model occurred and the current state has been updated.
|
||||
onDidUpdateState: (callback) ->
|
||||
@@ -82,7 +82,7 @@ class TextEditorPresenter
|
||||
@updateLinesDecorations() if @shouldUpdateDecorations
|
||||
@updateTilesState() if @shouldUpdateLinesState or @shouldUpdateLineNumbersState
|
||||
|
||||
@emitter.emit "will-measure", @state
|
||||
@emitter.emit "will-need-measurements", @state
|
||||
|
||||
@updateCommonGutterState()
|
||||
@updateHorizontalDimensions()
|
||||
|
||||
Reference in New Issue
Block a user