Event for project pane resize


#1

A plugin I am developing draws objects in fixed positions over the editor (such as in the center of the editor). In order to maintain the positions, I added an event listener for the window’s “resize” event, which works most of the time.

However, it does not work if I resize the project pane. What event can I subscribe to for the project pane being resized (or any pane being resized even)?


#2

Hi @azhenley, I am looking for such an event also, but never find one.
Did you manage to make it work?


#3

Actually I’ve found the event you need. It is a Pane event called onDidChangeFlexScale(callback)
More info here: Atom API - Pane

let pane = atom.workspace.paneForURI(<uri-of-the-view>); //as example
this.disposables.add(pane.onDidChangeFlexScale(e => {
   //your resize code here
})) 

I think you have to subscribe for window.resize also because the abbove technique works on user gesture over the pane only.

Hope this helps