Skip to content

Commit

Permalink
Fix shape detection and ruler in pen tool
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 11, 2024
1 parent 630770c commit 534cdc8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/lib/handlers/pen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ class PenHandler extends Handler<PenTool> with ColoredHandler {
final currentIndexCubit = context.read<CurrentIndexCubit>();
final viewport = currentIndexCubit.state.cameraViewport;
final transform = context.read<TransformCubit>().state;
localPos =
viewport.utilities.getPointerPosition(localPos, currentIndexCubit);
final globalPos = transform.localToGlobal(localPos);
if (!bloc.isInBounds(globalPos)) return;
final state = bloc.state as DocumentLoadSuccess;
final settings = context.read<SettingsCubit>().state;
final penOnlyInput = settings.penOnlyInput;
localPos =
viewport.utilities.getPointerPosition(localPos, currentIndexCubit);
if (lastPosition[pointer] == localPos) return;
lastPosition[pointer] = localPos;
if (penOnlyInput && kind != PointerDeviceKind.stylus) {
Expand Down Expand Up @@ -174,6 +174,7 @@ class PenHandler extends Handler<PenTool> with ColoredHandler {
// Detects shapes and draws them
void _tickShapeDetection(
int pointer, EventContext context, Offset localPosition) {
if (!data.shapeDetectionEnabled) return;
final transform = context.getCameraTransform();
// Create recognizeUnistroke
final recognized = recognizeUnistroke(points);
Expand Down
12 changes: 6 additions & 6 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,10 @@ packages:
dependency: transitive
description:
name: io
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b
url: "https://pub.dev"
source: hosted
version: "1.0.4"
version: "1.0.5"
irondash_engine_context:
dependency: transitive
description:
Expand Down Expand Up @@ -948,10 +948,10 @@ packages:
dependency: transitive
description:
name: package_config
sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.1"
package_info_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -996,10 +996,10 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: "8c4967f8b7cb46dc914e178daa29813d83ae502e0529d7b0478330616a691ef7"
sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2"
url: "https://pub.dev"
source: hosted
version: "2.2.14"
version: "2.2.15"
path_provider_foundation:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions metadata/en-US/changelogs/124.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Improve thumbnail display to have rounded corners
* Change zoom dependent to false by default
* Fix export on web
* Fix shape detection always enabled in pen tool
* Fix ruler not working correctly in pen tool
* Fix zoom dependent not working correctly with the label tool ([#765](https://github.com/LinwoodDev/Butterfly/issues/765))

Read more here: https://linwood.dev/butterfly/2.2.3-rc.1

0 comments on commit 534cdc8

Please sign in to comment.