From: Marc Foley Date: Thu, 26 Jun 2025 14:50:19 +0000 (+0100) Subject: filter by multiple axes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2a12c37fa737d22a5dc89c62cab42233da4ded3;p=thirdparty%2Fgoogle%2Ffonts.git filter by multiple axes --- diff --git a/.ci/ds.html b/.ci/ds.html index e522224ab..fe5061397 100644 --- a/.ci/ds.html +++ b/.ci/ds.html @@ -26,21 +26,24 @@ pt -
- - - - + +
+ + +
', value: '' } + ], filterAxis: '', filterOp: '>', filterValue: '', @@ -227,22 +233,30 @@ new Vue({ }); return Array.from(axesSet).sort(); }, + addAxisFilter() { + this.axisFilters.push({ axis: '', op: '>', value: '' }); + }, + removeAxisFilter(i) { + this.axisFilters.splice(i, 1); + }, addFilteredPanels() { - if (!this.filterAxis || this.filterValue === '') return; - const op = this.filterOp; - const val = Number(this.filterValue); - const axis = this.filterAxis; + // 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 => { - const ax = fam.axes.find(a => a.tag === axis); - if (!ax) return false; - const min = Number(ax.min); - const max = Number(ax.max); - if (op === '>') return max > val; - if (op === '>=') return max >= val; - if (op === '<') return min < val; - if (op === '<=') return min <= val; - if (op === '==') return min <= val && max >= val; - return false; + 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 @@ -287,6 +301,10 @@ new Vue({ applySampleText() { this.panels.forEach(panel => { panel.text = this.selectedSampleText; }); }, + clearPanels() { + this.panels = []; + this.updateUrlFromPanels(); + }, } }); \ No newline at end of file