mirror of
https://github.com/atom/atom.git
synced 2026-02-07 05:05:02 -05:00
Ignore resize events if they are delivered while the editor is hidden
This commit is contained in:
@@ -1311,21 +1311,27 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
didResize () {
|
||||
const clientContainerWidthChanged = this.measureClientContainerWidth()
|
||||
const clientContainerHeightChanged = this.measureClientContainerHeight()
|
||||
if (clientContainerWidthChanged || clientContainerHeightChanged) {
|
||||
if (clientContainerWidthChanged) {
|
||||
this.remeasureAllBlockDecorations = true
|
||||
}
|
||||
// Prevent the component from measuring the client container dimensions when
|
||||
// getting spurious resize events.
|
||||
if (this.isVisible()) {
|
||||
const clientContainerWidthChanged = this.measureClientContainerWidth()
|
||||
const clientContainerHeightChanged = this.measureClientContainerHeight()
|
||||
if (clientContainerWidthChanged || clientContainerHeightChanged) {
|
||||
if (clientContainerWidthChanged) {
|
||||
this.remeasureAllBlockDecorations = true
|
||||
}
|
||||
|
||||
this.resizeObserver.disconnect()
|
||||
this.scheduleUpdate()
|
||||
process.nextTick(() => { this.resizeObserver.observe(this.element) })
|
||||
this.resizeObserver.disconnect()
|
||||
this.scheduleUpdate()
|
||||
process.nextTick(() => { this.resizeObserver.observe(this.element) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
didResizeGutterContainer () {
|
||||
if (this.measureGutterDimensions()) {
|
||||
// Prevent the component from measuring the gutter dimensions when getting
|
||||
// spurious resize events.
|
||||
if (this.isVisible() && this.measureGutterDimensions()) {
|
||||
this.gutterContainerResizeObserver.disconnect()
|
||||
this.scheduleUpdate()
|
||||
process.nextTick(() => { this.gutterContainerResizeObserver.observe(this.refs.gutterContainer.element) })
|
||||
|
||||
Reference in New Issue
Block a user