diff --git a/src/components/GradientBar.vue b/src/components/GradientBar.vue index 9d81ec58..48185cb4 100644 --- a/src/components/GradientBar.vue +++ b/src/components/GradientBar.vue @@ -139,6 +139,7 @@ const addPoint = (e: MouseEvent) => { outline: 1px solid #d9d9d9; box-shadow: 0 0 2px 2px #d9d9d9; border-radius: 1px; + cursor: pointer; &.active { outline: 1px solid $themeColor; diff --git a/src/hooks/useSlideTheme.ts b/src/hooks/useSlideTheme.ts index ba5a16d7..5a0f0fa3 100644 --- a/src/hooks/useSlideTheme.ts +++ b/src/hooks/useSlideTheme.ts @@ -31,8 +31,9 @@ export default () => { backgroundColorValues.push({ area: 1, value: slide.background.color }) } else if (slide.background.type === 'gradient' && slide.background.gradient) { + const len = slide.background.gradient.colors.length backgroundColorValues.push(...slide.background.gradient.colors.map(item => ({ - area: 1, + area: 1 / len, value: item.color, }))) } @@ -54,6 +55,13 @@ export default () => { if (el.fill) { themeColorValues.push({ area, value: el.fill }) } + if (el.type === 'shape' && el.gradient) { + const len = el.gradient.colors.length + themeColorValues.push(...el.gradient.colors.map(item => ({ + area: 1 / len * area, + value: item.color, + }))) + } const text = (el.type === 'shape' ? el.text?.content : el.content) || '' if (!text) continue @@ -160,8 +168,8 @@ export default () => { for (const item of backgroundColorValues) { const color = tinycolor(item.value).toRgbString() if (color === 'rgba(0, 0, 0, 0)') continue - if (!backgroundColors[color]) backgroundColors[color] = 1 - else backgroundColors[color] += 1 + if (!backgroundColors[color]) backgroundColors[color] = item.area + else backgroundColors[color] += item.area } const themeColors: { [key: string]: number } = {}