Skip to content

Commit f0df365

Browse files
committed
Cascade newly created windows in window manager
1 parent 2533594 commit f0df365

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

client/src/layout/window-manager.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ export class WindowManager {
2626
}
2727

2828
/** Add and display a new window based on options. */
29-
add(options) {
30-
const url = withPrefix(options.url);
29+
add(options, layout = 10, margin = 20, index = 850) {
30+
const url = this._build_url(withPrefix(options.url), { hide_panels: true, hide_masthead: true });
31+
const x = this.counter * margin;
32+
const y = (this.counter % layout) * margin;
3133
this.counter++;
32-
const boxUrl = this._build_url(url, { hide_panels: true, hide_masthead: true });
3334
WinBox.new({
35+
index: index,
3436
title: options.title || "Window",
35-
url: boxUrl,
36-
index: 850,
37+
url: url,
38+
x: x,
39+
y: y,
3740
onclose: () => {
3841
this.counter--;
3942
},

0 commit comments

Comments
 (0)