Skip to content

Commit 6c16023

Browse files
committed
Format in rest places
1 parent 82cb9fd commit 6c16023

File tree

10 files changed

+107
-68
lines changed

10 files changed

+107
-68
lines changed

libs/d3/rollup_d3.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const config = {
2626
json()
2727
],
2828
onwarn(message, warn) {
29-
if (message.code === "CIRCULAR_DEPENDENCY") return;
29+
if (message.code === "CIRCULAR_DEPENDENCY")
30+
return;
3031
warn(message);
3132
}
3233
};

libs/three/rollup_three.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export function glsl() {
77

88
transform( code, id ) {
99

10-
if ( /\.glsl.js$/.test( id ) === false ) return;
10+
if ( /\.glsl.js$/.test( id ) === false )
11+
return;
1112

1213
code = new MagicString( code );
1314

modules/base/makepdf.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,13 @@ async function makePDF(svg, args) {
111111
// add custom fonts to PDF document, only TTF format supported
112112
d3_select(svg.node).selectAll('style').each(function() {
113113
const fcfg = this.$fontcfg;
114-
if (!fcfg?.n || !fcfg?.base64) return;
114+
if (!fcfg?.n || !fcfg?.base64)
115+
return;
115116
const name = fcfg.n;
116-
if ((name === kSymbol) || (name === kWingdings)) return;
117-
if (custom_fonts[name]) return;
117+
if ((name === kSymbol) || (name === kWingdings))
118+
return;
119+
if (custom_fonts[name])
120+
return;
118121
custom_fonts[name] = true;
119122

120123
const filename = name.toLowerCase().replace(/\s/g, '') + '.ttf';

modules/draw/TTree.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,16 @@ function createTreePlayer(player) {
217217

218218
player.getValue = function(sel) {
219219
const elem = this.selectDom().select(sel);
220-
if (elem.empty()) return;
220+
if (elem.empty())
221+
return;
221222
const val = elem.property('value');
222223
if (val !== undefined) return val;
223224
return elem.attr('value');
224225
};
225226

226227
player.performLocalDraw = function() {
227-
if (!this.local_tree) return;
228+
if (!this.local_tree)
229+
return;
228230

229231
const frame = this.selectDom(),
230232
args = { expr: this.getValue('.treedraw_varexp') };

modules/gui.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ function readStyleFromURL(url) {
155155
if (d.has('hlimit')) settings.HierarchyLimit = parseInt(d.get('hlimit'));
156156

157157
function get_int_style(name, field, dflt) {
158-
if (!d.has(name)) return;
158+
if (!d.has(name))
159+
return;
159160
const val = d.get(name);
160161
if (!val || (val === 'true') || (val === 'on'))
161162
gStyle[field] = dflt;
@@ -166,7 +167,8 @@ function readStyleFromURL(url) {
166167
return gStyle[field];
167168
}
168169
function get_float_style(name, field) {
169-
if (!d.has(name)) return;
170+
if (!d.has(name))
171+
return;
170172
const val = d.get(name),
171173
flt = Number.parseFloat(val);
172174
if (Number.isFinite(flt))

modules/rntuple.mjs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ const kFlagRepetitiveField = 0x01,
321321
class RNTupleDescriptorBuilder {
322322

323323
deserializeHeader(header_blob) {
324-
if (!header_blob) return;
324+
if (!header_blob)
325+
return;
325326

326327
const reader = new RBufferReader(header_blob),
327328

@@ -353,7 +354,8 @@ class RNTupleDescriptorBuilder {
353354
}
354355

355356
deserializeFooter(footer_blob) {
356-
if (!footer_blob) return;
357+
if (!footer_blob)
358+
return;
357359

358360
const reader = new RBufferReader(footer_blob);
359361

@@ -741,27 +743,27 @@ class RNTupleDescriptorBuilder {
741743
let {
742744
blob: processedBlob
743745
} = recontructUnsplitBuffer(blob, columnDescriptor);
744-
745-
746+
747+
746748
// Handle split index types
747749
if (originalColtype === ENTupleColumnType.kSplitIndex32 || originalColtype === ENTupleColumnType.kSplitIndex64) {
748750
const {
749751
blob: decodedArray
750752
} = DecodeDeltaIndex(processedBlob, coltype);
751753
processedBlob = decodedArray;
752754
}
753-
755+
754756
// Handle Split Signed Int types
755757
if (originalColtype === ENTupleColumnType.kSplitInt16 || originalColtype === ENTupleColumnType.kSplitInt32 || originalColtype === ENTupleColumnType.kSplitInt64) {
756758
const {
757759
blob: decodedArray
758760
} = decodeZigzag(processedBlob, coltype);
759761
processedBlob = decodedArray;
760762
}
761-
763+
762764
const reader = new RBufferReader(processedBlob),
763765
values = [],
764-
766+
765767
// Use numElements from pageInfo parameter
766768
numValues = Number(pageInfo.numElements),
767769
// Helper for all simple types
@@ -775,10 +777,10 @@ class RNTupleDescriptorBuilder {
775777
const totalBitsInBuffer = processedBlob.byteLength * 8;
776778
if (totalBitsInBuffer < numValues)
777779
throw new Error(`kBit: Not enough bits in buffer (${totalBitsInBuffer}) for numValues (${numValues})`);
778-
780+
779781
for (let byteIndex = 0; byteIndex < processedBlob.byteLength; ++byteIndex) {
780782
const byte = reader.readU8();
781-
783+
782784
// Extract 8 bits from this byte
783785
for (let bitPos = 0; bitPos < 8 && bitCount < numValues; ++bitPos, ++bitCount) {
784786
const bitValue = (byte >>> bitPos) & 1,
@@ -788,7 +790,7 @@ class RNTupleDescriptorBuilder {
788790
}
789791
break;
790792
}
791-
793+
792794
case ENTupleColumnType.kReal64:
793795
extractValues(reader.readF64.bind(reader));
794796
break;

modules/testing.mjs

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isNodeJs, isBatchMode, setBatchMode, postponePromise } from './core.mjs';
1+
import { isNodeJs, isFunc, isBatchMode, setBatchMode, postponePromise } from './core.mjs';
22
import { select as d3_select } from './d3.mjs';
33
import { _loadJSDOM } from './base/BasePainter.mjs';
44
import { cleanup, getElementCanvPainter } from './base/ObjectPainter.mjs';
@@ -51,7 +51,8 @@ function _getAllSubPads(cp) {
5151
async function testZooming(node, args, pp) {
5252
const cp = getElementCanvPainter(node),
5353
pad_painter = pp ?? cp;
54-
if (!pad_painter) return;
54+
if (!pad_painter)
55+
return;
5556
const fp = pad_painter.getFramePainter();
5657
if (!fp && !pp) {
5758
const sub_pads = _getAllSubPads(cp);
@@ -60,8 +61,10 @@ async function testZooming(node, args, pp) {
6061
return;
6162
}
6263

63-
if ((typeof fp?.zoom !== 'function') || (typeof fp?.zoomSingle !== 'function')) return;
64-
if (typeof fp.scale_xmin === 'undefined' || typeof fp.scale_ymax === 'undefined') return;
64+
if (!isFunc(fp?.zoom) || !isFunc(fp?.zoomSingle))
65+
return;
66+
if (typeof fp.scale_xmin === 'undefined' || typeof fp.scale_ymax === 'undefined')
67+
return;
6568

6669
const xmin = fp.scale_xmin, xmax = fp.scale_xmax, ymin = fp.scale_ymin, ymax = fp.scale_ymax;
6770

@@ -83,7 +86,8 @@ async function testZooming(node, args, pp) {
8386
async function testMouseZooming(node, args, pp) {
8487
const cp = getElementCanvPainter(node),
8588
pad_painter = pp ?? cp;
86-
if (!pad_painter) return;
89+
if (!pad_painter)
90+
return;
8791
const fp = pad_painter.getFramePainter();
8892

8993
if (!fp && !pp) {
@@ -93,10 +97,12 @@ async function testMouseZooming(node, args, pp) {
9397
return;
9498
}
9599

96-
if (fp?.mode3d) return;
100+
if (fp?.mode3d)
101+
return;
97102
if ((typeof fp?.startRectSel !== 'function') ||
98103
(typeof fp?.moveRectSel !== 'function') ||
99-
(typeof fp?.endRectSel !== 'function')) return;
104+
(typeof fp?.endRectSel !== 'function'))
105+
return;
100106

101107
const fw = fp.getFrameWidth(), fh = fp.getFrameHeight(),
102108
evnt = new EmulationMouseEvent(),
@@ -132,7 +138,8 @@ async function testMouseZooming(node, args, pp) {
132138
async function testTouchZooming(node, args, pp) {
133139
const cp = getElementCanvPainter(node),
134140
pad_painter = pp ?? cp;
135-
if (!pad_painter) return;
141+
if (!pad_painter)
142+
return;
136143
const fp = pad_painter.getFramePainter();
137144

138145
if (!fp && !pp) {
@@ -142,10 +149,8 @@ async function testTouchZooming(node, args, pp) {
142149
return;
143150
}
144151

145-
if (fp?.mode3d) return;
146-
if ((typeof fp?.startTouchZoom !== 'function') ||
147-
(typeof fp?.moveTouchZoom !== 'function') ||
148-
(typeof fp?.endTouchZoom !== 'function')) return;
152+
if (fp?.mode3d || !isFunc(fp?.startTouchZoom) || !isFunc(fp?.moveTouchZoom) || !isFunc(fp?.endTouchZoom))
153+
return;
149154

150155
const fw = fp.getFrameWidth(), fh = fp.getFrameHeight(),
151156
evnt = new EmulationMouseEvent();
@@ -176,7 +181,8 @@ async function testTouchZooming(node, args, pp) {
176181
async function testMouseWheel(node, args, pp) {
177182
const cp = getElementCanvPainter(node),
178183
pad_painter = pp ?? cp;
179-
if (!pad_painter) return;
184+
if (!pad_painter)
185+
return;
180186
const fp = pad_painter.getFramePainter();
181187

182188
if (!fp && !pp) {
@@ -186,8 +192,8 @@ async function testMouseWheel(node, args, pp) {
186192
return;
187193
}
188194

189-
if (fp?.mode3d) return;
190-
if (typeof fp?.mouseWheel !== 'function') return;
195+
if (fp?.mode3d || !isFunc(fp?.mouseWheel))
196+
return;
191197

192198
const fw = fp.getFrameWidth(), fh = fp.getFrameHeight(),
193199
evnt = new EmulationMouseEvent(),
@@ -218,7 +224,8 @@ async function testMouseWheel(node, args, pp) {
218224
async function testFrameClick(node, pp) {
219225
const cp = getElementCanvPainter(node),
220226
pad_painter = pp ?? cp;
221-
if (!pad_painter) return;
227+
if (!pad_painter)
228+
return;
222229
const fp = pad_painter.getFramePainter();
223230

224231
if (!fp && !pp) {
@@ -228,7 +235,8 @@ async function testFrameClick(node, pp) {
228235
return;
229236
}
230237

231-
if (fp?.mode3d || typeof fp?.processFrameClick !== 'function') return;
238+
if (fp?.mode3d || !isFunc(fp?.processFrameClick))
239+
return;
232240

233241
const fw = fp.getFrameWidth(), fh = fp.getFrameHeight();
234242

@@ -243,7 +251,8 @@ async function testFrameClick(node, pp) {
243251
async function testFrameMouseDoubleClick(node, pp) {
244252
const cp = getElementCanvPainter(node),
245253
pad_painter = pp ?? cp;
246-
if (!pad_painter) return;
254+
if (!pad_painter)
255+
return;
247256
const fp = pad_painter.getFramePainter();
248257

249258
if (!fp && !pp) {
@@ -253,7 +262,8 @@ async function testFrameMouseDoubleClick(node, pp) {
253262
return;
254263
}
255264

256-
if (fp?.mode3d || typeof fp?.mouseDoubleClick !== 'function') return;
265+
if (fp?.mode3d || !isFunc(fp?.mouseDoubleClick))
266+
return;
257267

258268
const fw = fp.getFrameWidth(), fh = fp.getFrameHeight(),
259269
evnt = new EmulationMouseEvent(),
@@ -270,7 +280,8 @@ async function testFrameMouseDoubleClick(node, pp) {
270280
async function testFrameContextMenu(node, args, pp) {
271281
const cp = getElementCanvPainter(node),
272282
pad_painter = pp ?? cp;
273-
if (!pad_painter) return;
283+
if (!pad_painter)
284+
return;
274285
const fp = pad_painter.getFramePainter();
275286

276287
if (!fp && !pp) {
@@ -280,7 +291,8 @@ async function testFrameContextMenu(node, args, pp) {
280291
return;
281292
}
282293

283-
if (fp?.mode3d || typeof fp?.showContextMenu !== 'function') return;
294+
if (fp?.mode3d || !isFunc(fp?.showContextMenu))
295+
return;
284296

285297
const fw = fp.getFrameWidth(), fh = fp.getFrameHeight(),
286298
evnt = new EmulationMouseEvent(),
@@ -315,7 +327,8 @@ async function testPadContextMenu(node, args, pp) {
315327
await testPadContextMenu(node, args, sub_pads[k]);
316328
}
317329

318-
if (typeof cp?.padContextMenu !== 'function') return;
330+
if (!isFunc(cp?.padContextMenu))
331+
return;
319332

320333
const pw = cp.getPadWidth(), ph = cp.getPadHeight(),
321334
evnt = new EmulationMouseEvent(),
@@ -340,7 +353,7 @@ async function testPadItemContextMenu(node, args, pp) {
340353
await testPadItemContextMenu(node, args, sub_pads[k]);
341354
}
342355

343-
if (typeof cp?.itemContextMenu !== 'function')
356+
if (!isFunc(cp?.itemContextMenu))
344357
return;
345358

346359
const nprimitives = cp.getNumPainters() ?? 0,
@@ -356,7 +369,8 @@ async function testPadItemContextMenu(node, args, pp) {
356369

357370
async function testPadButtons(node, args) {
358371
const cp = getElementCanvPainter(node);
359-
if (typeof cp?.clickPadButton !== 'function') return;
372+
if (!isFunc(cp?.clickPadButton))
373+
return;
360374

361375
const evnt = new EmulationMouseEvent(50, 50),
362376
toggles = ['ToggleZoom', 'ToggleLogX', 'ToggleLogY', 'ToggleLogZ', 'Toggle3D', 'ToggleColorZ', 'ToggleStatBox'];

0 commit comments

Comments
 (0)