feat: @idraw/core selected area add style

This commit is contained in:
chenshenhai 2021-06-28 23:40:57 +08:00
parent 50191464b7
commit 15744ddf35
2 changed files with 6 additions and 1 deletions

View file

@ -12,6 +12,7 @@ export function clearContext(ctx: TypeContext) {
ctx.setFillStyle('rgb(0 0 0 / 0%)');
ctx.setStrokeStyle('rgb(0 0 0 / 0%)');
ctx.setLineDash([]);
ctx.setGlobalAlpha(1);
}
export function drawBgColor(ctx: TypeContext, color: string) {

View file

@ -64,7 +64,11 @@ export function drawAreaWrapper(ctx: TypeContext, config: TypeHelperConfig) {
const wrapper = config.selectedAreaWrapper;
if (wrapper && wrapper.w > 0 && wrapper.h > 0) {
clearContext(ctx);
// draw wrapper's box
ctx.setGlobalAlpha(0.3);
ctx.setFillStyle(wrapper.color);
ctx.fillRect(wrapper.x, wrapper.y, wrapper.w, wrapper.h);
clearContext(ctx);
ctx.beginPath();
ctx.setLineDash([]);
ctx.setLineWidth(wrapper.lineWidth);