Skip to content

Commit da2aad7

Browse files
committed
fix undo after undo happen, use transparent color in draw mode
1 parent 7ae3cd9 commit da2aad7

File tree

6 files changed

+6
-5
lines changed

6 files changed

+6
-5
lines changed

ts/image-occlusion/SideToolbar.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
4343
const disableFunctions = () => {
4444
instance.pause();
4545
stopDraw(canvas);
46+
canvas.selectionColor = "rgba(100, 100, 255, 0.3)";
4647
};
4748
</script>
4849

ts/image-occlusion/mask-editor.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ export const setupMaskEditorForEdit = async (noteId: number, instance: PanZoom):
7070
};
7171

7272
const initCanvas = (): fabric.Canvas => {
73-
const canvas = new fabric.Canvas("canvas", {
74-
hoverCursor: "pointer",
75-
selectionBorderColor: "green",
76-
});
73+
const canvas = new fabric.Canvas("canvas");
7774
tagsWritable.set([]);
7875
globalThis.canvas = canvas;
7976
// enables uniform scaling by default without the need for the Shift key

ts/image-occlusion/tools/tool-ellipse.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { objectAdded } from "./tool-undo-redo";
99
const addedEllipseIds: string[] = [];
1010

1111
export const drawEllipse = (canvas: fabric.Canvas): void => {
12+
canvas.selectionColor = "rgba(0, 0, 0, 0)";
1213
let ellipse, isDown, origX, origY;
1314

1415
stopDraw(canvas);

ts/image-occlusion/tools/tool-polygon.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ let panzoomX = 1, panzoomY = 1;
1717
const addedPolygonIds: string[] = [];
1818

1919
export const drawPolygon = (canvas: fabric.Canvas, panzoom: PanZoom): void => {
20+
canvas.selectionColor = "rgba(0, 0, 0, 0)";
2021
canvas.on("mouse:down", function(options) {
2122
try {
2223
if (options.target && options.target.id === pointsList[0].id) {

ts/image-occlusion/tools/tool-rect.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { objectAdded } from "./tool-undo-redo";
99
const addedRectangleIds: string[] = [];
1010

1111
export const drawRectangle = (canvas: fabric.Canvas): void => {
12+
canvas.selectionColor = "rgba(0, 0, 0, 0)";
1213
let rect, isDown, origX, origY;
1314

1415
stopDraw(canvas);

ts/image-occlusion/tools/tool-undo-redo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const undoRedoInit = (canvas: fabric.Canvas): void => {
3333
};
3434

3535
const validShape = (shape: fabric.Object): boolean => {
36-
if (shape.width <= 5 || shape.height <= 5 || !shape.id) return false;
36+
if (shape.width <= 5 || shape.height <= 5) return false;
3737
if (shapeType.indexOf(shape.type) === -1) return false;
3838
return true;
3939
};

0 commit comments

Comments
 (0)