Skip to content

Commit 5baead0

Browse files
committed
Fix Prettier formatting
1 parent 112cefb commit 5baead0

File tree

1 file changed

+43
-53
lines changed

1 file changed

+43
-53
lines changed

js/widgets/sampler.js

Lines changed: 43 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ function SampleWidget() {
189189
this.activity.blocks.blockList[mainSampleBlock].text.text
190190
) {
191191
// Append cent adjustment to the block text if possible
192-
const currentText = this.activity.blocks.blockList[mainSampleBlock].text
193-
.text;
192+
const currentText =
193+
this.activity.blocks.blockList[mainSampleBlock].text.text;
194194
if (!currentText.includes("¢")) {
195195
this.activity.blocks.blockList[mainSampleBlock].text.text +=
196196
" " + centText;
@@ -522,29 +522,25 @@ function SampleWidget() {
522522
}
523523
};
524524

525-
widgetWindow.addButton(
526-
"load-media.svg",
527-
ICONSIZE,
528-
_("Upload sample"),
529-
""
530-
).onclick = function () {
531-
stopTuner();
532-
const fileChooser = docById("myOpenAll");
525+
widgetWindow.addButton("load-media.svg", ICONSIZE, _("Upload sample"), "").onclick =
526+
function () {
527+
stopTuner();
528+
const fileChooser = docById("myOpenAll");
529+
530+
// eslint-disable-next-line no-unused-vars
531+
const __readerAction = function (event) {
532+
window.scroll(0, 0);
533+
const sampleFile = fileChooser.files[0];
534+
that.handleFiles(sampleFile);
535+
fileChooser.removeEventListener("change", __readerAction);
536+
};
533537

534-
// eslint-disable-next-line no-unused-vars
535-
const __readerAction = function (event) {
538+
fileChooser.addEventListener("change", __readerAction, false);
539+
fileChooser.focus();
540+
fileChooser.click();
536541
window.scroll(0, 0);
537-
const sampleFile = fileChooser.files[0];
538-
that.handleFiles(sampleFile);
539-
fileChooser.removeEventListener("change", __readerAction);
540542
};
541543

542-
fileChooser.addEventListener("change", __readerAction, false);
543-
fileChooser.focus();
544-
fileChooser.click();
545-
window.scroll(0, 0);
546-
};
547-
548544
// Create a container for the pitch button and frequency display
549545
this.pitchBtnContainer = document.createElement("div");
550546
this.pitchBtnContainer.className = "wfbtItem";
@@ -576,22 +572,18 @@ function SampleWidget() {
576572
};
577573

578574
this._save_lock = false;
579-
widgetWindow.addButton(
580-
"export-chunk.svg",
581-
ICONSIZE,
582-
_("Save sample"),
583-
""
584-
).onclick = function () {
585-
stopTuner();
586-
// Debounce button
587-
if (!that._get_save_lock()) {
588-
that._save_lock = true;
589-
that._saveSample();
590-
setTimeout(function () {
591-
that._save_lock = false;
592-
}, 1000);
593-
}
594-
};
575+
widgetWindow.addButton("export-chunk.svg", ICONSIZE, _("Save sample"), "").onclick =
576+
function () {
577+
stopTuner();
578+
// Debounce button
579+
if (!that._get_save_lock()) {
580+
that._save_lock = true;
581+
that._saveSample();
582+
setTimeout(function () {
583+
that._save_lock = false;
584+
}, 1000);
585+
}
586+
};
595587

596588
this._recordBtn = widgetWindow.addButton("mic.svg", ICONSIZE, _("Toggle Mic"), "");
597589

@@ -1783,9 +1775,8 @@ function SampleWidget() {
17831775

17841776
const __selectionChanged = () => {
17851777
const label = this._pitchWheel.navItems[this._pitchWheel.selectedNavItemIndex].title;
1786-
const attr = this._accidentalsWheel.navItems[
1787-
this._accidentalsWheel.selectedNavItemIndex
1788-
].title;
1778+
const attr =
1779+
this._accidentalsWheel.navItems[this._accidentalsWheel.selectedNavItemIndex].title;
17891780
const octave = Number(
17901781
this._octavesWheel.navItems[this._octavesWheel.selectedNavItemIndex].title
17911782
);
@@ -1906,16 +1897,16 @@ function SampleWidget() {
19061897
// Set initial note display
19071898
const noteObj = TunerUtils.frequencyToPitch(
19081899
A0 *
1909-
Math.pow(
1910-
2,
1911-
(pitchToNumber(
1912-
SOLFEGENAMES[this.pitchCenter] +
1913-
EXPORTACCIDENTALNAMES[this.accidentalCenter],
1914-
this.octaveCenter
1915-
) -
1916-
57) /
1917-
12
1918-
)
1900+
Math.pow(
1901+
2,
1902+
(pitchToNumber(
1903+
SOLFEGENAMES[this.pitchCenter] +
1904+
EXPORTACCIDENTALNAMES[this.accidentalCenter],
1905+
this.octaveCenter
1906+
) -
1907+
57) /
1908+
12
1909+
)
19191910
);
19201911
this.tunerDisplay.update(noteObj[0], noteObj[1], this.centsValue);
19211912

@@ -2047,9 +2038,8 @@ function SampleWidget() {
20472038
const playbackRate = TunerUtils.calculatePlaybackRate(0, this.centsValue);
20482039
// Apply the playback rate to the sample
20492040
if (instruments[0]["customsample_" + this.originalSampleName]) {
2050-
instruments[0][
2051-
"customsample_" + this.originalSampleName
2052-
].playbackRate.value = playbackRate;
2041+
instruments[0]["customsample_" + this.originalSampleName].playbackRate.value =
2042+
playbackRate;
20532043
}
20542044
}
20552045
};

0 commit comments

Comments
 (0)