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 id: platform
attributes: attributes:
label: Platform label: Platform
description: What type is your server running on? description: On which platform did you encounter this bug?
options: options:
- Android - Android
- Windows - Windows
- MacOS - MacOS
- Linux - Linux
- Web - Web
multiple: true
validations: validations:
required: true required: true
- type: textarea - type: textarea

View File

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

View File

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

View File

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

View File

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

View File

@ -12,11 +12,11 @@
"dependencies": { "dependencies": {
"@astrojs/check": "^0.9.4", "@astrojs/check": "^0.9.4",
"@astrojs/react": "^4.3.0", "@astrojs/react": "^4.3.0",
"@astrojs/starlight": "^0.34.6", "@astrojs/starlight": "^0.35.1",
"@phosphor-icons/react": "^2.1.10", "@phosphor-icons/react": "^2.1.10",
"@types/react": "^19.1.8", "@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6", "@types/react-dom": "^19.1.6",
"astro": "^5.11.1", "astro": "^5.12.0",
"react": "^19.1.0", "react": "^19.1.0",
"react-dom": "^19.1.0", "react-dom": "^19.1.0",
"remark-gemoji": "^8.0.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 ## Configuration
| Property | Default | Description | | Property | Default | Description |
| ----------------: | :-----: | :------------------------------------------------------------------------------- | | --------------: | :-----------------: | :------------------------------------------------------------------------------------------------------ |
| Color | Black | The color that will be drawn | | Color | Black | The color that will be drawn |
| Stroke width | 5 | The width of the stroke | | 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. |
| 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. 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 ## Configuration
| Property | Default | Description | | Property | Default | Description |
|------------------:|:-------:|:---------------------------------------------------------------------------------| | -----------: | :---------: | :----------------------------------------------- |
| Stroke width | 5 | The width of the stroke | | 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