Skip to content

Commit b7026a2

Browse files
committed
Format in display
1 parent d313678 commit b7026a2

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed

modules/gui/display.mjs

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ class GridDisplay extends MDIDisplay {
244244
} else
245245
sizex = sizey = parseInt(kind);
246246

247-
248247
if (!Number.isInteger(sizex)) sizex = 3;
249248
if (!Number.isInteger(sizey)) sizey = 3;
250249

@@ -343,7 +342,6 @@ class GridDisplay extends MDIDisplay {
343342
} else
344343
elem.style('display', 'flex').style('flex-direction', handle.vertical ? 'row' : 'column');
345344

346-
347345
if (childs && (childs[cnt] > 1)) {
348346
group.vertical = !handle.vertical;
349347
group.groups = [];
@@ -417,7 +415,7 @@ class GridDisplay extends MDIDisplay {
417415
if (Math.abs(diff) < 0.3) return; // if no significant change, do nothing
418416

419417
// do not change if size too small
420-
if (Math.min(handle.groups[id-1].size - diff, group.size+diff) < 3) return;
418+
if (Math.min(handle.groups[id-1].size - diff, group.size + diff) < 3) return;
421419

422420
handle.groups[id-1].size -= diff;
423421
group.size += diff;
@@ -495,16 +493,12 @@ class GridDisplay extends MDIDisplay {
495493
main.on('touchmove', () => {});
496494
}
497495

498-
499496
/** @summary Call function for each frame */
500497
forEachFrame(userfunc) {
501498
if (this.simple_layout)
502499
userfunc(this.getGridFrame());
503-
else {
504-
this.selectDom().selectAll('.jsroot_newgrid').each(function() {
505-
userfunc(this);
506-
});
507-
}
500+
else
501+
this.selectDom().selectAll('.jsroot_newgrid').each(function() { userfunc(this); });
508502
}
509503

510504
/** @summary Returns active frame */
@@ -528,7 +522,8 @@ class GridDisplay extends MDIDisplay {
528522
return this.selectDom('origin').node();
529523
let res = null;
530524
this.selectDom().selectAll('.jsroot_newgrid').each(function() {
531-
if (id-- === 0) res = this;
525+
if (id-- === 0)
526+
res = this;
532527
});
533528
return res;
534529
}
@@ -583,7 +578,8 @@ class TabsDisplay extends MDIDisplay {
583578

584579
/** @summary call function for each frame */
585580
forEachFrame(userfunc, only_visible) {
586-
if (!isFunc(userfunc)) return;
581+
if (!isFunc(userfunc))
582+
return;
587583

588584
if (only_visible) {
589585
const active = this.getActiveFrame();
@@ -601,13 +597,13 @@ class TabsDisplay extends MDIDisplay {
601597
/** @summary modify tab state by id */
602598
modifyTabsFrame(frame_id, action) {
603599
const top = this.selectDom().select('.jsroot_tabs'),
604-
labels = top.select('.jsroot_tabs_labels'),
605-
main = top.select('.jsroot_tabs_main');
600+
labels = top.select('.jsroot_tabs_labels'),
601+
main = top.select('.jsroot_tabs_main');
606602

607603
labels.selectAll('.jsroot_tabs_label').each(function() {
608604
const id = d3_select(this).property('frame_id'),
609-
is_same = (id === frame_id),
610-
active_color = settings.DarkMode ? '#333' : 'white';
605+
is_same = (id === frame_id),
606+
active_color = settings.DarkMode ? '#333' : 'white';
611607

612608
if (action === 'activate') {
613609
d3_select(this).style('background', is_same ? active_color : (settings.DarkMode ? 'black' : '#ddd'))
@@ -939,26 +935,26 @@ class FlexibleDisplay extends MDIDisplay {
939935
'<div class=\'jsroot_flex_resize\' style=\'position: absolute; right: 3px; bottom: 1px; overflow: hidden; cursor: nwse-resize\'>&#x25FF;</div>');
940936

941937
main.attr('class', 'jsroot_flex_frame')
942-
.style('position', 'absolute')
943-
.style('left', Math.round(w * (this.cnt % 5)/10) + 'px')
944-
.style('top', Math.round(h * (this.cnt % 5)/10) + 'px')
945-
.style('width', Math.round(w * 0.58) + 'px')
946-
.style('height', Math.round(h * 0.58) + 'px')
947-
.style('border', '1px solid black')
948-
.style('box-shadow', '1px 1px 2px 2px #aaa')
949-
.property('state', 'normal')
950-
.select('.jsroot_flex_header')
951-
.on('contextmenu', evnt => mdi.showContextMenu(evnt, true))
952-
.on('click', function() { mdi.activateFrame(d3_select(this.parentNode).select('.jsroot_flex_draw').node()); })
953-
.selectAll('button')
954-
.data([{ n: '&#x2715;', t: 'close' }, { n: '&#x2594;', t: 'maximize' }, { n: '&#x2581;', t: 'minimize' }])
955-
.enter()
956-
.append('button')
957-
.attr('type', 'button')
958-
.attr('style', 'float: right; padding: 0; width: 1.4em; text-align: center; font-size: 10px; margin-top: 2px; margin-right: 4px')
959-
.attr('title', d => d.t)
960-
.html(d => d.n)
961-
.on('click', function() { mdi._clickButton(this); });
938+
.style('position', 'absolute')
939+
.style('left', Math.round(w * (this.cnt % 5)/10) + 'px')
940+
.style('top', Math.round(h * (this.cnt % 5)/10) + 'px')
941+
.style('width', Math.round(w * 0.58) + 'px')
942+
.style('height', Math.round(h * 0.58) + 'px')
943+
.style('border', '1px solid black')
944+
.style('box-shadow', '1px 1px 2px 2px #aaa')
945+
.property('state', 'normal')
946+
.select('.jsroot_flex_header')
947+
.on('contextmenu', evnt => mdi.showContextMenu(evnt, true))
948+
.on('click', function() { mdi.activateFrame(d3_select(this.parentNode).select('.jsroot_flex_draw').node()); })
949+
.selectAll('button')
950+
.data([{ n: '&#x2715;', t: 'close' }, { n: '&#x2594;', t: 'maximize' }, { n: '&#x2581;', t: 'minimize' }])
951+
.enter()
952+
.append('button')
953+
.attr('type', 'button')
954+
.attr('style', 'float: right; padding: 0; width: 1.4em; text-align: center; font-size: 10px; margin-top: 2px; margin-right: 4px')
955+
.attr('title', d => d.t)
956+
.html(d => d.n)
957+
.on('click', function() { mdi._clickButton(this); });
962958

963959
let moving_frame = null, moving_div = null, doing_move = false, current = [];
964960
const drag_object = d3_drag().subject(Object);

0 commit comments

Comments
 (0)