Add stroke width to polygon tool toolbar

This commit is contained in:
CodeDoctorDE
2025-07-18 21:15:03 +02:00
parent cb6192a44d
commit 23b4e31925
11 changed files with 347 additions and 319 deletions

View File

@ -29,13 +29,14 @@ body:
id: platform
attributes:
label: Platform
description: What type is your server running on?
description: On which platform did you encounter this bug?
options:
- Android
- Windows
- MacOS
- Linux
- Web
multiple: true
validations:
required: true
- type: textarea

View File

@ -13,10 +13,10 @@ packages:
dependency: "direct dev"
description:
name: analyzer
sha256: abf63d42450c7ad6d8188887d16eeba2f1ff92ea8d8dc673213e99fb3c02b194
sha256: b1ade5707ab7a90dfd519eaac78a7184341d19adb6096c68d499b59c7c6cf880
url: "https://pub.dev"
source: hosted
version: "7.5.7"
version: "7.7.0"
archive:
dependency: "direct main"
description:
@ -61,10 +61,10 @@ packages:
dependency: transitive
description:
name: build
sha256: "51dc711996cbf609b90cbe5b335bbce83143875a9d58e4b5c6d3c4f684d3dda7"
sha256: "7d95cbbb1526ab5ae977df9b4cc660963b9b27f6d1075c0b34653868911385e4"
url: "https://pub.dev"
source: hosted
version: "2.5.4"
version: "3.0.0"
build_config:
dependency: transitive
description:
@ -85,26 +85,26 @@ packages:
dependency: transitive
description:
name: build_resolvers
sha256: ee4257b3f20c0c90e72ed2b57ad637f694ccba48839a821e87db762548c22a62
sha256: "38c9c339333a09b090a638849a4c56e70a404c6bdd3b511493addfbc113b60c2"
url: "https://pub.dev"
source: hosted
version: "2.5.4"
version: "3.0.0"
build_runner:
dependency: "direct dev"
description:
name: build_runner
sha256: "382a4d649addbfb7ba71a3631df0ec6a45d5ab9b098638144faf27f02778eb53"
sha256: b971d4a1c789eba7be3e6fe6ce5e5b50fd3719e3cb485b3fad6d04358304351d
url: "https://pub.dev"
source: hosted
version: "2.5.4"
version: "2.6.0"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
sha256: "85fbbb1036d576d966332a3f5ce83f2ce66a40bea1a94ad2d5fc29a19a0d3792"
sha256: c04e612ca801cd0928ccdb891c263a2b1391cb27940a5ea5afcf9ba894de5d62
url: "https://pub.dev"
source: hosted
version: "9.1.2"
version: "9.2.0"
built_collection:
dependency: transitive
description:
@ -117,10 +117,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: "082001b5c3dc495d4a42f1d5789990505df20d8547d42507c29050af6933ee27"
sha256: "0b1b12a0a549605e5f04476031cd0bc91ead1d7c8e830773a18ee54179b3cb62"
url: "https://pub.dev"
source: hosted
version: "8.10.1"
version: "8.11.0"
checked_yaml:
dependency: transitive
description:
@ -198,10 +198,10 @@ packages:
dependency: transitive
description:
name: dart_style
sha256: "5b236382b47ee411741447c1f1e111459c941ea1b3f2b540dde54c210a3662af"
sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.1.1"
ffi:
dependency: transitive
description:
@ -230,10 +230,10 @@ packages:
dependency: "direct dev"
description:
name: freezed
sha256: "2d399f823b8849663744d2a9ddcce01c49268fb4170d0442a655bf6a2f47be22"
sha256: da32f8ba8cfcd4ec71d9decc8cbf28bd2c31b5283d9887eb51eb4a0659d8110c
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.2.0"
freezed_annotation:
dependency: "direct main"
description:
@ -266,14 +266,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.2"
http:
dependency: transitive
description:
name: http
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
url: "https://pub.dev"
source: hosted
version: "1.4.0"
http_multi_server:
dependency: transitive
description:
@ -318,10 +310,10 @@ packages:
dependency: "direct dev"
description:
name: json_serializable
sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c
sha256: ce2cf974ccdee13be2a510832d7fba0b94b364e0b0395dee42abaa51b855be27
url: "https://pub.dev"
source: hosted
version: "6.9.5"
version: "6.10.0"
lints:
dependency: "direct dev"
description:
@ -487,10 +479,10 @@ packages:
dependency: transitive
description:
name: source_gen
sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b"
sha256: fc787b1f89ceac9580c3616f899c9a447413cbdac1df071302127764c023a134
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "3.0.0"
source_helper:
dependency: transitive
description:

View File

