From a37692d368d98286560724e0e661806fc5606ede Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Wed, 25 Jun 2025 16:41:41 +0100 Subject: [PATCH] Update ds.html --- ds.html | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/ds.html b/ds.html index e9a4cbd9a..274798c19 100644 --- a/ds.html +++ b/ds.html @@ -26,6 +26,24 @@ pt +
+ + + + +
+ + +
', value: '' } + ], + filterAxis: '', + filterOp: '>', + filterValue: '', + allAxes: [], }}, async created() { this.familyData = await this.getFamilyData(); this.loadFonts(); this.restorePanelsFromUrl(); if (this.panels.length === 0) this.addPanel(); + this.allAxes = this.getAllAxes(); this.$watch('panels', this.updateUrlFromPanels, { deep: true }); console.log('Vue instance mounted'); }, @@ -200,6 +226,50 @@ new Vue({ text, }); }, + getAllAxes() { + const axesSet = new Set(); + Object.values(this.familyData).forEach(fam => { + fam.axes.forEach(ax => axesSet.add(ax.tag)); + }); + return Array.from(axesSet).sort(); + }, + addAxisFilter() { + this.axisFilters.push({ axis: '', op: '>', value: '' }); + }, + removeAxisFilter(i) { + this.axisFilters.splice(i, 1); + }, + addFilteredPanels() { + // Only include filters with axis and value + const filters = this.axisFilters.filter(f => f.axis && f.value !== ''); + if (!filters.length) return; + const families = Object.values(this.familyData).filter(fam => { + return filters.every(f => { + const ax = fam.axes.find(a => a.tag === f.axis); + if (!ax) return false; + const min = Number(ax.min); + const max = Number(ax.max); + const val = Number(f.value); + if (f.op === '>') return max > val; + if (f.op === '>=') return max >= val; + if (f.op === '<') return min < val; + if (f.op === '<=') return min <= val; + if (f.op === '==') return min <= val && max >= val; + return false; + }); + }); + families.forEach(fam => { + // Default positions for axes + const positions = {}; + fam.axes.forEach(ax => { positions[ax.tag] = ax.defaultValue || ax.min; }); + this.panels.push({ + id: this.nextPanelId++, + currentFamily: fam.family, + positions: { ...positions }, + text: this.selectedSampleText, + }); + }); + }, updateUrlFromPanels() { if (this.restoring) return; const panelsForUrl = this.panels.map(p => ({ @@ -231,6 +301,10 @@ new Vue({ applySampleText() { this.panels.forEach(panel => { panel.text = this.selectedSampleText; }); }, + clearPanels() { + this.panels = []; + this.updateUrlFromPanels(); + }, } }); -- 2.47.2