From b30fca11ab7f94f40a8d2db47ef5c853e0ddf793 Mon Sep 17 00:00:00 2001 From: Nick Sellen Date: Wed, 13 Dec 2023 17:45:26 +0000 Subject: [PATCH] Add gratuitous ragged edges look for feedback --- quasar.conf.js | 1 + src/App.vue | 3 + .../components/ActivityFeedbackItem.vue | 4 +- src/boot/directives.js | 5 ++ src/utils/components/SvgFilters.vue | 56 +++++++++++++++++++ src/utils/svgUtils.js | 16 ++++++ 6 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 src/boot/directives.js create mode 100644 src/utils/components/SvgFilters.vue diff --git a/quasar.conf.js b/quasar.conf.js index 579c785ab5..ed2ad3ea8e 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -44,6 +44,7 @@ module.exports = configure(function (ctx) { 'icons', 'detectMobileKeyboard', 'performance', + 'directives', ], css: [ 'app.sass', diff --git a/src/App.vue b/src/App.vue index d192b4762a..5b2cc330a9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,7 @@ > + diff --git a/src/utils/svgUtils.js b/src/utils/svgUtils.js index 51138614fe..1aba1607f5 100644 --- a/src/utils/svgUtils.js +++ b/src/utils/svgUtils.js @@ -199,3 +199,19 @@ function getRootDefs () { export function addDefinition (definition) { getRootDefs().appendChild(definition) } + +function randomInt (min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min +} + +export const raggedEdgeVariations = 5 + +function getRaggedEdgesClassName () { + return `ragged-edges-${randomInt(1, raggedEdgeVariations)}` +} + +export const raggedEdgesDirective = { + mounted (el) { + el.classList.add(getRaggedEdgesClassName()) + }, +}