* The vertical centre column: top (optional) | center | bottom (optional). * This view sits between the left and right edge panels in the outer * horizontal splitview, so its primary axis is width (horizontal).
| 235 | * horizontal splitview, so its primary axis is width (horizontal). |
| 236 | */ |
| 237 | class MiddleColumnView implements IView, IDisposable { |
| 238 | private readonly _element: HTMLElement; |
| 239 | private readonly _splitview: Splitview; |
| 240 | private readonly _onDidChange = new Emitter<{ |
| 241 | size?: number; |
| 242 | orthogonalSize?: number; |
| 243 | }>(); |
| 244 | |
| 245 | readonly onDidChange: Event<{ size?: number; orthogonalSize?: number }> = |
| 246 | this._onDidChange.event; |
| 247 | readonly minimumSize = 100; |
| 248 | readonly maximumSize = Number.POSITIVE_INFINITY; |
| 249 | readonly priority = LayoutPriority.High; |
| 250 | |
| 251 | private _topIndex: number | undefined; |
| 252 | private _centerIndex: number; |
| 253 | private _bottomIndex: number | undefined; |
| 254 | |
| 255 | get element(): HTMLElement { |
| 256 | return this._element; |
| 257 | } |
| 258 | |
| 259 | constructor(centerView: CenterView, gap = 0) { |
| 260 | this._element = document.createElement('div'); |
| 261 | this._element.className = 'dv-shell-middle-column'; |
| 262 | this._element.style.height = '100%'; |
| 263 | this._element.style.width = '100%'; |
| 264 | |
| 265 | this._splitview = new Splitview(this._element, { |
| 266 | orientation: Orientation.VERTICAL, |
| 267 | proportionalLayout: false, |
| 268 | margin: gap, |
| 269 | }); |
| 270 | |
| 271 | this._centerIndex = 0; |
| 272 | this._splitview.addView(centerView, { type: 'distribute' }, 0); |
| 273 | } |
| 274 | |
| 275 | addTopView(view: EdgeGroupView, initialSize: number): void { |
| 276 | // Insert before center |
| 277 | this._splitview.addView(view, initialSize, 0); |
| 278 | this._topIndex = 0; |
| 279 | this._centerIndex += 1; |
| 280 | if (this._bottomIndex !== undefined) { |
| 281 | this._bottomIndex += 1; |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | addBottomView(view: EdgeGroupView, initialSize: number): void { |
| 286 | // Append after center (and any existing bottom — shouldn't happen but safe) |
| 287 | const newIndex = this._splitview.length; |
| 288 | this._splitview.addView(view, initialSize, newIndex); |
| 289 | this._bottomIndex = newIndex; |
| 290 | } |
| 291 | |
| 292 | removeView(position: 'top' | 'bottom'): void { |
| 293 | const index = position === 'top' ? this._topIndex : this._bottomIndex; |
| 294 | if (index === undefined) { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…