Skip to content

Commit

Permalink
Change aspect ratio to use 3 fraction digits for area
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Jan 1, 2025
1 parent 7e1341d commit d1099ea
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GEM
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.1029.0)
aws-sdk-core (3.214.0)
aws-sdk-core (3.214.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
Expand Down
18 changes: 4 additions & 14 deletions app/lib/handlers/stamp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,15 @@ class StampHandler extends PastingHandler<StampTool> {
_position = Offset.zero;
_component = getComponent(document);
if ((!force && _elements != null) || _component == null) return;
_elements = await Future.wait(
final elements = _elements = await Future.wait(
_component?.elements.map(Renderer.fromInstance).map((e) async {
await e.setup(document, assetService, page);
return e;
}) ??
[]);
Rect? rect;
for (final e in _elements!) {
final r = e.rect;
if (r == null) continue;
if (rect == null) {
rect = r;
} else {
rect = rect.expandToInclude(r);
}
}
if (rect != null) {
this.rect = rect;
}
rect = elements.map((e) => e.rect).nonNulls.fold<Rect?>(null,
(value, element) => value?.expandToInclude(element) ?? element) ??
Rect.zero;
}

@override
Expand Down
21 changes: 11 additions & 10 deletions app/lib/selections/tools/area.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ class AreaToolSelection extends ToolSelection<AreaTool> {
final tool = selected.first;
return [
...super.buildProperties(context),
CheckboxListTile(
title: Text(AppLocalizations.of(context).askForName),
value: tool.askForName,
onChanged: (value) => update(
context,
selected
.map((e) => e.copyWith(askForName: value ?? false))
.toList()),
),
const SizedBox(height: 4),
ExactSlider(
header: Text(AppLocalizations.of(context).width),
value: tool.constrainedWidth,
Expand Down Expand Up @@ -62,21 +72,12 @@ class AreaToolSelection extends ToolSelection<AreaTool> {
min: 0,
max: 10,
defaultValue: 0,
fractionDigits: 3,
onChangeEnd: (value) => update(
context,
selected
.map((e) => e.copyWith(constrainedAspectRatio: value))
.toList())),
const SizedBox(height: 4),
CheckboxListTile(
title: Text(AppLocalizations.of(context).askForName),
value: tool.askForName,
onChanged: (value) => update(
context,
selected
.map((e) => e.copyWith(askForName: value ?? false))
.toList()),
),
];
}

Expand Down
1 change: 1 addition & 0 deletions metadata/en-US/changelogs/127.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Add password protected notes ([#771](https://github.com/LinwoodDev/Butterfly/issues/771))
* Add option to import svg as text ([#596](https://github.com/LinwoodDev/Butterfly/issues/596))
* Improve grid files view
* Change aspect ratio to use 3 fraction digits for area
* Fix undo/redo tools not showing status correctly
* Fix grid not working correctly
* Fix capture thumbnail uses wrong position
Expand Down

0 comments on commit d1099ea

Please sign in to comment.