Skip to content

Commit

Permalink
πŸ› Weird last drawn line highlighted glitch (#10)
Browse files Browse the repository at this point in the history
* πŸ› Weird last drawn line highlighted glitch

* πŸ› Remove last dot

* πŸ› Removed extra code
  • Loading branch information
sooxt98 authored Nov 20, 2023
1 parent 0117657 commit 5bc90b1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/view/drawing_canvas/drawing_canvas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class DrawingCanvas extends HookWidget {
final offset = box.globalToLocal(details.position);
final points = List<Offset>.from(currentSketch.value?.points ?? [])
..add(offset);

currentSketch.value = Sketch.fromDrawingMode(
Sketch(
points: points,
Expand All @@ -95,6 +96,20 @@ class DrawingCanvas extends HookWidget {
void onPointerUp(PointerUpEvent details) {
allSketches.value = List<Sketch>.from(allSketches.value)
..add(currentSketch.value!);
currentSketch.value = Sketch.fromDrawingMode(
Sketch(
points: [],
size: drawingMode.value == DrawingMode.eraser
? eraserSize.value
: strokeSize.value,
color: drawingMode.value == DrawingMode.eraser
? kCanvasColor
: selectedColor.value,
sides: polygonSides.value,
),
drawingMode.value,
filled.value,
);
}

Widget buildAllSketches(BuildContext context) {
Expand Down

0 comments on commit 5bc90b1

Please sign in to comment.