From 4a00e2257fb0f9e86342030b074f251a34e2d04c Mon Sep 17 00:00:00 2001 From: Conor_Mack Date: Wed, 17 Jun 2020 16:46:03 +0100 Subject: [PATCH] Integrating Colorpicker with Builder --- .../Colorpicker/Colorpicker.svelte | 11 +- .../Colorpicker/Colorpreview.svelte | 121 ++++++++++++++---- .../userInterface/Colorpicker/index.js | 5 +- .../userInterface/Colorpicker/utils.js | 8 +- .../ComponentPropertiesPanel.svelte | 3 - .../userInterface/DesignView.svelte | 9 +- .../userInterface/PropertyControl.svelte | 2 + .../userInterface/propertyCategories.js | 12 +- .../[application]/frontend/_layout.svelte | 1 - 9 files changed, 121 insertions(+), 51 deletions(-) diff --git a/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte b/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte index 8ec53d9b86..936756f403 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte @@ -22,14 +22,11 @@ const dispatch = createEventDispatcher(); onMount(() => { - format = getColorFormat(value); if (format) { convertAndSetHSVA() } }); - const hsvaIsNull = () => [h, s, v, a].every(c => c === null); - function convertAndSetHSVA() { let hsva = convertToHSVA(value, format); setHSVA(hsva); @@ -53,17 +50,16 @@ function setHue(hue) { h = hue; value = convertHsvaToFormat([h, s, v, a], format); - dispatch("change", value) } function setAlpha(alpha) { a = alpha === "1.00" ? "1" :alpha; value = convertHsvaToFormat([h, s, v, a], format); - dispatch("change", value) } function changeFormatAndConvert(f) { format = f; + console.log(f) value = convertHsvaToFormat([h, s, v, a], format); } @@ -73,14 +69,16 @@ format = f; value = text convertAndSetHSVA() + dispatch("change", value) } } + \ No newline at end of file + + diff --git a/packages/builder/src/components/userInterface/Colorpicker/index.js b/packages/builder/src/components/userInterface/Colorpicker/index.js index b497601edf..21e19acc9b 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/index.js +++ b/packages/builder/src/components/userInterface/Colorpicker/index.js @@ -1,3 +1,2 @@ -import Colorpreview from './Colorpreview.svelte'; - -export default Colorpreview; +import Colorpreview from "./Colorpreview.svelte" +export default Colorpreview diff --git a/packages/builder/src/components/userInterface/Colorpicker/utils.js b/packages/builder/src/components/userInterface/Colorpicker/utils.js index 518e94ec9f..5e3791ae42 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/utils.js +++ b/packages/builder/src/components/userInterface/Colorpicker/utils.js @@ -127,9 +127,11 @@ export const rgbaToHSVA = rgba => { }; export const hslaToHSVA = ([h, s, l, a = 1]) => { - let hsv = _hslToHSV([h, s, l]); - return [...hsv, a]; -}; + let sat = s.replace(/%/, "") + let lum = l.replace(/%/, "") + let hsv = _hslToHSV([h, sat, lum]) + return [...hsv, a] +} export const hsvaToHexa = (hsva, asString = false) => { const [r, g, b, a] = hsvaToRgba(hsva); diff --git a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte index bcebb4d2d4..927f6ff13f 100644 --- a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte +++ b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte @@ -102,8 +102,6 @@ height: 100%; display: flex; flex-direction: column; - overflow-x: hidden; - overflow-y: hidden; padding: 20px; box-sizing: border-box; } @@ -121,6 +119,5 @@ margin-top: 20px; flex: 1 1 auto; min-height: 0; - overflow-y: auto; } diff --git a/packages/builder/src/components/userInterface/DesignView.svelte b/packages/builder/src/components/userInterface/DesignView.svelte index 070ba502e3..6826bddc5c 100644 --- a/packages/builder/src/components/userInterface/DesignView.svelte +++ b/packages/builder/src/components/userInterface/DesignView.svelte @@ -31,6 +31,7 @@ +
{#if propertyGroupNames.length > 0} {#each propertyGroupNames as groupName} @@ -49,6 +50,7 @@ {/if}
+