feat: support element bgColor desc

This commit is contained in:
chenshenhai 2021-07-26 11:43:43 +08:00
parent 748fb0f0f9
commit 1206369874
3 changed files with 7 additions and 2 deletions

View file

@ -16,6 +16,7 @@ const data = {
borderRadius: 20,
borderWidth: 2,
borderColor: "#bd0b64",
bgColor: '#f0f0f0',
},
},
{
@ -33,6 +34,7 @@ const data = {
borderRadius: 60,
borderWidth: 10,
borderColor: "#bd0b64",
bgColor: '#f0f0f0',
},
},
{
@ -51,6 +53,7 @@ const data = {
borderRadius: 20,
borderWidth: 2,
borderColor: "#bd0b64",
bgColor: '#f0f0f0',
},
},
{
@ -69,6 +72,7 @@ const data = {
borderRadius: 20,
borderWidth: 2,
borderColor: "#bd0b64",
bgColor: '#f0f0f0',
},
},
],

View file

@ -5,7 +5,7 @@ import {
TypeHelperConfig,
} from '@idraw/types';
import Loader from '../loader';
import { clearContext, drawBoxBorder } from './base';
import { clearContext, drawBox } from './base';
import { rotateElement } from './../transform';
export function drawText(
@ -15,7 +15,7 @@ export function drawText(
helperConfig: TypeHelperConfig
) {
clearContext(ctx);
drawBoxBorder(ctx, elem);
drawBox(ctx, elem, elem.desc.bgColor);
rotateElement(ctx, elem, () => {
const desc: TypeElemDescText = {

View file

@ -43,6 +43,7 @@ type TypeElemDescText = {
// fontWeight?: string;
fontFamily?: string;
textAlign?: 'center' | 'left' | 'right';
bgColor: string;
} & TypeElemBoxDesc
// type TypeElemDescCircle = {