Skip to content

Commit

Permalink
feat(component): 增加底图无法擦除功能
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceLanniste committed Jun 26, 2024
1 parent c938d2d commit 8343ddc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/core/plugin/WorkspacePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class WorkspacePlugin implements IPluginTempl {
height,
id: 'workspace',
strokeWidth: 0,
erasable: false,
});

workspace.set('selectable', false);
workspace.set('hasControls', false);
workspace.hoverCursor = 'default';
Expand Down
2 changes: 1 addition & 1 deletion src/components/erase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const doErase = () => {
if (isErase.value) {
canvas.isDrawingMode = true;
canvas.freeDrawingBrush = new fabric.EraserBrush(canvas);
canvas.freeDrawingBrush.width = 15; // optional
canvas.freeDrawingBrush.width = 15;
} else {
canvas.isDrawingMode = false;
}
Expand Down
1 change: 0 additions & 1 deletion src/components/imgStroke.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ const onSliderChange = (val: number) => {
};
const onColorChange = (val: string) => {
console.log('onColorChnage', val);
strokeColor.value = val;
updateStroke();
};
Expand Down
4 changes: 4 additions & 0 deletions typings/extends.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,8 @@ declare namespace fabric {
export class EraserBrush {
constructor(canvas: Canvas);
}

export interface IRectOptions {
[key: string]: unknown;
}
}

0 comments on commit 8343ddc

Please sign in to comment.