Replace the shadow-only inspector with layered effect and stroke controls and per-corner distortion editors. Share color inputs, layer rows, keyframe controls and property edit boundaries; keep nested selection menus within their property popover and update localized labels. Add property editing, preview interaction and benchmark comparison coverage. Validation: Dart analysis reports no issues and 160 targeted application tests pass. The macOS development app was rebuilt and visually checked during native rendering validation. Exclude local dependency override changes from the committed lockfile.
85 lines
2.2 KiB
Dart
85 lines
2.2 KiB
Dart
import 'package:cutdex_sdk/editor.dart';
|
|
import 'package:cutdex_sdk/preview.dart';
|
|
import 'package:cutdex_sdk/timeline/model.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'property_edit_boundary.dart';
|
|
import '../../workspace/timeline_session.dart';
|
|
|
|
/// Owns the asynchronous edit boundary for one selected clip.
|
|
class PropertyEditController extends ChangeNotifier {
|
|
PropertyEditController({
|
|
required this.session,
|
|
required this.sequence,
|
|
required this.clip,
|
|
required this.projectId,
|
|
required this.timelineId,
|
|
required this.operation,
|
|
});
|
|
final EditorTimelineSession session;
|
|
final SequenceId sequence;
|
|
final ElementId clip;
|
|
final String projectId, timelineId, operation;
|
|
Object get identity => (session, sequence, clip, projectId, timelineId);
|
|
late final _boundary = PropertyEditBoundary(session, sequence, clip);
|
|
bool _disposed = false;
|
|
bool _saving = false;
|
|
bool _failed = false;
|
|
bool get saving => _saving;
|
|
bool get failed => _failed;
|
|
|
|
@override
|
|
void dispose() {
|
|
_disposed = true;
|
|
_boundary.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
ClipParameterAnimation? get animation {
|
|
final view = session.view(sequence);
|
|
final query = view.version.kernelVersion.query();
|
|
final handle = query.elementById(clip);
|
|
return handle == null
|
|
? null
|
|
: ClipParameterAnimation(
|
|
query.element(handle),
|
|
view.playheadTick - query.absoluteStart(handle),
|
|
);
|
|
}
|
|
|
|
Future<bool> run(
|
|
PreviewController? preview,
|
|
void Function(EditorCommandService, int) action, {
|
|
bool seek = false,
|
|
}) async {
|
|
if (_disposed || saving || !_boundary.canRun(preview)) return false;
|
|
try {
|
|
return await _boundary.run(
|
|
preview,
|
|
(target) {
|
|
action(session.commands, target.tick);
|
|
return true;
|
|
},
|
|
operation: operation,
|
|
seek: seek,
|
|
started: () {
|
|
_saving = true;
|
|
_failed = false;
|
|
notifyListeners();
|
|
},
|
|
);
|
|
} catch (_) {
|
|
if (!_disposed) {
|
|
_failed = true;
|
|
notifyListeners();
|
|
}
|
|
return false;
|
|
} finally {
|
|
if (!_disposed) {
|
|
_saving = false;
|
|
notifyListeners();
|
|
}
|
|
}
|
|
}
|
|
}
|