Skip to content

Commit

Permalink
Fix unnessesary baking of canvas on every change, closes #503
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Oct 12, 2023
1 parent c33c413 commit 511ef7c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
5 changes: 3 additions & 2 deletions app/lib/cubits/current_index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
Future<void> refresh(NoteData document, AssetService assetService,
DocumentPage page, DocumentInfo info,
[Area? currentArea]) async {
const mapEq = MapEquality();
if (!isClosed) {
_disposeForegrounds();
final temporaryForegrounds = state.temporaryHandler
Expand All @@ -216,8 +217,8 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
.map((e) async => await e.setup(document, assetService, page)));
final rendererStates = state.handler.rendererStates;
final temporaryRendererStates = state.temporaryHandler?.rendererStates;
final shouldBake = state.rendererStates != rendererStates ||
state.temporaryRendererStates != temporaryRendererStates;
final shouldBake = !mapEq.equals(state.rendererStates, rendererStates) ||
!mapEq.equals(state.temporaryRendererStates, temporaryRendererStates);
emit(state.copyWith(
temporaryForegrounds: temporaryForegrounds,
foregrounds: foregrounds,
Expand Down
3 changes: 2 additions & 1 deletion app/lib/views/files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ class _FilesViewState extends State<FilesView> {
if (!newPath.endsWith('.bfly')) {
newPath += '.bfly';
}
await _fileSystem.updateDocument(newPath, asset.createDocument());
await _fileSystem.updateDocument(
newPath, asset.createDocument());
_reloadFileSystem();
}
},
Expand Down
26 changes: 13 additions & 13 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ packages:
dependency: "direct main"
description:
name: cross_file
sha256: fd832b5384d0d6da4f6df60b854d33accaaeb63aa9e10e736a87381f08dee2cb
sha256: "445db18de832dba8d851e287aff8ccf169bed30d2e94243cb54c7d2f1ed2142c"
url: "https://pub.dev"
source: hosted
version: "0.3.3+5"
version: "0.3.3+6"
crypto:
dependency: transitive
description:
Expand Down Expand Up @@ -1284,26 +1284,26 @@ packages:
dependency: transitive
description:
name: vector_graphics
sha256: "670f6e07aca990b4a2bcdc08a784193c4ccdd1932620244c3a86bb72a0eac67f"
sha256: b16dadf7eb610e20da044c141b4a0199a5e8082ca21daba68322756f953ce714
url: "https://pub.dev"
source: hosted
version: "1.1.7"
version: "1.1.9"
vector_graphics_codec:
dependency: transitive
description:
name: vector_graphics_codec
sha256: "7451721781d967db9933b63f5733b1c4533022c0ba373a01bdd79d1a5457f69f"
sha256: a4b01403d5c613db115e30e71eca33f7e9e09f2d3c52c3fb84e16333ecddc539
url: "https://pub.dev"
source: hosted
version: "1.1.7"
version: "1.1.9"
vector_graphics_compiler:
dependency: transitive
description:
name: vector_graphics_compiler
sha256: "80a13c613c8bde758b1464a1755a7b3a8f2b6cec61fbf0f5a53c94c30f03ba2e"
sha256: d26c0e2f237476426523eb25512e4c09fa27c6d33ed659a0e69d79e20b5dc47f
url: "https://pub.dev"
source: hosted
version: "1.1.7"
version: "1.1.9"
vector_math:
dependency: transitive
description:
Expand Down Expand Up @@ -1332,10 +1332,10 @@ packages:
dependency: transitive
description:
name: web
sha256: ccbbfbf29732ee1b391c4c6d13e7032d851f675f47365e81904e4c6fd669c854
sha256: "14f1f70c51119012600c5f1f60ca68efda5a9b6077748163c6af2893ec5df8fc"
url: "https://pub.dev"
source: hosted
version: "0.2.2-beta"
version: "0.2.1-beta"
web_socket_channel:
dependency: transitive
description:
Expand All @@ -1348,10 +1348,10 @@ packages:
dependency: transitive
description:
name: webdriver
sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e"
sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "3.0.2"
win32:
dependency: transitive
description:
Expand Down Expand Up @@ -1393,5 +1393,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0-194.0.dev <4.0.0"
dart: ">=3.2.0-157.0.dev <4.0.0"
flutter: ">=3.13.0"
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/74.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Change reload button icon in remote button
* Rename document directory to data directory
* Fix adding template instead of document when clicking create file in files view
* Fix unnessesary baking of canvas on every change ([#503](https://github.com/LinwoodDev/Butterfly/issues/503))
* Improve documentation

View all changes in the blog: https://linwood.dev/butterfly/2.0.0-beta.10

0 comments on commit 511ef7c

Please sign in to comment.