feat: persist fill/fit view mode in window.json (v1.5.0)
The double-click fill/fit mode was hardcoded (image_canvas: _isFilled = true) and reset on every image change, so it never survived a restart. It is now stored as "filled" in window.json and restored on launch and on image switch. WindowPersistence.saveSync() now merges with the existing file, otherwise the startup/move/resize geometry writes would drop the mode key. Also: version 1.5.0, CHANGELOG entry, dist/ ships imajviewer_1.5.0_amd64.deb (replaces 1.4.2).
This commit is contained in:
1 parent
b3bd540549
commit
2cd9e6c357
6 files changed
+50
-11
No files matched your search
@@ -6,6 +6,7 @@ import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../services/crop_save_service.dart';
|
||||
import '../services/window_persistence.dart';
|
||||
|
||||
class ImageCanvas extends StatefulWidget {
|
||||
final String filePath;
|
||||
@@ -15,7 +16,7 @@ class ImageCanvas extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ImageCanvasState extends State<ImageCanvas> {
|
||||
bool _isFilled = true;
|
||||
bool _isFilled = WindowPersistence.filled;
|
||||
final GlobalKey _imageKey = GlobalKey();
|
||||
double _tx = 0, _ty = 0, _sc = 1.0;
|
||||
Size _vpSize = Size.zero;
|
||||
@@ -199,7 +200,7 @@ class ImageCanvasState extends State<ImageCanvas> {
|
||||
}
|
||||
|
||||
void _resetView() {
|
||||
_tx = 0; _ty = 0; _sc = 1.0; _isFilled = true;
|
||||
_tx = 0; _ty = 0; _sc = 1.0; _isFilled = WindowPersistence.filled;
|
||||
_angle = 0; _contrast = 1.0; _saturation = 1.0; _brightness = 0;
|
||||
_usingFullRes = false;
|
||||
_imageSize = Size.zero;
|
||||
@@ -209,6 +210,7 @@ class ImageCanvasState extends State<ImageCanvas> {
|
||||
void _toggleFillFit() {
|
||||
_isFilled = !_isFilled; _tx = 0; _ty = 0; _sc = 1.0;
|
||||
_angle = 0; _contrast = 1.0; _saturation = 1.0; _brightness = 0;
|
||||
WindowPersistence.saveFilled(_isFilled);
|
||||
_markRenderDirty();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user