From e4808a41e6bff65ee46917bdc5ca0de1d2ef8b3a Mon Sep 17 00:00:00 2001 From: Laura Date: Sun, 2 Apr 2023 23:20:40 +0200 Subject: [PATCH 1/3] Replace exponentially scaling eraser width with linearly scaling eraser width --- remarks/conversion/parsing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remarks/conversion/parsing.py b/remarks/conversion/parsing.py index 2a04e03..ac717ca 100644 --- a/remarks/conversion/parsing.py +++ b/remarks/conversion/parsing.py @@ -57,7 +57,7 @@ def process_tool(pen, dims, w, opc): opc = 0.6 # cc = 3 elif tool == "Eraser": - w = 1280 * w * w - 4800 * w + 4510 + w = w * 6 * 2.3 # cc = 2 elif tool == "SharpPencil" or tool == "TiltPencil": w = 16 * w - 27 From 8075d2f2d0d94b21e138b77ff50214e632a20355 Mon Sep 17 00:00:00 2001 From: Laura Date: Sun, 2 Apr 2023 23:20:57 +0200 Subject: [PATCH 2/3] Force eraser to always have a color_code of white --- remarks/conversion/drawing.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/remarks/conversion/drawing.py b/remarks/conversion/drawing.py index ec5e4f0..7b99e5d 100644 --- a/remarks/conversion/drawing.py +++ b/remarks/conversion/drawing.py @@ -8,7 +8,6 @@ RM_HEIGHT, ) - HL_COLOR_CODES = { 3: "yellow", 4: "green", @@ -25,7 +24,9 @@ } -def draw_svg(data, dims={"x": RM_WIDTH, "y": RM_HEIGHT}): +def draw_svg(data, dims={ + "x": RM_WIDTH, + "y": RM_HEIGHT}): stroke_color = SC_COLOR_CODES output = f'' @@ -164,6 +165,9 @@ def draw_annotations_on_pdf(data, page, inplace=False): # Scribbles else: + if seg_data == "Eraser": + # Overwrite eraser color to always be white. + seg_data['color-code'] = 2 for seg_points in seg_data["points"]: # https://pymupdf.readthedocs.io/en/latest/recipes-annotations.html#how-to-use-ink-annotations annot = page.add_ink_annot([seg_points]) From 48638d4cfdce0d1ce4527f7c633c25587c76b459 Mon Sep 17 00:00:00 2001 From: Laura Date: Sun, 2 Apr 2023 23:39:11 +0200 Subject: [PATCH 3/3] Undo whitespace changes --- remarks/conversion/drawing.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/remarks/conversion/drawing.py b/remarks/conversion/drawing.py index 7b99e5d..d67b419 100644 --- a/remarks/conversion/drawing.py +++ b/remarks/conversion/drawing.py @@ -8,6 +8,7 @@ RM_HEIGHT, ) + HL_COLOR_CODES = { 3: "yellow", 4: "green", @@ -24,9 +25,7 @@ } -def draw_svg(data, dims={ - "x": RM_WIDTH, - "y": RM_HEIGHT}): +def draw_svg(data, dims={"x": RM_WIDTH, "y": RM_HEIGHT}): stroke_color = SC_COLOR_CODES output = f''