Skip to content

Commit

Permalink
Fix utilities state reset after undo
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Jan 9, 2025
1 parent 037f60d commit 045a933
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
6 changes: 0 additions & 6 deletions app/lib/bloc/document_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1069,13 +1069,7 @@ class DocumentBloc extends ReplayBloc<DocumentEvent, DocumentState> {
final current = state;
if (current is! DocumentLoaded) return;
final cubit = current.currentIndexCubit;
final document = current.data;
final page = current.page;
final assetService = current.assetService;
cubit.setSaveState(saved: SaveState.saved);
final tool = UtilitiesRenderer(cubit.state.utilitiesState);
await tool.setup(document, assetService, page);
cubit.unbake(tool: tool);
cubit.loadElements(current);
cubit.init(this);
}
Expand Down
3 changes: 2 additions & 1 deletion app/lib/cubits/current_index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,8 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
final backgrounds = page.backgrounds.map(Renderer.fromInstance).toList();
await Future.wait(backgrounds
.map((e) async => await e.setup(document, assetService, page)));
final utilities = UtilitiesRenderer(state.settingsCubit.state.utilities);
final utilities = UtilitiesRenderer(
state.settingsCubit.state.utilities, state.viewOption);
await utilities.setup(
docState.data,
docState.assetService,
Expand Down
5 changes: 0 additions & 5 deletions app/lib/views/edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ class _EditToolbarState extends State<EditToolbar> {
height: direction == Axis.horizontal ? fullSize : null,
width: direction == Axis.horizontal ? null : fullSize,
child: BlocBuilder<DocumentBloc, DocumentState>(
buildWhen: (previous, current) =>
previous is! DocumentLoadSuccess ||
current is! DocumentLoadSuccess ||
previous.tool != current.tool ||
previous.info.tools != current.info.tools,
builder: (context, state) {
if (state is! DocumentLoadSuccess) return Container();
final tools = state.info.tools;
Expand Down
6 changes: 5 additions & 1 deletion metadata/en-US/changelogs/128.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
This is a hotfix update, cherry picking some important fixes from the last 2.3.0-beta.0 nightly release.

* Add error boundaries for corrupted files
* Fix export button in data settings not working
* Fix utilties state resetted after undo

Cherry picks:
* Fix default stroke width ([#779](https://github.com/LinwoodDev/Butterfly/issues/779))
* Fix svg export shows wrong initial preset
* Fix capture thumbnail uses wrong position
* Fix zoom slider is not centered
* Fix shape detection list tile not clickable
* Fix corrupting files when saving ([#777](https://github.com/LinwoodDev/Butterfly/issues/777))
* Fix export button in data settings not working
* Fix action tools not updating

Read more here: https://linwood.dev/butterfly/2.2.4

0 comments on commit 045a933

Please sign in to comment.