@ -11,7 +11,7 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.4.0)
aws-partitions (1.1126.0)
aws-partitions (1.1128.0)
aws-sdk-core (3.226.2)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
@ -22,7 +22,7 @@ GEM
aws-sdk-kms (1.106.0)
aws-sdk-core (~> 3, >= 3.225.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.192.0)
aws-sdk-s3 (1.193.0)
aws-sdk-core (~> 3, >= 3.225.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)

View File

@ -8,7 +8,7 @@ import 'package:phosphor_flutter/phosphor_flutter.dart';
class PolygonToolbarView extends StatelessWidget
implements PreferredSizeWidget {
final PolygonTool tool;
final void Function(PolygonTool tool) onToolChanged;
final ValueChanged<PolygonTool> onToolChanged;
final bool editing;
final VoidCallback? onFinishShape, onSubmit, onDelete, onToggleEdit;
@ -30,6 +30,10 @@ class PolygonToolbarView extends StatelessWidget
onChanged: (value) => onToolChanged.call(
tool.copyWith(property: tool.property.copyWith(color: value)),
),
strokeWidth: tool.property.strokeWidth,
onStrokeWidthChanged: (value) => onToolChanged.call(
tool.copyWith(property: tool.property.copyWith(strokeWidth: value)),
),
actions: [
IconButton(
tooltip: AppLocalizations.of(context).edit,

View File

@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: analyzer
sha256: abf63d42450c7ad6d8188887d16eeba2f1ff92ea8d8dc673213e99fb3c02b194
sha256: b1ade5707ab7a90dfd519eaac78a7184341d19adb6096c68d499b59c7c6cf880
url: "https://pub.dev"
source: hosted
version: "7.5.7"
version: "7.7.0"
animations:
dependency: "direct main"
description:
@ -93,10 +93,10 @@ packages:
dependency: transitive
description:
name: build
sha256: "51dc711996cbf609b90cbe5b335bbce83143875a9d58e4b5c6d3c4f684d3dda7"
sha256: "7d95cbbb1526ab5ae977df9b4cc660963b9b27f6d1075c0b34653868911385e4"
url: "https://pub.dev"
source: hosted
version: "2.5.4"
version: "3.0.0"
build_config:
dependency: transitive
description:
@ -117,26 +117,26 @@ packages:
dependency: transitive
description:
name: build_resolvers
sha256: ee4257b3f20c0c90e72ed2b57ad637f694ccba48839a821e87db762548c22a62
sha256: "38c9c339333a09b090a638849a4c56e70a404c6bdd3b511493addfbc113b60c2"
url: "https://pub.dev"
source: hosted
version: "2.5.4"
version: "3.0.0"
build_runner:
dependency: "direct dev"
description:
name: build_runner
sha256: "382a4d649addbfb7ba71a3631df0ec6a45d5ab9b098638144faf27f02778eb53"
sha256: b971d4a1c789eba7be3e6fe6ce5e5b50fd3719e3cb485b3fad6d04358304351d
url: "https://pub.dev"
source: hosted
version: "2.5.4"
version: "2.6.0"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
sha256: "85fbbb1036d576d966332a3f5ce83f2ce66a40bea1a94ad2d5fc29a19a0d3792"
sha256: c04e612ca801cd0928ccdb891c263a2b1391cb27940a5ea5afcf9ba894de5d62
url: "https://pub.dev"
source: hosted
version: "9.1.2"
version: "9.2.0"
built_collection:
dependency: transitive
description:
@ -149,10 +149,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: "082001b5c3dc495d4a42f1d5789990505df20d8547d42507c29050af6933ee27"
sha256: "0b1b12a0a549605e5f04476031cd0bc91ead1d7c8e830773a18ee54179b3cb62"
url: "https://pub.dev"
source: hosted
version: "8.10.1"
version: "8.11.0"
butterfly_api:
dependency: "direct main"
description:
@ -180,10 +180,10 @@ packages:
dependency: transitive
description:
name: camera_avfoundation
sha256: "14d7698b26e95a7db371bee1b07358245e5100640ab5e07c036be23f51383d43"
sha256: b389be4a325742a3950e50475067d95a3de2fb32ba3f31bfcc62b0b6d19907a6
url: "https://pub.dev"
source: hosted
version: "0.9.20+2"
version: "0.9.20+4"
camera_platform_interface:
dependency: transitive
description:
@ -325,10 +325,10 @@ packages:
dependency: transitive
description:
name: dart_style
sha256: "5b236382b47ee411741447c1f1e111459c941ea1b3f2b540dde54c210a3662af"
sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.1.1"
dbus:
dependency: transitive
description:
@ -598,10 +598,10 @@ packages:
dependency: "direct dev"
description:
name: freezed
sha256: "2d399f823b8849663744d2a9ddcce01c49268fb4170d0442a655bf6a2f47be22"
sha256: da32f8ba8cfcd4ec71d9decc8cbf28bd2c31b5283d9887eb51eb4a0659d8110c
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.2.0"
freezed_annotation:
dependency: transitive
description:
@ -744,10 +744,10 @@ packages:
dependency: "direct dev"
description:
name: json_serializable
sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c
sha256: ce2cf974ccdee13be2a510832d7fba0b94b364e0b0395dee42abaa51b855be27
url: "https://pub.dev"
source: hosted
version: "6.9.5"
version: "6.10.0"
leak_tracker:
dependency: transitive
description:
@ -1326,10 +1326,10 @@ packages:
dependency: transitive
description:
name: source_gen
sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b"
sha256: fc787b1f89ceac9580c3616f899c9a447413cbdac1df071302127764c023a134
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "3.0.0"
source_helper:
dependency: transitive
description:
@ -1669,4 +1669,4 @@ packages:
version: "3.1.3"
sdks:
dart: ">=3.8.1 <4.0.0"
flutter: ">=3.32.6"
flutter: ">=3.32.7"

View File

@ -17,7 +17,7 @@ version: 2.4.0-beta.2+142
environment:
sdk: ">=3.8.0 <4.0.0"
flutter: 3.32.6
flutter: 3.32.7
dependencies:
flutter:
@ -122,7 +122,7 @@ dev_dependencies:
sdk: flutter
flutter_driver:
sdk: flutter
build_runner: ^2.4.9
build_runner: ^2.6.0
json_serializable: ^6.7.1
freezed: ^3.0.2
# For information on the generic Dart part of this file, see the

View File

@ -12,11 +12,11 @@
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/react": "^4.3.0",
"@astrojs/starlight": "^0.34.6",
"@astrojs/starlight": "^0.35.1",
"@phosphor-icons/react": "^2.1.10",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"astro": "^5.11.1",
"astro": "^5.12.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"remark-gemoji": "^8.0.0",

501
docs/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,14 @@ With this tool you can draw on this paper.
## Configuration
| Property | Default | Description |
| ----------------: | :-----: | :------------------------------------------------------------------------------- |
| Color | Black | The color that will be drawn |
| Stroke width | 5 | The width of the stroke |
| Stroke multiplier | 1 | If you have a stylus, this is the multiplier which will be added to the pressure |
| Zoom dependent | false | This will change the stroke width based on the zoom level. |
| Property | Default | Description |
| --------------: | :-----------------: | :------------------------------------------------------------------------------------------------------ |
| Color | Black | The color that will be drawn |
| Stroke width | 5 | The width of the stroke |
| Zoom dependent | false | This will change the stroke width based on the zoom level. |
| Shape Detection | false (Delay: 0.5s) | This will try to detect shapes while drawing. If a shape is detected, it will be replaced by the shape. |
| Thinning | 0.4 | This effect of pressure on the stroke size |
| Smoothing | 0.5 | This will smooth the edges of the stroke. |
| Streamline | 0.5 | How much the pen will follow the movement of the mouse. |
| Color | Black | The color that will be drawn |
| Fill | Transparent | The color that will be drawn inside the shape |

View File

@ -4,10 +4,32 @@ title: Polygon tool
With this tool you can create custom shapes.
**Work in progress!**
## Usage
1. Click on the canvas to add the first point of the polygon.
2. Click again to add subsequent points.
3. Now you have three options to finish the polygon:
1. Click in the toolbar on the `Finish` button. This will connect the last point to the first point.
2. Click in the toolbar on the `Submit` button. This will create the polygon without connecting the last point to the first.
3. Change the tool. This will also create the polygon without connecting the last point to the first.
4. If you want to remove the selected point, click on the `Delete` button in the toolbar.
5. To edit the last point, click on the `Edit` button in the toolbar. This will allow you to click on a point and drag it to round it off.
## Toolbar
The toolbar contains the following buttons:
* `Edit`: Allows you to change the selected point of the polygon.
* `Delete`: Allows you to delete the selected point of the polygon.
* `Finish`: Connects the last point to the first point, completing the polygon.
* `Submit`: Completes the polygon without connecting the last point to the first.
* Stroke width: Adjusts the width of the polygon's stroke.
* Colors to change the stroke color of the polygon.
## Configuration
| Property | Default | Description |
|------------------:|:-------:|:---------------------------------------------------------------------------------|
| Stroke width | 5 | The width of the stroke |
| Property | Default | Description |
| -----------: | :---------: | :----------------------------------------------- |
| Stroke width | 5 | The width of the stroke |
| Color | Black | The color that will be drawn |
| Fill | Transparent | The color that will be drawn inside the polygon. |

View File

@ -0,0 +1,3 @@
* Add stroke width to polygon tool toolbar
Read more here: https://linwood.dev/butterfly/2.4.0-beta.2