Skip to content

Commit

Permalink
Fix areas not refreshing after deleting, closes #541
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 6, 2023
1 parent d21413a commit 206c006
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/lib/bloc/document_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -672,14 +672,21 @@ class DocumentBloc extends ReplayBloc<DocumentEvent, DocumentState> {
if (!(current.embedding?.editable ?? true)) return;
final areas = List<Area>.from(current.page.areas)
..removeWhere((e) => event.areas.contains(e.name));
final currentDocument = current.page.copyWith(areas: areas);
final currentPage = current.page.copyWith(areas: areas);
var shouldRepaint = false;
for (var element in current.renderers) {
if (areas.contains(element.area) &&
await element.onAreaUpdate(current.data, currentDocument, null)) {
_repaint(emit);
await element.onAreaUpdate(current.data, currentPage, null)) {
shouldRepaint = true;
}
}
_saveState(emit, current.copyWith(page: currentDocument));
if (shouldRepaint) {
_repaint(emit);
}
_saveState(emit, current.copyWith(page: currentPage)).then((_) {
current.currentIndexCubit.refresh(
current.data, current.assetService, currentPage, current.info);
});
});
on<AreaChanged>((event, emit) async {
final current = state;
Expand Down
1 change: 1 addition & 0 deletions app/lib/handlers/area.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class AreaHandler extends Handler<AreaTool> {
));
}
if (name == null) return;
currentRect = null;
context.getDocumentBloc().add(AreasCreated([
Area(
width: rect.width,
Expand Down
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/82.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Fix zoom usable if hidden ([#538](https://github.com/LinwoodDev/Butterfly/issues/538))
* Fix full screen menu item ([#535](https://github.com/LinwoodDev/Butterfly/issues/535))
* Fix selecting small areas ([#543](https://github.com/LinwoodDev/Butterfly/issues/543))
* Fix areas not refreshing after deleting ([#541](https://github.com/LinwoodDev/Butterfly/issues/541))
* Fix tool not selected when added

View all changes in the blog: https://linwood.dev/butterfly/2.0.0-rc.1

0 comments on commit 206c006

Please sign in to comment.