From 1853c21353946386ccf08e658c5d115c84182049 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Tue, 19 Oct 2021 19:00:01 +0200 Subject: [PATCH] update: add slots to Background.vue, Controls.vue and MiniMap.vue --- .../Background/Background.vue | 16 +++--- .../Background/utils.tsx | 7 --- .../Controls/Controls.vue | 54 ++++++++++++------- src/additional-components/MiniMap/MiniMap.vue | 34 ++++++------ tsconfig.json | 3 ++ 5 files changed, 65 insertions(+), 49 deletions(-) delete mode 100644 src/additional-components/Background/utils.tsx diff --git a/src/additional-components/Background/Background.vue b/src/additional-components/Background/Background.vue index 6bcc1256..e422c8cf 100644 --- a/src/additional-components/Background/Background.vue +++ b/src/additional-components/Background/Background.vue @@ -21,18 +21,17 @@ const defaultColors: Record = { } const store = inject('store')! -const transform = computed(() => store.transform) // when there are multiple flows on a page we need to make sure that every background gets its own pattern. -const patternId = `pattern-${Math.floor(Math.random() * 100000)}` const bgClasses = ['revue-flow__background'] -const scaledGap = computed(() => props.gap && props.gap * transform.value[2]) -const xOffset = computed(() => scaledGap.value && transform.value[0] % scaledGap.value) -const yOffset = computed(() => scaledGap.value && transform.value[1] % scaledGap.value) +const scaledGap = computed(() => props.gap && props.gap * store.transform[2]) +const xOffset = computed(() => scaledGap.value && store.transform[0] % scaledGap.value) +const yOffset = computed(() => scaledGap.value && store.transform[1] % scaledGap.value) +const size = computed(() => props.size || 0.4 * store.transform[2]) -const isLines = computed(() => props.variant === BackgroundVariant.Lines) -const bgColor = computed(() => (props.color ? props.color : defaultColors[props.variant || BackgroundVariant.Dots])) -const size = computed(() => props.size || 0.4 * transform.value[2]) +const isLines = props.variant === BackgroundVariant.Lines +const bgColor = props.color ? props.color : defaultColors[props.variant || BackgroundVariant.Dots] +const patternId = `pattern-${Math.floor(Math.random() * 100000)}` + diff --git a/src/additional-components/Background/utils.tsx b/src/additional-components/Background/utils.tsx deleted file mode 100644 index 11c8c8f6..00000000 --- a/src/additional-components/Background/utils.tsx +++ /dev/null @@ -1,7 +0,0 @@ -export const createGridLinesPath = (size: number, strokeWidth: number, stroke: string) => { - return -} - -export const createGridDotsPath = (size: number, fill: string) => { - return -} diff --git a/src/additional-components/Controls/Controls.vue b/src/additional-components/Controls/Controls.vue index 7e444603..e5591d25 100644 --- a/src/additional-components/Controls/Controls.vue +++ b/src/additional-components/Controls/Controls.vue @@ -1,11 +1,11 @@