Skip to content

Commit

Permalink
kill the framer
Browse files Browse the repository at this point in the history
  • Loading branch information
TodePond committed Feb 2, 2025
1 parent be72c4f commit a6bfd68
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
8 changes: 1 addition & 7 deletions panels/strudel.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@

const strudel = new StrudelSession({
onError: (...args) => send('onError', args),
onHighlight: (docId, phase, haps) => {
const settings = window.parent.getSettings();
if (!settings.strudelHighlightsEnabled) {
return;
}
highlightMiniLocations(editorViews.get(docId), phase, haps);
},
onHighlight: (docId, phase, haps) => highlightMiniLocations(editorViews.get(docId), phase, haps),
onUpdateMiniLocations: (docId, miniLocations) => updateMiniLocations(editorViews.get(docId), miniLocations),
});

Expand Down
6 changes: 4 additions & 2 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const pastingModeCheckbox = document.querySelector('#settings-pasting-mode');
const fontFamilySelect = document.querySelector('#settings-font-family');
const strudelHighlightsEnabledCheckbox = document.querySelector('#settings-strudel-highlights-enabled');

console.log(strudelCheckbox.checked);
function inferSettingsFromDom() {
const inferredSettings = {
username: usernameInput?.value ?? defaultSettings.username,
Expand Down Expand Up @@ -198,8 +197,11 @@ export async function applySettingsToNudel(settings = getSettings()) {

// Clear all active strudel highlights if the setting is turned off
if (isSettingChanged('strudelHighlightsEnabled', diff)) {
if (!next.strudelHighlightsEnabled) {
if (next.strudelHighlightsEnabled) {
window.strudel?.framer?.start();
} else {
clearStrudelHighlights();
window.strudel?.framer?.stop();
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/strudel.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,15 @@ export class StrudelSession {
console.error('[strudel] draw error', err);
},
);
this.framer.start(); // tbd allow disabling highlighting

const settings = window.parent.getSettings?.();
if (!settings) {
throw new Error(`Couldn't get nudel settings within strudel`);
}

if (settings.strudelHighlightsEnabled) {
this.framer.start();
}
}

hush() {
Expand Down

0 comments on commit a6bfd68

Please sign in to comment.