Repository navigation
fix(main-editor): report the tune editor to the sub-editor callbacks - #886
Merged
Merged
Conversation
openTuneEditor pushes the tune editor inside a HeroMode, so the `page is TuneEditor` check in openPage never matched and onOpenSubEditor, onStartCloseSubEditor and onEndCloseSubEditor reported SubEditor.unknown. openPage now looks through the HeroMode. The `T is ...` checks next to it compared a Type with a class and were never true, so they are dropped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem.
onOpenSubEditor,onStartCloseSubEditorandonEndCloseSubEditorreported the tune editor asSubEditor.unknown.openTuneEditorpushes the editor inside aHeroMode, soopenPage'spage is TuneEditorcheck never matched. TheT is ...checks next to the page checks could not help either:Tis a type argument, soT is TuneAdjustmentMatrixcompares aTypeobject with a class and is always false. An app that reacts to the opened sub-editor, for example to reset the canvas zoom or show its own tune controls, had to special-case the tune editor at every call site.Changes.
openPagelooks through aHeroModebefore checking the editor type.T is ...checks are removed; the detection now relies on the page type alone, which is what already matched for every other editor.Tests. In
main_editor_test.dart, opening the tune editor reports[SubEditor.tune]toonOpenSubEditor. Before the fix it reported[SubEditor.unknown].Verification.
flutter test(920) andflutter analyzepass on Flutter 3.47.2.onOpenSubEditorfor the paint, filter and tune editors: before, opening the tune editor from a zoomed canvas left the zoom in place; after, the canvas resets like it does for the other two.Version bumped to 14.10.2 with a changelog entry.
Related Issue: none
Type of Change